WebSocket Introduction

In the example described in this documentation, we use NodeJs and the library ws.

GitHub – WebSocket Example

You can download the example directly from th GitHub repository:

Connecting Websocket

NodeJs Use.:

//Instantiate Websocket module
const WebSocket = require('ws');

//WebSocketAPI Address
var wsAddress = 'wss://api.foxbitapi.com.br/WSGateway/';

//Setup WebSocket client Address
var ws = new WebSocket(wsAddress);

Message Frame

Object on JSON-formatted format used as frame to send and receive data.:

//Message Frame
var messageFrame = {

    "m":0,          //MessageType ( 0_Request / 1_Reply / 2_Subscribe / 3_Event / 4_Unsubscribe / Error )
    "i":0,          //Sequence Number
    "n":"",         //Endpoint
    "o":""          //Payload

};
Fields
String Value
“m” message type integer (0 request / 1 reply / 2 subscribe to event / 3 event / 4 unsubscribe from event / 5 error)
“i” sequence number long integer
“n” function name integer
“o” payload string

Payload

Object in JSON-formatted format which contains mandatory (and diferente) fields for the sending of data the driven endpoint .

Each endpoint has a specific pack. Please check the playload format in the documentation.

//Playload construction example to the endpoint *WebAuthenticateUser*
var payload = {

    "UserName": "[email protected]",
    "Password": "jsPassword"

};

Events

Define the Open event to trat the connection return.:

//Event Open Connection
ws.on('open', function open() {

    console.log('Conected');

});

Define event to receive a message from socket.:

//Event Receiving Message
ws.on('message', function incoming(data) {

    //data contains answer playload
    console.log(data);

});

Define event to error treating.:

//Event Error Message
ws.on('error', function() {

    console.log('Error');

});

Define event to treat connection finalization.:

//Event Close Message
ws.on('close', function() {

    console.log('Connection Closed');

});

Data sending

To send data to the server, you must use the “messageFrame” object described above, use the “n” field to inform the Endpoint to operate, and the “o” field to send the playload.

//Indicate which endpoint it’ll be sent to.
messageFrame.n = "WebAuthenticateUser"

//Add the playload regarding the indicated endpoint
messageFrame.o = JSON.stringify(payload);

ws.send(JSON.stringify(messageFrame), function ack(error) {

    //Se encontrar erros, dispara
    console.log(error);

});

Data sent. In case they don’t return, error ends the message on the message event.


Authentication

**Endpoints to user authentication in the websocket are below **

WebAuthenticateUser

WebAuthenticateUser authenticates a user in the running WebSession.

You need to call it to use the methods that require an active SessionToken.

When performing the authentication, a SessionToken is informed. Save it in a variable.

Request:

{
    "UserName": "UserName",
    "Password": "Password"
}

>>> Note:: UserName is the user name.

Authentication did not succeed:

{
    "Authenticated": false
}

Answer when the user has already logged in:

{
    "Authenticated": true,
    "SessionToken":"7d0ccf3a-ae63-44f5-a409-2301d80228bc",
    "UserId": 1
}

>>> Note: You must save the SessionToken in a variable.

Answer when delivering na active SessionToken

String Value
Authenticated Boolean.
SessionToken string.
UserId integer.


AuthenticateUser

AuthenticateUser athenticate user WebSession current using APIKEY

You must call AuthenticateUser for those call that need athentication

Request:

{
    "APIKey": "APIKey",
    "Signature": "Signature"
    "UserId": "UserId",
    "Nonce": "Nonce"
}

>>> Nota 1:  Nonce = Date.now();
>>> Nota 2: Signature = crypto.HmacSHA256(nonce + userId + APIKey, APISecret).toString(crypto.enc.Hex);

No succeed auth:

{
    "Authenticated": false
}

Authenticate2FA

Once the second part of the two fator authentication is completed, the steps of the 2FA are below.

Request:

{
    "Code": "YourCode"
}
String Value
Code string. Enter 2FA code

Response:

{
    "Authenticated": true,
    "SessionToken": "YourSessionToken"
}

The SessionToken is valid during the running session for the same IP (IPAddress).

The session lasts up to 1 hou after the last activity or until the endpoint LogOut has been executed.

If the connection is interrupted you can reactivate ir using the SessionToken and calling again the Endpoint Authenticate2FA. No need to login again or to inform the 2FA Key.

{
    "SessionToken": "YourSessionToken"
}
String Value
Authenticated Boolean. Successful Authentication returns True. Unsuccessful returns*False*
SessionToken string. SessionToken is valid for current section for connections with the same IP adress. If the communication is interrupted you ca inform returning the SessionToken instead of repeating the full 2FA process.

One section lasts up to 1 hour of inactivity, or until the LogOut is executed.


To send the SessionToken t restablish the connection, send:

{
    "SessionToken": "YourSessionToken"
}


Websocket Example Complete

Below you can see a full example of the application on Nodejs consuming Foxbit Websocket.

Note: You can pass userName & userPass as parameter like:

