# WebSockets
{"action": "subscribe_accounts"}
Params
login: Admin
password: masterkey
Subscribes to account updates which happen every 5 seconds
{
"status": "Ok",
"message": "subscribe_accounts",
"data": null
}
After subscription, you will receive all the updates, each in a separate JSON message:
{
"status": "Ok",
"message": "Account",
"data": {
"ExternalAccountId": "",
"TraderID": 1123,
"Equity": 49612.39,
"Balance": 49916.56,
"Margin": 13.43,
"FreeMargin": 49598.96,
"UPL": -304.17,
"PureProfit": 0.0,
"PersonalAccountID": 1521,
"IsLocked": false,
"IsDisabled": false,
"IsReadonly": false,
"TradeGroupId": 132
}
}
{"action": "unsubscribe_accounts"}
Params
login: Admin
password: masterkey
Removes subscription from orders
{
"status": "Ok",
"message": "unsubscribe_accounts",
"data": null
}
{"action": "subscribe_accountChanges"}
Params
login: Admin
password: masterkey
Subscribes to account updates which happen every 5 seconds
{
"status": "Ok",
"message": "subscribe_accountChanges",
"data": null
}
After subscription, once account isLocked or Isinvestor or IsDisabled you will receive the following JSON message:
{
"status": "Ok",
"message": "AccountChanges",
"data": {
"ExternalAccountId": "",
"TraderID": 773,
"Equity": 99719.6400,
"Balance": 99719.0400,
"Margin": 22.68,
"FreeMargin": 99696.3600,
"UPL": 0.60,
"PureProfit": -280.9600,
"PersonalAccountID": 1161,
"IsLocked": false,
"IsDisabled": false,
"IsReadonly": false,
"TradeGroupId": 12
}
}
{"action": "unsubscribe_accountChanges"}
Params
login: Admin
password: masterkey
Removes subscription from orders
{
"status": "Ok",
"message": "unsubscribe_accountChanges",
"data": null
}
{"action": "subscribe_accountChangesAndEquity"}
Params
login: Admin
password: masterkey
Subscribe to receive accountChanges. Each 5 sec you will be reiceving message "AccountSnapshots" with actual equity change. And each time there would be any change to account you will recieve extra message "AccountChanges" with data
{
{
"status": "Ok",
"message": "AccountChanges",
"data": {
"ExternalAccountId": "",
"TraderID": 773,
"Equity": 99993.8500,
"Balance": 99994.1500,
"Margin": 23.4600,
"FreeMargin": 99970.3900,
"UPL": -0.30,
"PureProfit": -5.8300,
"PersonalAccountID": 1161,
"IsLocked": false,
"IsDisabled": false,
"IsReadonly": false,
"TradeGroupId": 12
}
}
{
{
"status": "Ok",
"message": "AccountSnapshots",
"data": {
"AccountSnapshots": [
{
"ExternalAccountId": "",
"TraderID": 773,
"Equity": 99993.85,
"Balance": 99994.15,
"Margin": 23.46,
"FreeMargin": 99970.39,
"UPL": -0.3,
"PureProfit": 0.0,
"PersonalAccountID": 1161,
"IsLocked": false,
"IsDisabled": false,
"IsReadonly": false,
"TradeGroupId": 12
}
]
}
}
{"action":"get_symbols"}
Returns all symbols which the client can subscribe to
{
"status": "Ok",
"message": "get_symbols",
"data": "[{\"SymbolId\":1,\"SymbolName\":\"USDCHF\",\"SymbolCategoryId\":1,\"SymbolCategory\":\"Forex\"},{\"SymbolId\":2,\"SymbolName\":\"GBPUSD\",\"SymbolCategoryId\":1,\"SymbolCategory\":\"Forex\"},...]"
}
{"action":"get_symbols_for_trade_group", "params":"default"}
params - name of the feedReturns all symbols which the client can subscribe to
{
"status":"Ok",
"Message":"get_symbols_for_trade_group",
"data":
"[{\"SymbolId\":1,\"SymbolName\":\"USDCHF\",\"SymbolCategoryId\":1,\"SymbolCategory\":\"Forex\"},{\"SymbolId\":2,\"SymbolName\":\"GBPUSD\",\"SymbolCategoryId\":1,\"SymbolCategory\":\"Forex\"},...]"
}
{"action":"subscribe","params":"USD/CAD,USD/JPY"}
params - specified symbols (id or name)Subscribes to the specified symbols
{
"status": "Ok",
"message": "subscribe",
"data": null
}
{"action":"unsubscribe"}
Unsubscribes from all the symbols the client was subscribed to
{
"status": "Ok",
"message": "unsubscribe",
"data": null
}
{"action": "subscribe_orders"}
Subscribes to one or more orders by ids, separated by commas
{
"status": "Ok",
"message": "subscribe_orders",
"data": null
}
After subscription, you will receive all the updates, each in a separate JSON message:
{
"status": "Ok",
"message": "Order",
"data": {
"OrderStates": [
{
"OrderID": "int",
"StateID": "int",
"TraderID": "int",
"SymbolID": "int",
"OrderTypeID": "int",
"Volume": "decimal",
"OpenPrice": "decimal",
"StopLoss": "decimal",
"TakeProfit": "decimal",
"TrailingStop": "int",
"CommandVolume": "decimal",
"CommandPrice": "decimal",
"CommandTime": "DateTime",
"CommandTypeID": "int",
"CommandOriginID": "int",
"CommandSenderID": "int",
"Margin": "decimal",
"CommandMargin": "decimal",
"Comment": "string",
"ExpirationDate": "DateTime",
"ClientOrderID": "string",
"DealID": "int",
"CommandVolumeUSD": "decimal",
"CommandVolumeAC": "decimal",
"VolumeUSD": "decimal",
"VolumeAC": "decimal",
"AccountingDocuments": [
{
"DocumentID": "int",
"IncomeItemID": "int",
"Amount": "decimal"
}
]
}
]
}
}
{"action": "subscribe_accounts"}
Subscribes to account updates which happen every 5 seconds
{
"status": "Ok",
"message": "subscribe_accounts",
"data": null
}
After subscription, you will receive all the updates, each in a separate JSON message:
{
"status": "Ok",
"message": "Account",
"data": [
{
"TraderId": "int",
"Balance": "decimal",
"Equity": "decimal",
"Margin": "decimal",
"FreeMargin": "decimal",
"UPL": "decimal",
"PureProfit": "decimal"
}
]
}
{"action": "unsubscribe_orders"}
Removes subscription from orders.
{
"status": "Ok",
"message": "unsubscribe_orders",
"data": null
}
{"action": "unsubscribe_accounts"}
Removes subscription from orders
{
"status": "Ok",
"message": "unsubscribe_accounts",
"data": null
}
If an error occurs, you’ll get a response of the following type (in this case the specified symbol doesn’t exist):
{
"status": "Error",
"message": "Error while subscribing: Symbol 'US/CAD' doesn't exist",
"data": null
}
After subscribing to any symbol(s) you’ll be receiving prices every 5 seconds.
First message:
{
"status": "Ok",
"message": "Prices",
"data": [
{
"Symbol": "USD/CAD",
"SymbolID": 1001,
"Bid": 1.38333,
"Ask": 1.38341,
"Spread": 0.00008,
"Timestamp": "2023-10-30T13:09:58.741Z"
}
]
}
Second message:
{
"status": "Ok",
"message": "Prices",
"data": [
{
"Symbol": "USD/CAD",
"SymbolID": 1001,
"Bid": 1.38331,
"Ask": 1.38339,
"Spread": 0.00008,
"Timestamp": "2023-10-30T13:10:57.577Z"
}
]
}