Build algo trading bots
Automate trading strategies on real or demo accounts. Open and close positions, manage portfolios, and access live PnL — all via REST.
Why eToro?
- Real + Demo Trading APIs with identical endpoints — build once, deploy to either
- WebSocket streaming for real-time price data and market events
- Production-grade sandbox: the Demo API mirrors real behavior exactly
- Full portfolio management: positions, orders, trade history, PnL
- Rate limits designed for automated strategies, not just manual use
How it works
1
Your Strategy2
eToro REST API3
Order Execution4
MarketQuick start example
Copy this code to get started. Uses real eToro API endpoints.
algo_strategy.py
import requests, uuid
BASE = "https://public-api.etoro.com/api/v1"
HEADERS = {
"x-api-key": "YOUR_PUBLIC_API_KEY",
"x-user-key": "YOUR_USER_KEY",
"x-request-id": str(uuid.uuid4()),
}
# Search for an instrument
search = requests.get(
f"{BASE}/market-data/search",
headers=HEADERS,
params={"internalSymbolFull": "TSLA"}
).json()
instrument_id = search["items"][0]["instrumentId"]
# Open a BUY position on Demo
order = requests.post(
f"{BASE}/trading/execution/demo/market-open-orders/by-amount",
headers=HEADERS,
json={
"InstrumentId": instrument_id,
"Amount": 5000,
"Leverage": 1,
"IsBuy": True,
}
).json()
print(f"Order placed: {order}")
# Check portfolio
portfolio = requests.get(
f"{BASE}/trading/demo/portfolio",
headers=HEADERS,
).json()
print(f"Portfolio: {portfolio}")Relevant APIs
Trading (Real)11
Trading (Demo)10
Market Data8
WebSocket∞
Ready to start building?
Get your API keys and make your first call in under 10 minutes.