node index.js username:password
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
 //Instantiate Websocket module
 const WebSocket = require('ws');

 //WebSocketAPI Address
 var wsAddress = 'wss://api.foxbitapi.com.br/WSGateway/';

 //Setup WebSocket client Address
 var ws;

 const tool = require('./tools.js');

 //Flag Authenticated
 var authenticated = false;

 //User & Password
 var userName = "";
 var userPass = "";
 var userId = "0";
 var sessionToken = "";
 var twoFA = "0000";

 //Wait PromptInformation
 var stdin2FA = process.openStdin();
 var stdin = process.openStdin();

 //side variable = Buy/Sell
 var side = 1;

 var flagSpecial = false;

 //Message Frame
 var messageFrame = {

     "m":0,          //MessageType ( 0_Request / 1_Reply / 2_Subscribe / 3_Event / 4_Unsubscribe / Error )
     "i":0,          //Sequence Number
     "n":"",         //Function Name
     "o":""          //Payload

 };

 Startup();

 function handleStartupArg(){

     process.argv.forEach(function (val, index, array) {

         if (val != undefined){

             if (index == 2){

                 var splited = val.split(':');
                 userName = splited[0];
                 userPass = splited[1];

             }

         }

     });

 }

 function Startup(){

     handleStartupArg();

     if (flagSpecial == false && userName == ""){

         tool.SetflagTyping(false);
         GetPrompt(1);
         tool.SetflagTyping(false);
         GetPrompt(2);

     }else{
         tool.SetflagTyping(true);
     }

     if (tool.GetflagTyping() == true){
         ws = new WebSocket(wsAddress);
         tool.SetflagTyping(false);
     }

 }

 //WebSocket Event Area
 //Event Open Connection
 ws.on('open', function open() {

     console.log("\r\n************************** OPEN CONECTION **************************");
     //Start first command
     WebAuthenticateUser(messageFrame);


 });

 //Event Receiving Message
 ws.on('message', function incoming(data) {

     dealMessage(messageFrame, data);

 });

 //Event Error Message
 ws.on('error', function(error) {

     consoleMessage('WebService','error! ' + error);

 });

 //Event Close Message
 ws.on('close', function() {

     consoleMessage('WebService','close! ');

     WebAuthenticateUser(messageFrame);

 });

 function sendWs(endpoint){


     ws.send(JSON.stringify(frame), function ack(error) {

         if (error != undefined){

             consoleMessage(endpoint, JSON.stringify(error));

         }

     });

 }

 //Function DealMessage
 function dealMessage(frame, message){

     var ret = JSON.parse(message);

     switch(ret.n){
         case "WebAuthenticateUser":

             console.log('Receiving <- (' + ret.n + ")\r\n", JSON.parse(ret.o));

             if (authenticated == false){

                 var gotO = JSON.parse(ret.o);

                 if (gotO.errormsg != undefined){

                     GetPrompt(1);

                     GetPrompt(2);

                     WebAuthenticateUser(frame);

                 }else{

                     Authenticate2FA(frame);

                 }

             }

             break;
         case "GetUserInfo":

             consoleMessage('<-' + ret.n, JSON.stringify(ret));

             break;
         case "SendOrder":

             consoleMessage('<-' + ret.n, JSON.stringify(ret));

             break;
         case "Authenticate2FA":

             authenticated = JSON.parse(ret.o).Authenticated;

             console.log('Receiving <-(' + ret.n + ")\r\n", JSON.parse(ret.o));

             var paramO;

             if (authenticated == true){

                 paramO = JSON.parse(ret.o);

                 sessionToken = JSON.stringify(paramO.SessionToken);

                 userId = JSON.stringify(paramO.UserId);

                 console.log("\r\nAccess granted for " + userName + "\r\n");

             }

             break;
         case "GetUserPermissions":

             console.log('\r\nReceiving <-(' + ret.n + ")\r\n", JSON.stringify(ret));

             break;
         default:

             console.log('\r\nReceiving <-(' + ret.n + ")\r\n", JSON.parse(ret.o));
             break;
     }

 }

 //Function WebAuthenticateUser
 function WebAuthenticateUser(frame){

     console.log("\r\n*** User authentication ***");

     frame.n = "WebAuthenticateUser";

     var requestPayload = {"UserName": userName, "Password": userPass};

     frame.o = JSON.stringify(requestPayload);

     console.log("\r\nSending   -> (" + frame.n + ") user: " +  JSON.stringify(requestPayload.UserName));

     sendWs(frame.n);

 }

 //Function Authenticate2FA
 function Authenticate2FA(frame){

     frame.n = "Authenticate2FA";

     if (sessionToken == ""){

         GetPrompt(3);

         tool.SetflagTyping(false);

         if (twoFA != "0000"){

             var requestPayload = { "Code": twoFA };

             frame.o = JSON.stringify(requestPayload);

             console.log("\r\nSending   ->(" + frame.n + ")", JSON.parse(frame.o));

             sendWs(frame.n);

         }

     }else{

         consoleMessage('Already logged! SessionToken + UserId', sessionToken + ' + ' + userId);

         frame.n = "WebAuthenticateUser";

         var requestPayload = { "UserId": userId , "SessionToken": JSON.parse(sessionToken) };

         frame.o = JSON.stringify(requestPayload);

         consoleMessage(frame.n, JSON.stringify(frame));

         sendWs(frame.n);

         GetUserInfo(frame);

     }



 }

 //Function SendOrder
 function SendOrder(frame, ammount){

     frame.n = "SendOrder";

     var requestPayload = {

             "AccountId": AccountId,
             "ClientOrderId": 0,
             "Quantity": ammount,
             "DisplayQuantity": 0,
             "UseDisplayQuantity": true,
             "LimitPrice": 0,
             "OrderIdOCO": 0,
             "OrderType": 1,     //ORDEM A MERCADO = 1
             "PegPriceType": 1,
             "InstrumentId": 1,
             "TrailingAmount": 1.0,
             "LimitOffset": 2.0,
             "Side": side,
             "StopPrice": 0,
             "TimeInForce": 1,
             "OMSId": 1,

     };

     frame.o = JSON.stringify(requestPayload);

     if (side == 0){

         side = 1;

     }else{

         side = 0;

     }

     console.log('\r\n-> ' + JSON.stringify(frame));

     sendWs(frame.n);

 }

 function GetOpenOrders(){

     frame.n = "GetOpenorders";

     var requestPayload = {

             "AccountId": AccountId,
             "OMSId": 1,

     }

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }


 function GetOrderStatus(){

     frame.n = "GetOrderStatus";

     var requestPayload = {

             "AccountId": AccountId,
             "OMSId": 1,
                 "OrderId": OrderId,

     }

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }

 function GetOrderHistory(){

     var requestPayload = {

             "OMSId": 1,
             "AccountId": AccountId,

     }

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }



 function CancelOrder(frame, OrderId){

     frame.n = "CancelOrder";

     var requestPayload = {
         "OMSId": 1,
         "AccountId":AccountId
     };

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }

 function GetUserPermissions(frame){

     frame.n = "GetUserPermissions";

     var requestPayload = {
         UserId: userId
     };

     frame.o = JSON.stringify(requestPayload);

     console.log("Sending   ->(GetUserPermissions) " + JSON.stringify(frame));

     sendWs(frame.n);

 }

 function GetOrderHistory(frame){

     frame.n = "GetOrderHistory";

     var requestPayload = {
         "OMSId": 1,
         "AccountId":AccountId
     };

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }

 function GetOpenOrders(frame){

     frame.n = "GetOpenOrders";

     var requestPayload = {
         "AccountId": AccountId,
         "OMSId": 1
     };

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }

 function GetUserInfo(frame){

     frame.n = "GetUserInfo";

     var requestPayload = {
     };

     frame.o = JSON.stringify(requestPayload);

     sendWs(frame.n);

 }

 function GetUserConfig(frame){

     frame.n = "GetUserConfig";

     var requestPayload = {

     };

     frame.o = JSON.stringify(requestPayload2);

     sendWs(frame.n);

 }

 function GetPrompt(index){
     var ret = tool.AskPrompt(index);

     if (ret != undefined){
         if (ret.userName != undefined) { userName = ret.userName; }
         if (ret.userPass != undefined) { userPass = ret.userPass; }
         if (ret.flagSpecial != undefined) { flagSpecial = ret.flagSpecial; }
         if (ret.twoFA != undefined) { twoFA = ret.twoFA; }
     }else{
     }
 }

 //Function Console
 function consoleMessage(prefix, sulfix){

     console.log('\r\n' + prefix + ': (' +sulfix + ')');

 }

Public Endpoint

Public Endpoints públicos can be accessed without authentication.

LogOut

Ends current connection.

Request:

{ }

>> It is not necessaryto send any data.

Response:

{
    "result":true,
    "errormsg":null,
    "errorcode":0,
    "detail":null
}


ResetPassword

ResetPassword is a to step process. First call ResetPassword the username. After concluded, an e-mail will be sent to your account with a link asking you to reset the password.

Request:

{
    "UserName": "[email protected]",
}
String Value
UserName string

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string

GetInstrument

Returns detailed pair. Ex. BTC/BRL

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}

Response:

{
    "OMSId": 0,
    "InstrumentId": 0,
    "Symbol": "",
    "Product1": 0,
    "Product1Symbol": "",
    "Product2": 0,
    "Product2Symbol": "",
    "InstrumentType": {
            "Options":      [
                "Unknown",
                "Standard"
            ]},
    "VenueInstrumentId": 0,
    "VenueId": 0,
    "SortIndex": 0,
    "SessionStatus": {
            "Options":      [
                "Unknown",
                "Running",
                "Paused",
                "Stopped",
                "Starting"
            ]},
    "PreviousSessionStatus": {
            "Options":      [
                "Unknown",
                "Running",
                "Paused",
                "Stopped",
                "Starting"
            ]},
    "SessionStatusDateTime": "0001-01-01T05:00:00Z",
    "SelfTradePrevention": false,
    "QuantityIncrement": 0,
}

[Response]: Case request login is already logged

String Value
OMSId integer
InstrumentId long integer.
Symbol string Símbolo Ex. BTCBRL.
Product1 integer
Product1Symbol string
Product2 integer.
Product2Symbol string.
InstrumentType string.
VenueInstrumentId string
VenueId string
SortIndex string
SessionStatus string
PreviousSessionStatus string
SessionStatusDateTime string
SelfTradePrevention string
QuantityIncrement string


GetInstruments

Returns detailed pair array. Ex. BTC/BRL

Request:

{
    "OMSId": 1
}
String Value
OMSId integer. The ID of the Order Management System on which the instruments are available.

Response:

[
    {
        {
            "OMSId": 0,
            "InstrumentId": 0,
            "Symbol": "",
            "Product1": 0,
            "Product1Symbol": "",
            "Product2": 0,
            "Product2Symbol": "",
            "InstrumentType": {
                "Options":       [
                    "Unknown",
                    "Standard"
                ]
        },
        "VenueInstrumentId": 0,
        "VenueId": 0,
        "SortIndex": 0,
        "SessionStatus": {
                    "Options":   [
                        "Unknown",
                        "Running",
                        "Paused",
                        "Stopped",
                        "Starting"
                    ]
        },
        "PreviousSessionStatus": {
            "Options":   [
                "Unknown",
                "Running",
                "Paused",
                "Stopped",
                "Starting"
            ]},
        "SessionStatusDateTime": "0001-01-01T05:00:00Z",
        "SelfTradePrevention": false,
        "QuantityIncrement": 0,
        },
    }
]
String Value
OMSId integer
InstrumentId long integer.
Symbol string Símbolo Ex. BTCBRL.
Product1 integer
Product1Symbol string
Product2 integer.
Product2Symbol string.
InstrumentType string.
VenueInstrumentId string
VenueId string
SortIndex string
SessionStatus string
PreviousSessionStatus string
SessionStatusDateTime string
SelfTradePrevention string
QuantityIncrement string


