Market Data Deep Dive
Search instruments, fetch real-time rates, and pull historical candle data from the eToro API.
Overview
The Market Data API gives you access to instruments, real-time pricing, historical candles, and exchange metadata. This guide covers the core endpoints and shows practical code examples.
Searching Instruments
Use the search endpoint to find instruments by symbol:
curl "https://public-api.etoro.com/api/v1/market-data/search?internalSymbolFull=BTC" \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
The internalSymbolFull parameter matches against instrument symbols. The response returns matching instruments with their instrumentId, which you'll use in other API calls.
Instrument Metadata
Get details about all available instruments:
curl https://public-api.etoro.com/api/v1/market-data/instruments \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
This returns metadata including instrument type, exchange, and trading hours.
Real-Time Rates
Fetch current bid/ask prices:
curl https://public-api.etoro.com/api/v1/market-data/instruments/rates \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
For real-time streaming rates, use the WebSocket API instead.
Historical Candles
Pull OHLCV (Open, High, Low, Close, Volume) candle data for charting and backtesting:
curl https://public-api.etoro.com/api/v1/market-data/instruments/candles \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
Building a Price Chart (JavaScript)
const crypto = require('crypto');
const headers = {
'x-api-key': process.env.ETORO_API_KEY,
'x-user-key': process.env.ETORO_USER_KEY,
'x-request-id': crypto.randomUUID(),
};
const res = await fetch(
'https://public-api.etoro.com/api/v1/market-data/instruments/candles',
{ headers }
);
const candles = await res.json();
console.log('Candle data:', candles);
Closing Prices
Get historical closing prices for analysis:
curl https://public-api.etoro.com/api/v1/market-data/instruments/closing-prices \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
Reference Data
Get supporting reference data:
# Asset classes (stocks, crypto, ETFs, etc.)
curl https://public-api.etoro.com/api/v1/market-data/instrument-types \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
# Supported exchanges
curl https://public-api.etoro.com/api/v1/market-data/exchanges \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
# Stock industries
curl https://public-api.etoro.com/api/v1/market-data/industries \
-H "x-api-key: $ETORO_API_KEY" \
-H "x-user-key: $ETORO_USER_KEY" \
-H "x-request-id: $(uuidgen)"
WebSocket Streaming
For real-time price updates, connect to the WebSocket API:
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.etoro.com/ws');
ws.on('open', () => {
// Authenticate
ws.send(JSON.stringify({
id: crypto.randomUUID(),
operation: 'Authenticate',
data: {
userKey: process.env.ETORO_USER_KEY,
apiKey: process.env.ETORO_API_KEY,
},
}));
// Subscribe to instrument updates
ws.send(JSON.stringify({
id: crypto.randomUUID(),
operation: 'Subscribe',
data: {
topics: ['instrument:100000'],
snapshot: false,
},
}));
});
ws.on('message', (data) => {
console.log('Update:', JSON.parse(data));
});
Next Steps
- Demo Trading Guide — execute trades using market data
- API Reference — full endpoint documentation