Python
Uses the requests package (pip install requests) and, for streaming, websocket-client.
All examples assume the EA is running on the same computer with default ports. Order examples are for demo accounts.
Get a price
Section titled “Get a price”import requests
API = "http://127.0.0.1:81"q = requests.get(f"{API}/v1/quote", params={"symbol": "EURUSD"}).json()print(q["SYMBOL"], q["BID"], q["ASK"])Send and close an order (demo)
Section titled “Send and close an order (demo)”r = requests.post(f"{API}/v1/order", params={ "symbol": "EURUSD", "volume": 0.01, "type": "ORDER_TYPE_BUY", "sl": 1.1050, "tp": 1.1200, "comment": "python"}).json()if r["ERROR_ID"] == 0: ticket = r["ORDER"] print("opened", ticket) c = requests.post(f"{API}/v1/order/close", params={"ticket": ticket}).json() print(c["TYPE"], c["RETCODE"])else: print("error", r["ERROR_ID"], r["ERROR_DESCRIPTION"])Candles into pandas
Section titled “Candles into pandas”import pandas as pd
h = requests.get(f"{API}/v1/history/prices", params={ "symbol": "EURUSD", "timeframe": "PERIOD_H1", "from_date": "2026.10.01 00:00:00", "to_date": "2026.10.28 00:00:00"}).json()df = pd.DataFrame(h["RATES"])print(df.tail())Stream ticks
Section titled “Stream ticks”import json, websocket # pip install websocket-client
requests.post(f"{API}/v1/track/prices", params={"symbols": "EURUSD,XAUUSD"})ws = websocket.create_connection("ws://127.0.0.1:81")while True: msg = json.loads(ws.recv()) if msg["MSG"] == "TRACK_PRICES": print(msg["TIME"], msg["SYMBOL"], msg["BID"], msg["ASK"])