GetProduct

Returns details about the requested pair.

Request:

{
    "OMSId": 1,
    "ProductId": 1
}
String Value
OMSId integer
ProductId long integer

Response:

{
    "OMSId": 0,
    "ProductId": 0,
    "Product": "",
    "ProductFullName": "",
    "ProductType": {
            "Options":      [
                "Unknown",
                "NationalCurrency",
                "CryptoCurrency",
                "Contract"
            ]
    },
    "DecimalPlaces": 0,
    "TickSize": 0,
    "NoFees": false,
}
String Value
OMSId integer The ID of the Order Management System that offers the product.
ProductId long integer The ID of the product.
Product string “Nickname” or shortened name of the product. For example, NZD (New Zealand Dollar).
ProductFullName string Full and official name of the product. For example, New Zealand Dollar.
ProductType string The nature of the product. One of:
0 Unknown (an error condition)
1 NationalCurrency
2 CryptoCurrency
3 Contract
DecimalPlaces integer The number of decimal places in which the product is divided. For example, US Dollars are divided into 100 units, or 2 decimal places. Other products may be different. Burundi Francs use 0 decimal places and the Rial Omani uses 3.
TickSize integer Minimum tradable quantity of the product. See also GetInstrument, where this value is called QuantityIncrement. For example, with a US Dollar, the minimal tradable quantity is $0.01.
NoFees Boolean Shows whether trading the product incurs fees. The default is false; that is, if NoFees is false, fees will be incurred. If NoFees is true, no fees are incurred.

GetProducts

Returns detailed array about the requested pair.

Request:

{
    "OMSId": 1
}
String Value
OMSId integer

Response:

{
    "OMSId": 0,
    "ProductId": 0,
    "Product": "",
    "ProductFullName": "",
    "ProductType": {
            "Options":      [
                "Unknown",
                "NationalCurrency",
                "CryptoCurrency",
                "Contract"
            ]
    },
    "DecimalPlaces": 0,
    "TickSize": 0,
    "NoFees": false,
}
String Value
OMSId integer The ID of the Order Management System that offers the product.
ProductId long integer The ID of the product.
Product string “Nickname” or shortened name of the product. For example, NZD (New Zealand Dollar).
ProductFullName string Full and official name of the product. For example, New Zealand Dollar.
ProductType string The nature of the product. One of:
0 Unknown (an error condition)
1 NationalCurrency
2 CryptoCurrency
3 Contract
DecimalPlaces integer The number of decimal places in which the product is divided. For example, US Dollars are divided into 100 units, or 2 decimal places. Other products may be different. Burundi Francs use 0 decimal places and the Rial Omani uses 3.
TickSize integer Minimum tradable quantity of the product. See also GetInstrument, where this value is called QuantityIncrement. For example, with a US Dollar, the minimal tradable quantity is $0.01.
NoFees Boolean Shows whether trading the product incurs fees. The default is false; that is, if NoFees is false, fees will be incurred. If NoFees is true, no fees are incurred.

GetL2Snapshot

Returns level2 book’s snapshot from na specific instrument. (array)

Request:

{
    "OMSId": 1,
    "InstrumentId": 1,
    "Depth": 100
}
String Value
OMSId integer
InstrumentId integer
Depth integer Default 100

Response:

[
    {
        "MDUpdateID": 0,
        "Accounts": 0,
        "ActionDateTime": 635872032000000000,
        "ActionType": 0,
        "LastTradePrice": 0,
        "Orders": 0,
        "Price": 0,
        "ProductPairCode": 0,
        "Quantity": 0,
        "Side": 0,
    }
]
String Value
MDUpdateID integer
Accounts integer
ActionDateTime string
ActionType string
LastTradePrice decimal
Orders integer
Price decimal
ProductPairCode integer
Quantity decimal
Side integer 0 Buy | 1 Sell | 2 Short | 3 Unknown

GetTickerHistory

Returns Ticker hystory from the specific instrument:

Request:

{
    "InstrumentId": 1,
    "FromDate": // POSIX-format date and time
}
String Value
InstrumentId integer
FromDate long integer

Response:

>>> Returns the following array

[
    1501604532000,  // UTC Date/Time
    2792.73,        // High
    2667.95,        // Low
    2687.01,        // Open
    2700.81,        // Close
    242.61340767,   // Volume
    0,              // Bid price
    2871,           // Ask price
    0               // InstrumentId
]

SubscribeLevel1

Returns level1 Ticker of an specific instrument. (array)

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}

ou

{
    "OMSId": 1,
    "Symbol": "BTCUSD"
}
String Value
OMSId integer
InstrumentId integer
Symbol string

Response:

{
    "OMSId": 1,
    "InstrumentId": 1,
    "BestBid": 0.00,
    "BestOffer": 0.00,
    "LastTradedPx": 0.00,
    "LastTradedQty": 0.00,
    "LastTradeTime": 635872032000000000,
    "SessionOpen": 0.00,
    "SessionHigh": 0.00,
    "SessionLow": 0.00,
    "SessionClose": 0.00,
    "Volume": 0.00,
    "CurrentDayVolume": 0.00,
    "CurrentDayNumTrades": 0,
    "CurrentDayPxChange": 0.0,
    "Rolling24HrVolume": 0.0,
    "Rolling24NumTrades": 0.0,
    "Rolling24HrPxChange": 0.0,
    "TimeStamp": 635872032000000000,
}
String Value
OMSId integer
InstrumentId integer
BestBid decimal
BestOffer decimal
LastTradedPx decimal
LastTradedQty decimal
LastTradeTime long integer
SessionOpen decimal
SessionHigh decimal
SessionLow decimal
SessionClose decimal
Volume decimal
CurrentDayVolume decimal
CurrentDayNumTrades integer
CurrentDayPxChange decimal
Rolling24HrVolume decimal
Rolling24HrNumTrades integer
Rolling24HrPxChange decimal
TimeStamp long integer

SubscribeLevel2

Returns level1 Ticker of an specific instrument. (array)

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
    "Depth": 10
}

or

{
    "OMSId": 1,
    "Symbol": "BTCUSD"
    "Depth": 10
}
String Value
OMSId integer
InstrumentId integer
Symbol string
Depth integer

Response:

{
    "MDUpdateID": 0,
    "Accounts": 0,
    "ActionDateTime": 635872032000000000,
    "ActionType": 0,
    "LastTradePrice": 0,
    "Orders": 0,
    "Price": 0,
    "ProductPairCode": 0,
    "Quantity": 0,
    "Side": 0,
}
String Value
MDUpdateID integer
Accounts integer
ActionDateTime string
ActionType string
LastTradePrice decimal
Orders integer
Price decimal
ProductPairCode integer
Quantity decimal
Side integer 0 Buy | 1 Sell | 2 Short | 3 Unknown

SubscribeTicker

Signs the Ticker event with a periodic return.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1,
    "Interval": 60,
    "IncludeLastCount": 100
}
String Value
OMSId integer
InstrumentId long integer
Interval integer Default 60
IncludeLastCount integer Default 100

Response:

[
    {
        "EndDateTime": 0, // POSIX format
        "HighPX": 0,
        "LowPX": 0,
        "OpenPX": 0,
        "ClosePX": 0,
        "Volume": 0,
        "Bid": 0,
        "Ask": 0,
        "InstrumentId": 1,
        "BeginDateTime": 0 // POSIX format
    }
]

SubscribeTrades

Subscribes an authenticated user to the Trades Market Data Feed for a specific instrument. Each trade has two sides: Buy and Sell. SubscribeTrades returns the response documented here for your immediate information, then periodically sends the OrderTradeEvent documented in SubscribeAccountEvents.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1,
    "IncludeLastCount": 100
}
String Value
OMSId integer
InstrumentId long integer
IncludeLastCount integer Default 100

Response:

