Socketrade

Api2Trade compatible

Change two things. Keep every call.

This surface speaks the same language as an Api2Trade client. Point the client at https://api.socketrade.com instead of its old host, send your Socketrade key in theX-API-Key header, and the calls stay the same. Paths, query parameters and the order of the ConnectEx handshake do not change.

What changes

The base URL and the credential. Nothing else has to move: the calls below are the same calls, with the same names and the same query style.

hosthttps://api.socketrade.com
X-API-KeyYour key, starting a2t_. One key covers every account on your plan.
Basic authAlso accepted on this surface, with the same key as the password and any user name.

Values in the query string still need URL encoding. A password containing an @ or a : has to be encoded, or the call will be read as a shorter password than the one you meant.

The ConnectEx flow

Call ConnectEx once with the account number, the broker name and the trading password. Every call after that takes the account number as its id. Call Disconnect when you are finished with the account, so the session can be released.

curl "https://api.socketrade.com/ConnectEx?id=41299492&server=Deriv-Demo&user=41299492&password=$MT5_PASSWORD" \
  -H "X-API-Key: $SOCKETRADE_KEY"

Calls

Every call is a GET with its parameters in the query string, and every call needs your key.

CallParametersReturns
ConnectExid, server, user, passwordStarts a session for the account, so the calls below can use its id.
AccountSummaryidBalance, equity, margin, free margin and floating profit.
OpenedOrdersidOpen positions and working pending orders.
ClosedOrdersidTrades that have already closed.
SymbolListidEvery symbol the account can trade.
SymbolParamsid, symbolDigits, contract size, minimum and maximum volume, stops level.
GetQuoteid, symbolCurrent bid and ask for one symbol.
GetQuoteManyid, symbolsBid and ask for a comma separated list, in one call.
MarketWatchManyid, symbolsQuotes with the day range and change for a list of symbols.
PriceHistoryid, symbol, timeframe, from, toBars between two ISO datetimes.
OrderSendid, symbol, operation, volume, price, sl, tp, deviation, magicSends a market or pending order. Returns the ticket or the retcode.
OrderModifyid, ticket, and the values to changeChanges the stops or the price on a working order.
OrderCloseid, ticketCloses a position by ticket.
DisconnectidEnds the session started by ConnectEx.

Account reads

curl "https://api.socketrade.com/AccountSummary?id=41299492" -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/OpenedOrders?id=41299492"   -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/ClosedOrders?id=41299492"   -H "X-API-Key: $SOCKETRADE_KEY"

Symbols and quotes

Pass several symbols as one comma separated value in symbols to fill a watch list in a single call.

curl "https://api.socketrade.com/SymbolList?id=41299492" -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/SymbolParams?id=41299492&symbol=EURUSD" -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/GetQuote?id=41299492&symbol=EURUSD" -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/GetQuoteMany?id=41299492&symbols=EURUSD,GBPUSD,XAUUSD" -H "X-API-Key: $SOCKETRADE_KEY"
curl "https://api.socketrade.com/MarketWatchMany?id=41299492&symbols=EURUSD,GBPUSD,XAUUSD" -H "X-API-Key: $SOCKETRADE_KEY"

Price history

curl "https://api.socketrade.com/PriceHistory?id=41299492&symbol=EURUSD&timeframe=M15&from=2026-01-05T00:00:00Z&to=2026-01-06T00:00:00Z" \
  -H "X-API-Key: $SOCKETRADE_KEY"
Watch the dates

from and to are ISO datetimes, written with a date and a time, for example 2026-01-05T00:00:00Z. They are not unix epochs. Send the full datetime, and make sure to is later than from.

Trading

OrderSend takes the symbol, the operation, the volume and the optional price, stops, deviation and magic number. OrderModify and OrderClose identify the order by its ticket.

curl "https://api.socketrade.com/OrderSend?id=41299492&symbol=EURUSD&operation=buy&volume=0.01&price=0&sl=0&tp=0&deviation=10&magic=0" \
  -H "X-API-Key: $SOCKETRADE_KEY"

curl "https://api.socketrade.com/OrderModify?id=41299492&ticket=4789544305&sl=1.0800&tp=1.0950" \
  -H "X-API-Key: $SOCKETRADE_KEY"

curl "https://api.socketrade.com/OrderClose?id=41299492&ticket=4789544305" \
  -H "X-API-Key: $SOCKETRADE_KEY"

Disconnect

curl "https://api.socketrade.com/Disconnect?id=41299492" -H "X-API-Key: $SOCKETRADE_KEY"

Related