Build portfolio trackers, performance dashboards, or risk analysis tools. Access live portfolio snapshots, historical performance, and instrument-level data.
const BASE = "https://public-api.etoro.com/api/v1";
const headers = {
"x-api-key": process.env.ETORO_API_KEY,
"x-user-key": process.env.ETORO_USER_KEY,
"x-request-id": crypto.randomUUID(),
};
// Get portfolio snapshot
const portfolio = await fetch(
`${BASE}/trading/info/demo/portfolio`,
{ headers }
).then(r => r.json());
const { equity, pnl, positions } = portfolio.data;
console.log(`Equity: $${equity} | PnL: $${pnl}`);
// Get instrument metadata to map IDs to names
const instruments = await fetch(
`${BASE}/market-data/instruments`,
{ headers }
).then(r => r.json());
for (const pos of positions) {
const inst = instruments.data.find(
i => i.instrumentId === pos.instrumentId
);
console.log(`${inst?.name}: ${pos.pnl}`);
}
// Get OHLC candles for charting
const candles = await fetch(
`${BASE}/market-data/instruments/history/candles?instrumentId=1001&period=1d&count=30`,
{ headers }
).then(r => r.json());
console.log(`Last 30 days: ${candles.data.length} candles`);Learn how to get your API keys, make your first request, and understand eToro API response formats.
Connect to eToro's WebSocket API for live price streaming, handle reconnections, and process real-time market data efficiently.
How to programmatically search, filter, and explore eToro's instrument catalog — asset classes, exchanges, industries, and historical data.
An end-to-end tutorial combining the WebSocket API and Market Data endpoints to build a live price dashboard.