[
    {
        {
            "OMSId": 0,
            "TradeID": 0,
            "ProductPairCode": 0,
            "Quantity": 0,
            "Price": 0,
            "Order1": 0,
            "Order2": 0,
            "TradeTime": "0001-01-01T05:00:00Z",
            "Direction": {
                "Options":   [
                    "NoChange",
                    "UpTick",
                    "DownTick"
                ]
            },
            "TakerSide": 0,
            "Side1AccountId": 0,
            "Side2AccountId": 0,
            "Order1Side": {
                "Options":   [
                    "Buy",
                    "Sell",
                    "Short",
                    "Unknown"
                ]
            },
            "Order2Side": {
                "Options":   [
                    Buy",
                    "Sell",
                    "Short",
                    "Unknown"
                ]
            },
            "BlockTrade": false,
            "Order1ClientId": 0,
            "Order2ClientId": 0,
        },
    }
]

UnsubscribeLevel1

Revokes Market data feed Level1 event’s signature.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}
String Value
OMSId integer
InstrumentId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string

UnsubscribeLevel2

Revokes Market data feed Level2 event’s signature.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}
String Value
OMSId integer
InstrumentId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string

UnsubscribeTicker

Revokes Ticker event’s signature.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}
String Value
OMSId integer
InstrumentId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string

UnsubscribeTrades

Revokes Trades Mareket Data Feed event’s signature.

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}
String Value
OMSId integer
InstrumentId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string

Authenticated Endpoint

Here are the Endpoints that need previous authentication.

GetAvailablePermissionList

Returns an array with permissions that can be assigned to the requesting user.

Request:

{ }

Response:

[
    "AccountReadOnly",
    "AddAccount",
    "AddBalanceReconciliationInfo",
    "AddDepositTicketAttachment",
    "AddEditAccountBadge",
    "AddEditExchange",
    "AddEditExchangeInstrument",
    "AddEditOMS",
    "AddEditOperatorEmail",
    "AddInstrument",
    "AddOperator",
    "AddOperatorOms",
    ...
]


GetUserConfig

Returns settings defined by user.

Request:

{
    "UserId": 1,
    "UserName": "jsmith",
}
String Value
UserId integer
UserName string

Response:

[
    "Street": "Hillside Road",
    "Office Number": 158,
    "Mobile Phone": "1-702-555-1212",
    "City": "Las Vegas",
]


GetUserInfo

Returns basic informations abour requesting user.

Request:

{ }

Response:

{
    "UserId": 1,
    "UserName": "John Smith",
    "Email": "[email protected]",
    "PasswordHash": "",
    "PendingEmailCode": "",
    "EmailVerified": true,
    "AccountId": 1,
    "DateTimeCreated":"2017-10-26T17:25:58Z",
    "AffiliateId": 1,
    "RefererId": 1,
    "OMSId": 1,
    "Use2FA": false,
    "Salt": "",
    "PendingCodeTime": "0001-01-01T00:00:00Z",
}
String Value
UserId integer
UserName string
Email string
PasswordHash string
PendingEmailCode string
EmailVerified Boolean
AccountId integer
DateTimeCreated long integer
AffiliateId integer
RefererId integer
OMSId integer
Use2FA Boolean
Salt string
PendingCodeTime long integer


GetUserPermissions

Returns specific permissiont to the requesting user.

Request:

{
    "UserId": 1,
}
String Value
UserId integer

Response:

[
    "Withdraw",
    "Deposit",
    "Trading"
]


RemoveUserConfig

Removes user settings through Key

Request:

{
    "UserId": 1,
    "UserName": "jsmith",
    "Key": "Street Name",
}
String Value
UserId integer
UserName string
Key string

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string


SetUserConfig

Defines an arbitrary array on the Config field with key/value pair.

Request:

{
    "UserId": 1,
    "UserName": "jsmith",
        "Config": [
            "Key": "Street Name",
            "Value": "Hillside Road",
            "Key": "Suite Number",
            "Value": 158,
            …
        ]
}
String Value
UserId integer
UserName string
Config array Par key/value

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string


SetUserInfo

Inserts basic user informations.

Request:

{
    "UserId": 1,
    "UserName": "John Smith",
    "Password": "password",
    "Email": "[email protected]",
    "EmailVerified": true,
    "AccountId": 1,
    "Use2FA": false,
}
String Value
UserId integer
UserName string
Password array Par key/value
Email integer
EmailVerified string
AccountId array Par key/value
Use2FA array Par key/value

Response:

{
    "UserId": 1,
    "UserName": "John Smith",
    "Email": "[email protected]",
    "PasswordHash": "",
    "PendingEmailCode": "",
    "EmailVerified": true,
    "AccountId": 1,
    "DateTimeCreated":"2017-10-26T17:25:58Z",
    "AffiliateId": 1,
    "RefererId": 1,
    "OMSId": 1,
    "Use2FA": false,
    "Salt": "",
    "PendingCodeTime": "0001-01-01T00:00:00Z",
}
String Value
UserId Boolean
UserName string
Email integer
PasswordHash string
PendingEmailCode Boolean
EmailVerified string
AccountId integer
DateTimeCreated string
AffiliateId Boolean
RefererId string
OMSId integer
Use2FA string
Salt integer
PendingCodeTime string


CancelAllOrders

Cancels all open orders to the specified instrument.

Request:

{
    "AccountId": 0, // conditionally optional
    "UserId": 0, // conditionally optional
    "OMSId": 0
    "InstrumentId": 0, // conditionally optional
}
String Value
AccountId integer
UserId integer
OMSId integer
InstrumentId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string


CancelOrder

Cancels an specific order that hasn’t been executed yet.

Request:

{
    "OMSId": 0,
    "AccountId": 0 // conditionally optional
    "ClientOrderId": 0 // conditionally optional
    "OrderId": 0, // conditionally optional
}
String Value
OMSId integer
AccountId integer
ClientOrderId integer
OrderId long integer

Response:

{
    "result": true,
    "errormsg": null,
    "errorcode":0,
    "detail": null
}
String Value
result Boolean
errormsg string
errorcode integer
detail string


CancelQuote

Cancels an specific order that hasn’t been executed yet.

Request:

{
    "OMSId": 0,
    "AccountId": 0, // conditionally optional
    "InstrumentId": 0, // conditionally optional
    "BidQuoteId": 0, // required
    "AskQuoteId": 0, // required
}
String Value
OMSId integer
AccountId integer
InstrumentId long integer
BidQuoteId integer
AskQuoteId integer

Response:

{
    "bidresult": "{
        "result": true,
        "errormsg": "",
        "errorcode": 0,
        "detail": "",
    }",
    askresult": "{
        "result": true,
        "errormsg": "",
        "errorcode": 0,
        "detail": "",
    }"
}
String Value
bidresult object
-result Boolean
-errormsg string
-errorcode integer
-detail string
askresult object
-result Boolean
-errormsg string
-errorcode integer
-detail string


CancelReplaceOrder

Unique call that cancels a non-executed order and includes a new instead.

Request:

{
    "OMSId": 0,
    "OrderIdToReplace": 0,
    "ClientOrdId": 0,
    "OrderType": {
            "Options": [
                "Unknown",
                "Market",
                "Limit",
                "StopMarket",
                "StopLimit",
                "TrailingStopMarket",
                "TrailingStopLimit",
                "BlockTrade"
            ]
    },
    "Side": {
            "Options":      [
                "Buy",
                "Sell",
                "Short",
                "Unknown",
            ]
    },
    "AccountId": 0,
    "InstrumentId": 0,
    "TrailingAmount": 0,
    "LimitOffset": 0,
    "DisplayQuantity": 0,
    "LimitPrice": 0,
    "StopPrice": 0, // conditionally optional
    "PegPriceType": {
            "Options":      [
                "Unknown",
                "Last",
                "Bid",
                "Ask",
                "Midpoint"
            ]
    },
    "TimeInForce": {
            "Options":      [
                "Unknown",
                "GTC",
                "IOC",
                "FOK",
            ]
    },
    "OrderIdOCO": 0,
    "Quantity": 0,
}
String Value
OMSId integer
OrderIdToReplace long integer
ClientOrdId long integer
OrderType string
Side string
AccountId integer
InstrumentId integer
TrailingAmount decimal
LimitPrice decimal
StopPrice decimal
PegPriceType string
TimeInForce string
OrderIdOCO integer
Quantity decimal

Response:

{
    "ReplacementOrderId": 1234,
    "ReplacementClOrdId": 1561,
    "OrigOrderId": 5678,
    "OrigClOrdId": 91011,
}


CreateQuote

Returns information about logged in user’s account.

Request:

