Instruments & prices
Symbols
GET /api/v1/symbols/me lists every symbol your account can trade, with the
settings of your group (spread, lot limits, margin). Load it once at startup
and cache it by id.
To fetch one symbol by name:
curl "https://api.onlytradeplatform.com/api/v1/symbols/me/by_name?symbol=EURUSD" \
-H "Authorization: Bearer $TOKEN"
GET /api/v1/symbols/me/tree returns the same symbols grouped by class (Forex,
Metals, Indices…).
Fields a bot needs
| Field | Meaning |
|---|---|
id | Numeric ID. Orders, positions and price ticks use this. |
symbol, desc | Name (e.g. EURUSD) and description. |
digits | Price decimals. Round every price you send to this. One point = 10^-digits. |
contract_size | Units per 1.0 lot (e.g. 100000 for FX). |
min_value, max_value | Smallest and largest order, in lots. |
step | Lot increment. Round volumes to it yourself — the server only checks min/max. |
stop_level | Minimum SL/TP distance in points. See SL/TP rules. |
trade_level | 0 full access, 1 buy only, 2 sell only, 3 close only, 4 disabled. |
orders | Comma-separated order kinds allowed: 0 market, 1 limit, 2 stop, 3 stop loss, 4 take profit, 5 close-by. |
expiration | Comma-separated expiration policies allowed for pending orders. |
status | 0 enabled, 1 disabled; higher values mean closed or expired. |
trade_sessions, quote_sessions | When the symbol trades and quotes. Orders outside trading hours are rejected with the market is closed for …. |
spread | Your group's spread setting. |
swaps_enabled, swap_long, swap_short, swap_type | Overnight financing. |
margin_initial, calculation | How margin is computed. |
last_bid, last_ask | The last price when you made the request — handy at startup, but use the WebSocket for live prices. |
A helper to prepare an order:
def round_price(price, digits):
return round(price, digits)
def round_volume(volume, sym):
steps = round(volume / sym["step"])
vol = round(steps * sym["step"], 8)
return min(max(vol, sym["min_value"]), sym["max_value"])
Historical candles
GET /api/v1/market/history returns OHLC bars for one symbol. Use it to warm up
indicators before you switch to live ticks.
| Parameter | Required | Notes |
|---|---|---|
symbol_id | yes | Symbol ID. |
resolution | yes | <n>m, <n>h, <n>d, <n>w or <n>mo — e.g. 1m, 5m, 15m, 1h, 4h, 1d, 1w, 1mo. |
from, to | yes | Unix time in seconds. |
count_back | yes | Maximum number of bars to return. Must be > 0 — with 0 you get an empty list. |
type | no | bid (default) or ask. |
NOW=$(date +%s)
curl "https://api.onlytradeplatform.com/api/v1/market/history?symbol_id=26100001&resolution=1m&from=$((NOW-86400))&to=$NOW&count_back=300" \
-H "Authorization: Bearer $TOKEN"
{
"success": true,
"code": 200,
"data": [
{ "time": 1781251140000, "open": 1.08210, "high": 1.08241, "low": 1.08205, "close": 1.08232, "volume": 184 },
{ "time": 1781251200000, "open": 1.08232, "high": 1.08250, "low": 1.08221, "close": 1.08238, "volume": 97 }
]
}
Bars are oldest first; time is the bar's open time in Unix milliseconds.
The last bar is usually still forming.
Live prices
Live prices come only from the WebSocket. After you connect, send once:
{ "type": "start_market_feed", "payload": {} }
and you receive a tick for every symbol as it changes. Ticks are compact binary frames containing a CSV line, not JSON:
26100001,1.08232,1.08244,1.08301,1.08012,1.08120,1.08232,0,1781251234567,1781251234570,1781251234571
| Column | Field |
|---|---|
| 0 | symbol_id |
| 1 | bid |
| 2 | ask |
| 3–6 | high, low, open, close as reported by the price provider |
| 7 | volume |
| 8 | ts — tick time, Unix ms |
| 9, 10 | internal latency stamps — ignore |
Prices already include your group's spread, so the ask is what you'd buy at
and the bid what you'd sell at. Filter by symbol_id for the symbols you
trade. See WebSocket → Subscribing.
There is no order book (depth) or live candle stream. Build bars from ticks yourself, as the bot example does.