{
    "OMSId": 1,
    "AccountId": 0,
    "InstrumentId": 0,
    "Bid": 0,
    "BidQty": 0,
    "Ask": 0,
    "AskQty": 0,
}
String Value
OMSId integer
AccountId integer
InstrumentId long integer
Bid decimal
BidQty decimal
Ask decimal
AskQty decimal

Response:

{
    "BidQuoteId": 0,
    "BidResult": "{
        "result": true,
        "errormsg": "",
        "errorcode": 0,
        "detail": "",
    }",
    "AskQuoteId": 0,
    "AskResult": "{
        "result": true,
        "errormsg": "",
        "errorcode": 0,
        "detail": "",
    }"
}
String Value
BidQuoteId integer
BidResult string
AskQuoteId integer
AskResult string
result Boolean
errormsg string
errorcode integer
detail string


GetAccountInfo

Returns information about logged in user’s account.

Request:

{
    "OMSId": 0,
    "AccountId": 0,
    "AccountHandle": "",
}
String Value
OMSId integer
AccountId integer
AccountHandle string

Response:

{
    "OMSID": 0,
    "AccountId": 0,
    "AccountName": "",
    "AccountHandle": "",
    "FirmId": "",
    "FirmName": "",
    "AccountType": {
        "Options": [
            "Asset",
            "Liability",
            "ProfitLoss"
        ]
    },
    "FeeGroupID": 0,
    "ParentID": 0,
    "RiskType": {
        "Options": [
            "Unknown",
            "Normal",
            "NoRiskCheck",
            "NoTrading"
        ]
    },
    "VerificationLevel": 0,
    "FeeProductType": {
        "Options": [
            "BaseProduct",
            "SingleProduct"
        ]
    },
    "FeeProduct": 0,
    "RefererId": 0,
        "SupportedVenueIds": [
            0
        ],
    }
}
String Value
OMSId integer
AccountId integer
AccountName string
AccountHandle string
FirmId string
FirmName string
AccountType string
FeeGroupID integer
ParentID integer
RiskType string
VerificationLevel integer
FeeProductType string
FeeProduct integer
RefererId integer
SupportedVenueIds integer


GetAccountPositions

Returns and array with user’s historical balance.

Request:

{
    "AccountId": 0,
    "OMSId": 0,
}
String Value
AccountId integer
OMSId integer

Response:

[
    {       // first position
        "OMSId":1,
        "AccountId":4,
        "ProductSymbol":"BTC"
        "ProductId":1
        "Amount":0,
        "Hold":0,
        "PendingDeposits":0,
        "PendingWithdraws":0,
        "TotalDayDeposits":0,
        "TotalDayWithdraws":0,
        "TotalMonthWithdraws":0
    }, { //second position
        "OMSId":1,
        "AccountId":4,
        "ProductSymbol":"USD",
        "ProductId":2,
        "Amount":0,
        "Hold":0,
        "PendingDeposits":0,
        "PendingWithdraws":0,
        "TotalDayDeposits":0,
        "TotalDayWithdraws":0,
        "TotalMonthWithdraws":0
    }
]
String Value
OMSId integer
AccountId integer
ProductSymbol string
ProductId integer
Amount decimal
Hold decimal
PendingDeposits decimal
PendingWithdraws decimal
TotalDayDeposits decimal
TotalDayWithdraws decimal
TotalMonthWithdraws decimal


GetAccountTrades

Request:

{
    "AccountId":4,
    "OMSId": 1,
    "StartIndex":0,
    "Count":2
}
String Value
AccountId integer
OMSId integer
StartIndex integer
Count integer

Response:

[
    {
        "TradeTimeMS": -62135446664520,
        "Fee": 0,
        "FeeProductId": 0,
        "OrderOriginator": 1,
        "OMSId": 1,
        "ExecutionId": 1,
        "TradeId": 1,
        "OrderId": 1,
        "AccountId": 4,
        "SubAccountId": 0,
        "ClientOrderId": 0,
        "InstrumentId": 1,
        "Side": "Buy",
        "Quantity": 1,
        "RemainingQuantity": 0,
        "Price": 100,
        "Value": 100,
        "TradeTime": 1501354796406,
        "CounterParty": null,
        "OrderTradeRevision": 1,
        "Direction": "NoChange",
        "IsBlockTrade": false
    }
]
String Value
TradeTimeMS long integer
Fee decimal
FeeProductId integer
OrderOriginator integer
OMSId integer
ExecutionId integer
TradeId integer
OrderId long integer
AccountId integer
SubAccountId integer
InstrumentId long integer
Side string
Quantity decimal
RemainingQuantity integer
Price decimal
Value decimal
TradeTime integer
CounterParty long integer
OrderTradeRevision integer
Direction string
IsBlockTrade Boolean


GetAccountTransactions

Request:

{
    "OMSId": 1,
    "AccountId": 1,
    "Depth": 200
}
String Value
AccountId integer
OMSId integer
StartIndex integer
Count integer

Response:

[
    {
        {
            "TransactionId": 0,
            "OMSId": 0,
            "AccountId": 0,
            "CR": 0,
            "DR": 0,
            "Counterparty": 0,
            "TransactionType": {
                "Options": [
                    "Fee",
                    "Trade",
                    "Other",
                    "Reverse",
                    "Hold"
                ]
        },
        "ReferenceId": 0,
        "ReferenceType": {
            "Options": [
                "Trade",
                "Deposit",
                "Withdraw",
                "Transfer",
                "OrderHold",
                "WithdrawHold",
                "DepositHold",
                "MarginHold"
            ]
        },
        "ProductId": 0,
        "Balance": 0,
        "TimeStamp": 0,
        },
    }
]
String Value
TransactionId integer
OMSId integer
AccountId integer
CR decimal
DR decimal
Counterparty long integer
TransactionType string
ReferenceId long integer
ReferenceType string
ProductId integer
Balance decimal
TimeStamp long integer


GetAccountFees

Request:

{
    "AccountId":0,
    "OMSId":1
}
String Value
AccountId integer
OMSId integer

Response:

[
    {
        "FeeId":1,
        "FeeAmt":0.25,
        "FeeCalcType":"Percentage",
        "FeeType":"MakerFee",
        "LadderThreshold":0,
        "LadderSeconds":0,
        "IsActive":true,
        "InstrumentId":1,
        "OrderType":"Unknown",
        "OMSId":1,
        "AccountId":0
    },{
        "FeeId":2,
        "FeeAmt":0.5,
        "FeeCalcType":"Percentage",
        "FeeType":"TakerFee",
        "LadderThreshold":0,
        "LadderSeconds":0,
        "IsActive":true,
        "InstrumentId":1,
        "OrderType":"Unknown",
        "OMSId":1,
        "AccountId":0
    }
]
String Value
FeeId integer
FeeAmt decimal
FeeCalcType string
FeeType string
LadderThreshold integer
LadderSeconds integer
IsActive boolean
InstrumentId integer
OrderType string
OMSId integer
AccountId integer


GetInstrument

Request:

{
    "OMSId": 1,
    "InstrumentId": 1
}
String Value
OMSId integer
InstrumentId integer

Response:

{
    "OMSId": 0,
    "InstrumentId": 0,
    "Symbol": "",
    "Product1": 0,
    "Product1Symbol": "",
    "Product2": 0,
    "Product2Symbol": "",
    "InstrumentType": {
        "Options":  [
            "Unknown",
            "Standard"
        ]
    },
    "VenueInstrumentId": 0,
    "VenueId": 0,
    "SortIndex": 0,
    "SessionStatus": {
        "Options":  [
            "Unknown",
            "Running",
            "Paused",
            "Stopped",
            "Starting"
        ]
    },
    "PreviousSessionStatus": {
        "Options":  [
            "Unknown",
            "Running",
            "Paused",
            "Stopped",
            "Starting"
        ]
    },
    "SessionStatusDateTime": "0001-01-01T05:00:00Z",
    "SelfTradePrevention": false,
    "QuantityIncrement": 0,
}
String Value
OMSId integer
InstrumentId long integer
Symbol string
Product1 integer
Product1Symbol string
Product2 integer
Product2Symbol string
InstrumentType string
VenueInstrumentId long integer
VenueId integer
SortIndex integer
SessionStatus string
PreviousSessionStatus string
SessionStatusDateTime string
SelfTradePrevention Boolean
QuantityIncrement integer


GetInstruments

Request:

{
    "OMSId": 1
}
String Value
OMSId integer

Response:

[
    {
        {
        "OMSId": 0,
        "InstrumentId": 0,
        "Symbol": "",
        "Product1": 0,
        "Product1Symbol": "",
        "Product2": 0,
        "Product2Symbol": "",
        "InstrumentType": {
            "Options":       [
                "Unknown",
                "Standard"
            ]
        },
        "VenueInstrumentId": 0,
        "VenueId": 0,
        "SortIndex": 0,
        "SessionStatus": {
            "Options":       [
                "Unknown",
                "Running",
                "Paused",
                "Stopped",
                "Starting"
            ]
        },
        "PreviousSessionStatus": {
            "Options":       [
                "Unknown",
                "Running",
                "Paused",
                "Stopped",
                "Starting"
            ]
        },
            "SessionStatusDateTime": "0001-01-01T05:00:00Z",
            "SelfTradePrevention": false,
            "QuantityIncrement": 0,
        },
    }
]
String Value
OMSId integer
InstrumentId long integer
Symbol string
Product1 integer
Product1Symbol string
Product2 integer
Product2Symbol string
InstrumentType string
VenueInstrumentId long integer
VenueId integer
SortIndex integer
SessionStatus string
PreviousSessionStatus string
SessionStatusDateTime string
SelfTradePrevention Boolean
QuantityIncrement integer


GetOpenOrders

Request:

{
    "AccountId":4,
    "OMSId": 1
}
String Value
OMSId integer

Response:

[
    {
        "Side": "Buy",
        "OrderId": 1,
        "Price": 100,
        "Quantity": 1,
        "DisplayQuantity": 1,
        "Instrument": 1,
        "Account": 4,
        "OrderType": "Limit",
        "ClientOrderId": 0,
        "OrderState": "Working",
        "ReceiveTime": 1501354241987,
        "ReceiveTimeTicks": 636369510419870950,
        "OrigQuantity": 1,
        "QuantityExecuted": 0,
        "AvgPrice": 0,
        "CounterPartyId": 0,
        "ChangeReason": "NewInputAccepted",
        "OrigOrderId": 1,
        "OrigClOrdId": 0,
        "EnteredBy": 1,
        "IsQuote": false,
        "InsideAsk": 9223372036.854775807,
        "InsideAskSize": 0,
        "InsideBid": 100,
        "InsideBidSize": 1,
        "LastTradePrice": 0,
        "RejectReason": "",
        "IsLockedIn": false,
        "OMSId": 1
    }
]
String Value
Side string
OrderId long integer
Price decimal
Quantity decimal
DisplayQuantity decimal
Instrument integer
Account integer
OrderType string
ClientOrderId long integer
OrderState string
ReceiveTime long integer
ReceiveTimeTicks long integer
OrigQuantity integer
QuantityExecuted integer
AvgPrice decimal
CounterPartyId long integer
ChangeReason string
OrigOrderId long
EnteredBy integer
IsQuote Boolean
InsideAsk/InsideBid decimal
InsideAskSize/InsideBidSize decimal
LastTradePrice decimal
RejectReason string
IsLockedIn Boolean
OMSId integer

SendOrder

Send a buy/sell order.

Request:

{
    "AccountId": 5,
    "ClientOrderId": 99,
    "Quantity": 1,
    "DisplayQuantity": 0,
    "UseDisplayQuantity": true,
    "LimitPrice": 95,
    "OrderIdOCO": 0,
    "OrderType": 2,
    "PegPriceType": 1,
    "InstrumentId": 1,
    "TrailingAmount": 1.0,
    "LimitOffset": 2.0,
    "Side": 0,
    "StopPrice": 96,
    "TimeInForce": 1,
    "OMSId": 1,
}
String Value
AccountId integer
ClientOrderId long integer
Quantity decimal
DisplayQuantity decimal
UseDisplayQuantity Boolean
LimitPrice decimal
OrderIdOCO integer
OrderType integer
PegPriceType integer
InstrumentId long integer
TrailingAmount decimal
LimitOffset decimal
Side integer
StopPrice decimal
TimeInForce integer
OMSId integer

Response:

{
    "status":"Accepted",
    "errormsg":"",
    "OrderId": 123 // Server order id
}
String Value
status string
errormsg string
OrderId long integer

Error Response:

{
“result”: false, “errormsg”: “”, “errorcode”: 0, “detail”: “”,

}


GetOrderFee

Request:

{
    "OMSId": 0,
    "AccountId": 0,
    "InstrumentId": 0,
    "ProductId": 0,
    "Amount": 0,
    "Price": 0,
    "OrderType": {
        "Options": [
            "Unknown",
            "Market",
            "Limit",
            "StopMarket",
            "StopLimit",
            "TrailingStopMarket",
            "TrailingStopLimit",
            "BlockTrade"
        ]
    },
    "MakerTaker": {
        "Options": [
            "Unknown",
            "Maker",
            "Taker"
        ]
    },
}
String Value
OMSId integer
AccountId integer
InstrumentId long integer
ProductId integer
Amount decimal
Price decimal
OrderType string
MakerTaker string

Response:

{
    "OrderFee": 0.01,
    "ProductId": 1
}
String Value
OrderFee decimal
ProductId integer

GetOrderHistory

Request:

{
    "OMSId": 1,
    "AccountId": 1
}
String Value
OMSId integer
AccountId integer

Response:

[
    {
        {
            "Side": {
                "Options": [
                    "Buy",
                    "Sell",
                    "Short",
                    "Unknown"
                ]
            },
            "OrderId": 0,
            "Price": 0,
            "Quantity": 0,
            "DisplayQuantity": 0,
            "Instrument": 0,
            "Account": 0,
            "OrderType": {
                "Options": [
                    "Unknown",
                    "Market",
                    "Limit",
                    "StopMarket",
                    "StopLimit",
                    "TrailingStopMarket",
                    "TrailingStopLimit",
                    "BlockTrade"
                ]
            },
            "ClientOrderId": 0,
            "OrderState": {
                "Options": [
                    "Unknown",
                    "Working",
                    "Rejected",
                    "Canceled",
                    "Expired",
                    "FullyExecuted"
                ]
            },
            "ReceiveTime": 0,
            "ReceiveTimeTicks": 0,
            "OrigQuantity": 0,
            "QuantityExecuted": 0,
            "AvgPrice": 0,
            "CounterPartyId": 0,
            "ChangeReason": {
                "Options": [
                    "Unknown",
                    "NewInputAccepted",
                    "NewInputRejected",
                    "OtherRejected",
                    "Expired",
                    "Trade",
                    "SystemCanceled_NoMoreMarket",
                    "SystemCanceled_BelowMinimum",
                    "NoChange",
                    "UserModified"
                ]
            },
            "OrigOrderId": 0,
            "OrigClOrdId": 0,
            "EnteredBy": 0,
            "IsQuote": false,
            "InsideAsk": 0,
            "InsideAskSize": 0,
            "InsideBid": 0,
            "InsideBidSize": 0,
            "LastTradePrice": 0,
            "RejectReason": "",
            "IsLockedIn": false,
            "OMSId": 0,
        },
    }
]
String Value
Side string
OrderId integer
Price decimal
Quantity decimal
DisplayQuantity decimal
Instrument integer
Account integer
OrderType string
ClientOrderId long integer
OrderState string
ReceiveTime long integer
ReceiveTimeTicks long integer
OrigQuantity decimal
QuantityExecuted decimal
AvgPrice decimal
CounterPartyId long integer
ChangeReason string
OrigOrderId integer
OrigClOrdId long integer
EnteredBy integer
IsQuote Boolean
InsideAsk decimal
InsideAskSize decimal
InsideBid decimal
InsideBidSize decimal
LastTradePrice decimal
RejectReason string
IsLockedIn Boolean
OMSId integer

GetOrderHistoryByOrderId

Request:

{
    "OMSId": 1,
    "OrderId": 1
}
String Value
OMSId integer
AccountId integer

Response:

[
    {
        {
            "Side": {
                "Options": [
                    "Buy",
                    "Sell",
                    "Short",
                    "Unknown"
                ]
            },
            "OrderId": 0,
            "Price": 0,
            "Quantity": 0,
            "DisplayQuantity": 0,
            "Instrument": 0,
            "Account": 0,
            "OrderType": {
                "Options": [
                    "Unknown",
                    "Market",
                    "Limit",
                    "StopMarket",
                    "StopLimit",
                    "TrailingStopMarket",
                    "TrailingStopLimit",
                    "BlockTrade"
                ]
            },
            "ClientOrderId": 0,
            "OrderState": {
                "Options": [
                    "Unknown",
                    "Working",
                    "Rejected",
                    "Canceled",
                    "Expired",
                    "FullyExecuted"
                ]
            },
            "ReceiveTime": 0,
            "ReceiveTimeTicks": 0,
            "OrigQuantity": 0,
            "QuantityExecuted": 0,
            "AvgPrice": 0,
            "CounterPartyId": 0,
            "ChangeReason": {
                "Options": [
                    "Unknown",
                    "NewInputAccepted",
                    "NewInputRejected",
                    "OtherRejected",
                    "Expired",
                    "Trade",
                    "SystemCanceled_NoMoreMarket",
                    "SystemCanceled_BelowMinimum",
                    "NoChange",
                    "UserModified"
                ]
            },
            "OrigOrderId": 0,
            "OrigClOrdId": 0,
            "EnteredBy": 0,
            "IsQuote": false,
            "InsideAsk": 0,
            "InsideAskSize": 0,
            "InsideBid": 0,
            "InsideBidSize": 0,
            "LastTradePrice": 0,
            "RejectReason": "",
            "IsLockedIn": false,
            "OMSId": 0,
        },
    }
]
String Value
Side string
OrderId integer
Price decimal
Quantity decimal
DisplayQuantity decimal
Instrument integer
Account integer
OrderType string
ClientOrderId long integer
OrderState string
ReceiveTime long integer
ReceiveTimeTicks long integer
OrigQuantity decimal
QuantityExecuted decimal
AvgPrice decimal
CounterPartyId long integer
ChangeReason string
OrigOrderId integer
OrigClOrdId long integer
EnteredBy integer
IsQuote Boolean
InsideAsk decimal
InsideAskSize decimal
InsideBid decimal
InsideBidSize decimal
LastTradePrice decimal
RejectReason string
IsLockedIn Boolean
OMSId integer

GetOrdersHistory

Request:

{
    "OMSId": 1,
    "AccountId": 0,
    "ClientOrderId": 0,
    "OriginalOrderId": 0,
    "OriginalClientOrderId": 0,
    "UserId": 0,
    "InstrumentId": 0,
    "StartTimestamp": 0,
    "EndTimestamp": 0,
    "Depth": 0,
    "StartIndex": 0,
}
String Value
OMSId integer
AccountId integer
ClientOrderId long integer
OriginalOrderId integer
UserId integer
InstrumentId long integer
StartTimestamp long integer
EndTimestamp long integer
Depth integer
StartIndex integer

Response:

[
    {
        "Side": {
            "Options": [
                "Buy",
                "Sell",
                "Short",
                "Unknown"
            ]
        },
        "OrderId": 0,
        "Price": 0,
        "Quantity": 0,
        "DisplayQuantity": 0,
        "Instrument": 0,
        "Account": 0,
        "OrderType": {
            "Options": [
                "Unknown",
                "Market",
                "Limit",
                "StopMarket",
                "StopLimit",
                "TrailingStopMarket",
                "TrailingStopLimit",
                "BlockTrade"
            ]
        },
        "ClientOrderId": 0,
        "OrderState": {
            "Options": [
                "Unknown",
                "Working",
                "Rejected",
                "Canceled",
                "Expired",
                "FullyExecuted"
            ]
        },
        "ReceiveTime": 0,
        "ReceiveTimeTicks": 0,
        "OrigQuantity": 0,
        "QuantityExecuted": 0,
        "AvgPrice": 0,
        "CounterPartyId": 0,
        "ChangeReason": {
            "Options": [
                "Unknown",
                "NewInputAccepted",
                "NewInputRejected",
                "OtherRejected",
                "Expired",
                "Trade",
                "SystemCanceled_NoMoreMarket",
                "SystemCanceled_BelowMinimum",
                "NoChange",
                "UserModified"
            ]
        },
        "OrigOrderId": 0,
        "OrigClOrdId": 0,
        "EnteredBy": 0,
        "IsQuote": false,
        "InsideAsk": 0,
        "InsideAskSize": 0,
        "InsideBid": 0,
        "InsideBidSize": 0,
        "LastTradePrice": 0,
        "RejectReason": "",
        "IsLockedIn": false,
        "OMSId": 0,
    },
}

]

String Value
Side string
OrderId integer
Price decimal
Quantity decimal
DisplayQuantity decimal
Instrument integer
Account integer
OrderType string
ClientOrderId long integer
OrderState string
ReceiveTime long integer
ReceiveTimeTicks long integer
OrigQuantity decimal
QuantityExecuted decimal
AvgPrice decimal
CounterPartyId long integer
ChangeReason string
OrigOrderId integer
OrigClOrdId long integer
EnteredBy integer
IsQuote Boolean
InsideAsk decimal
InsideAskSize decimal
InsideBid decimal
InsideBidSize decimal
LastTradePrice decimal
RejectReason string
IsLockedIn Boolean
OMSId integer

GetAllDepositRequestInfoTemplates

Certain account providers require specific information (deposit request info) for deposits.

Request:

{
    "OMSId":1,
    "ProductId": 1,
}
String Value
OMSId integer
ProductId integer

Response:

"Templates": [
{

“providerId”: 10, “providerName”: “Nigerian Naira”, “depositTemplate”: {

“ProviderType”: “QuickTeller”, “Template”: “{

“FirstName”: null, “LastName”: null, “Amount”:0

}”, “ProcessInfo”: ” “, “UseGetDepositWorkflow”: true, “DepositWorkflow”: “CryptoWallet”

}

},{

“providerId”: 7, “providerName”: “Nigerian Naira”, “depositTemplate”: {

“ProviderType”: “WebPay”, “Template”: “{

“FirstName”: null, “LastName”: null, “Amount” :null

}”, “ProcessInfo”: ” “, “UseGetDepositWorkflow”: true, “DepositWorkflow”: “MerchantRedirect”

}

}], “result”: false, “errormsg”: null, “statuscode”:0 }”

}


GetAllDepositTickets

Returns all deposit tickets that were sent.

Request:

{
    "OMSId":1,
    "Operatorid": 1,
    "AccountId": 1,
    "Status": 5,
    "TicketId": 127,
    "StartTimestamp": "2016-04-21T21:48:22Z",
    "EndTimestamp": "2016-11-21T21:48:22Z",
    "StartIndex": 0,
    "Limit": 0,
    "UserName": "John Smith",
    "Amount": 50,
    "AmountOperator": 1,
}
String Value
OMSId integer
OperatorId integer
AccountId integer
Status integer
TicketId integer
StartIndex integer
Limit integer
UserName string
StartTimestamp string
EndTimestamp string
Amount decimal
AmountOperator integer

Response:

[
    {
        "AssetManagerId": 1,
        "AccountId": 1,
        "AssetId": 1,
        "AssetName": "BTC",
        "Amount": 100.0,
        "OMSId": 1,
        "RequestCode": "6D2E6447-AED7-4E5B-8759-B2F564E95FC7"
        "RequestIP": "90.171.32.77",
        "RequestUser": 1,
        "RequestUserName": "admin",
        "OperatorId": 1,
        "Status": "New",
        "FeeAmt": 0.0,
        "UpdatedByUser": 1,
        "UpdatedByUserName": "admin",
        "TicketNumber": 127,
        "DepositInfo": "{
            "Full Name": "John Smith",
            "language": "en",
            "Bank Name": ""
        }",
        "CreatedTimestamp": "2016-04-21T21:48:22Z",
        "LastUpdateTimeStamp": "2016-04-21T21:48:22Z" ,
        "Comments": [],
        "Attachments": [],
    }
]
String Value
AssetManagerId integer
AccountId integer
AssetId decimal
AssetName decimal
Amount decimal
OMSId integer
RequestCode integer
RequestIp string
RequestUser long integer
RequestUserName string
OperatorId long integer
Status long integer
FeeAmt decimal
UpdatedByUser decimal
UpdateByUserName decimal
TicketNumber long integer
DepositInfo string
CreatedTimestamp integer
LastUpdateTimeStamp long integer
Comments integer
Attachments Boolean

GetAllWithdrawTickets

Returns all withdraw tickets that were sent.

Request:

{
    "OMSId":1,
    "Operatorid": 1,
    "AccountId": 1,
    "Status": 5,
    "TicketId": 127,
    "StartTimestamp": "2016-04-21T21:48:22Z",
    "EndTimestamp": "2016-11-21T21:48:22Z",
    "StartIndex": 0,
    "Limit": 0,
    "UserName": "John Smith",
    "Amount": 50,
    "AmountOperator": 1,
}
String Value
OMSId integer
OperatorId integer
AccountId integer
Status integer
TicketId integer
StartIndex integer
Limit integer
UserName string
StartTimestamp string
EndTimestamp string
Amount decimal
AmountOperator integer

Response:

[
    {
        "AssetManagerId": 0,
        "AccountId": 4,
        "AssetId": 2,
        "AssetName": "Tether",
        "Amount": 0.4,
        "TemplateForm": "{
        "TemplateType": "TetherRPCWithdraw",
        "Comment": "TestWithdraw",
        "ExternalAddress": "ms6C3pKAAr8gRCcnVebs8VRkVrjcvqNYv3",
        "TemplateFormType": "TetherRPCWithdraw",
        "OMSId": 1,
        "RequestCode": "490b4fa3-53fc-44f4-bd29-7e16be86fba3",
        "RequestIP": "108.35.121.205",
        "RequestUserId": 7,
        "RequestUserName": "testUser6",
        "OperatorId": 1,
        "Status": "FullyProcessed",
        "FeeAmt": 0,
        "UpdatedByUser": 7,
        "UpdatedByUserName": "testUser6",
        "TicketNumber": 51,
        "CreatedTimestamp": "2017-11-22T20:15:54Z",
        "LastUpdateTimestamp": "2017-11-22T20:16:11Z",
            "Comments": [
                {
                    "CommentId": 2,
                    "EnteredBy": 1,
                    "EnteredDateTime": "2017-11-22T20:16:11Z",
                    "Comment": "Withdraw Submitted (11/22/2017 8:16:11 PM):
                    2c843665606bdfdcbdf9a307a89098f
                    5b68e53448287e33b672d3f1090bd49a7",
                    "OperatorId": 1,
                    "OMSId": 1,
                    "TicketCode": "49541cc89-c9c3-4bf6-9141-da1f0ef67fae",
                    "TicketId": 51
                },
            ],
            "Attachments": [],
            "AuditLog": []
        },
String Value
AssetManagerId integer
AccountId integer
AssetId decimal
AssetName decimal
Amount decimal
TemplateForm integer
TemplateFormType integer
OMSId string
RequestCode long integer
RequestIP string
RequestUserId long integer
RequestUserName long integer
OperatorId decimal
Status decimal
FeeAmt decimal
UpdatedByUser decimal
UpdatedByUserName decimal
TicketNumber decimal
CreatedTimestamp decimal
LastUpdateTimestamp decimal
Comments decimal
Attachments decimal
AuditLog decimal

GetDepositInfo

Returns an array of cryptographic deposit addresses that the user will use to send crypto-currency funds to the trading venue.

Request:

{
    "OMSId": 1,
    "AccountId": 4,
    "ProductId": 1,
    "GenerateNewKey": true
}
String Value
OMSId integer
AccountId integer
ProductId integer
GenerateNewKey Boolean

Response:

{
    "AssetManagerId": 1,
    "AccountId": 0,
    "AssetId": 1,
    "ProviderId": 1,
    "DepositInfo": "[
        "mkqpdfHecor7QCd53sEyWE1TL4UupE8L9z",
        "muTJjY6411MmRTccvyHxJmET3t3b8EeCNT",
        "mjN4bJJotcCRRiiGpWXyiE4vdRpVMQf5Wa",
        "mivkpkPBKm5sXFGiySgVbhxQ2Keb9fKGiR",
        "mvAKe9ZoNLWALYuc2TK9HVK9dt5oLsbAAZ",
        "myCP69kfd3eu1MvW8DKXjfFsEJns2mK3K5",
        "mubnHGgBqBunjGSsx25bbBA4n2eBpJGJKC",
        "mxV5wizeS2r6j8jiUWUsTrMimda3fSqx8f",
        "mr5L1qb4cJTsvJPnU4zMD95snXdNsJpd6L",
        "mqt2NgUrhYQWixcNdU76u5uAa3u34tqvmr",
        "mgySiizawpSMeJhz3Q7K1w9zgEwE4JQ4fD"
    ]",
    "result": true,
    "errormsg": null,
    "statuscode": 0
}
String Value
AssetManagerId integer
AccountId integer
AssetId integer
ProviderId integer
DepositInfo integer
result integer
errormsg integer
statuscode integer

GetDepositTicket

Returns an array of cryptographic deposit addresses that the user will use to send crypto-currency funds to the trading venue.

Request:

{
    "OMSId": 1,
    "AccountId": 4,
    "ProductId": 1,
    "GenerateNewKey": true
}
String Value
OMSId integer
AccountId integer
ProductId integer
GenerateNewKey Boolean

Response:

{
    "AssetManagerId": 1,
    "AccountId": 0,
    "AssetId": 1,
    "ProviderId": 1,
    "DepositInfo": "[
        "mkqpdfHecor7QCd53sEyWE1TL4UupE8L9z",
        "muTJjY6411MmRTccvyHxJmET3t3b8EeCNT",
        "mjN4bJJotcCRRiiGpWXyiE4vdRpVMQf5Wa",
        "mivkpkPBKm5sXFGiySgVbhxQ2Keb9fKGiR",
        "mvAKe9ZoNLWALYuc2TK9HVK9dt5oLsbAAZ",
        "myCP69kfd3eu1MvW8DKXjfFsEJns2mK3K5",
        "mubnHGgBqBunjGSsx25bbBA4n2eBpJGJKC",
        "mxV5wizeS2r6j8jiUWUsTrMimda3fSqx8f",
        "mr5L1qb4cJTsvJPnU4zMD95snXdNsJpd6L",
        "mqt2NgUrhYQWixcNdU76u5uAa3u34tqvmr",
        "mgySiizawpSMeJhz3Q7K1w9zgEwE4JQ4fD"
    ]",
    "result": true,
    "errormsg": null,
    "statuscode": 0
}
String Value
AssetManagerId integer
AccountId integer
AssetId integer
ProviderId integer
DepositInfo integer
result integer
errormsg integer
statuscode integer

GetWithdrawTicket

Returns information about requested withdraw.

Request:

{
    "OMSId": 1,
    "OperatorId": 1,
    "RequestCode": "866f21fe-3461-41d1-91aa-5689bc38503f",
    "AccountId": 4
}
String Value
OMSId integer
OperatorId integer
“RequestCode” string
“AccountId” integer

Response:

{
     "AssetManagerId": 0,
     "AccountId": 4,
     "AssetId": 2,
     "AssetName": "US Dollar",
     "Amount": 10,
     "TemplateForm": "{
     "FullName": "TestUser",
     "Language": "En",
     "Comment": "Test comment",
     "BankAddress": "My Bank’s address",
     "BankAccountNumber": "123456789",
     "BankAccountName": "MyBank",
     "SwiftCode": "SWIFT1023"
 }",
     "TemplateFormType": "Standard",
     "OMSId": 1,
     "RequestCode": "2ddcbcd6-74c5-4082-8e62-ee93862a2c2d",
     "RequestIP": "90.171.32.77",
     "RequestUserId": 1,
     "RequestUserName": "admin",
     "OperatorId": 1,
     "Status": "Pending2Fa",
     "FeeAmt": 0,
     "UpdatedByUser": 1,
     "UpdatedByUserName": "admin",
     "TicketNumber": 52,
     "CreatedTimestamp": "2017-12-14T15:25:13Z",
     "LastUpdateTimestamp": "2017-12-14T15:25:13Z",
     "Comments": [],
     "Attachments": [],
     "AuditLog": []
 }
String Value
AssetManagerId integer
AccountId integer
AssetId integer
AssetName string
Amount decimal
TemplateForm object
TemplateFormType object
OMSId integer
RequestCode string
RequestIP string
RequestUser integer
RequestUserName string
OperatorId integer
Status string
FeeAmt decimal
UpdatedByUserId integer
UpdatedByUserName string
OperatorId integer
Status string
UpdatedByUser integer
UpdatedByUserName string
TicketNumber integer
CreatedTimestamp string
LastUpdateTimeStamp string
Comments string
Attachments string
AuditLog string