Introdução WebSocket

No exemplo descrito nesta documentação, utilizamos NodeJs e a biblioteca ws.

GitHub - Exemplo WebSocket

Você pode fazer o download do exemplo diretamente do repositório no GitHub:

Conectando Websocket

Uso em NodeJs.:

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

//WebSocketAPI Address
var wsAddress = 'wss://apifoxbitprodlb.alphapoint.com/WSGateway/';

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

Message Frame

Objeto em formato JSON-formatted utilizado como frame para enviar e receber dados.:

//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

Objeto em formato JSON-formatted qual contém campos obrigatórios (e diferentes) para o envio de dados o endpoint acionado.

Cada endpoint tem um pacote específico, consulte o formato do payload na documentação.

//Exemplo de construção do payload para o endpoint *WebAuthenticateUser*
var payload = {

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

};

Eventos

Defina o evento Open para tratar o retorno da conexão.:

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

    console.log('Conected');

});

Defina evento para receber a mensagem do socket.:

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

    //data contém o payload de resposta
    console.log(data);

});

Defina evento para tratamento de erros.:

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

    console.log('Error');

});

Defina evento tratar a finalização da conexão.:

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

    console.log('Connection Closed');

});

Enviando Dados

Para enviar dados ao servidor você deve utilizar o objeto “messageFrame” descrito acima, utilize o campo “n” para informar o Endpoint a acionar e o campo “o” para envio do payload.

//Indique para qual endpoint será enviado.
messageFrame.n = "WebAuthenticateUser"

//Adicione o payload referente ao endpoint indicado
messageFrame.o = JSON.stringify(payload);

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

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

});

Dados enviados, caso não retorne erro finaliza a mensagem no evento mensagem.


Autenticação

Abaixo seguem os endpoints para autenticação de usuário no websocket

WebAuthenticateUser

WebAuthenticateUser autentica um usuário no WebSession corrente.

Você precisa chama-lo para utilizar os métodos que requerem um SessionToken ativo.

Ao realizar a autenticação, um SessionToken é informado. Guarde-o em uma variável.

Request:

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

>>> Nota: UserName é o e-mail do usuário

Sem sucesso na autenticação:

{
    "Authenticated": false
}

Resposta quando o usuário já está logado:

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

>>> Nota: Voce deve guardar o SessionToken em uma variável.

Resposta entregando um SessionToken ativo

String Value
Authenticated Boolean.
SessionToken string.
UserId integer.


AuthenticateUser

AuthenticateUser autentica um usuário no WebSession corrente utilizando APIKEY definido previamente

Você precisa chama-lo para utilizar os métodos que requerem um SessionToken ativo.

AuthenticateUser pode ser chamado sempre que for necessária uma autenticação.

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);

Sem sucesso na autenticação:

{
    "Authenticated": false
}
String Value
Authenticated Boolean.
SessionToken string.
UserId integer.


Authenticate2FA

Completa a segunda parte da autenticação em dois passos, segue abaixo os passos da autenticação 2FA.

Request:

{
    "Code": "YourCode"
}
String Value
Code string. Insira o código 2FA

Response:

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

O SessionToken é válido durante sessão corrente paraq o mesmo IP (IPAddress).

A sessão dura até 1 hora após a última atividade ou até ser executado endpoint LogOut.

Se a conexão for interrompida você pode reativa-la utilizando o SessionToken e chamando novament o Endpoint Authenticate2FA sem a necessidade de logar novamente ou informar o 2FA Key.

{
    "SessionToken": "YourSessionToken"
}
String Value
Authenticated Boolean. Autenticação com sucesso retorna True. Sem sucesso retorna False
SessionToken string. O SessionToken é válido para sessão atual para conexões com o mesmo endereço IP. Se a comunicação for interrompida você pode informar retornando o SessionToken ao invés de repetir o processo 2FA completo.

Uma sessão dura até 1 hora de inatividade, ou até ser executado o LogOut.


Para enviar o SessionToken para restabelecer a conexão envie:

{
    "SessionToken": "YourSessionToken"
}


Exemplo Websocket Completo

Abaixo você pode visualizar exemplo completo da aplicação em Nodejs consumindo Websocket da Foxbit.

  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
 //Instantiate Websocket module
 const WebSocket = require('ws');

 //WebSocketAPI Address
 var wsAddress = 'wss://apifoxbitprodlb.alphapoint.com/WSGateway/';

 //Instantiate SleepModule
 var sleep = require('system-sleep');

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

 //Flag Authenticated
 var authenticated = false;

 //User & Password
 var userLogin = "";
 var userPass = "";
 var userId = "0";
 var sessionToken = "";

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

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

 //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

 };

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

     consoleMessage('------------------------------------------------------------------------','startup');
     consoleMessage('Got connection','open.event');

     //Start first command
     WebAuthenticateUser(messageFrame);

     consoleMessage('End connection','open.event');

 });

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

     dealMessage(messageFrame, data);

 });

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

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

 });

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

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

     WebAuthenticateUser(frame);

 });

 /*
 //Event End Message
 ws.on('end', function(data) {

     consoleMessage('WebService','end! ' + data);

 });
 */

 //Function AskUserInfo
 function AskPrompt(message){

     consoleMessage(message);

     stdin.addListener("data", function(d) {

         var ret = d.toString().trim();

         consoleMessage('!AskPrompt', ret);

         return ret;

     });

 }

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

     var ret = JSON.parse(message);

     if (ret.n == "WebAuthenticateUser"){

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

         if (authenticated == false){

             Authenticate2FA(frame);

         }

     }else if (ret.n == "GetUserInfo"){

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

     }else if (ret.n == 'SendOrder'){

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

     }else if(ret.n == 'Authenticate2FA') {

         authenticated = true;

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

         var paramO;
         if (ret.o != undefined){
             paramO = JSON.parse(ret.o);

             sessionToken = JSON.stringify(paramO.SessionToken);
             userId = JSON.stringify(paramO.UserId);

             consoleMessage('<- sessionToken', sessionToken);

             consoleMessage('<- userId', userId);

             Authenticate2FA(frame);

         }

     }else{

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

     }

 }

 //Startup Function
 function startTrading(frame){

     SendOrder(frame);

 }

 //Function WebAuthenticateUser
 function WebAuthenticateUser(frame){

     frame.n = "WebAuthenticateUser";

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

     frame.o = JSON.stringify(requestPayload);

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

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

         if (error != undefined){

             consoleMessage('Error', JSON.stringify(error));

         }

     });

 }

 //Function Authenticate2FA
 function Authenticate2FA(frame){

     frame.n = "Authenticate2FA";

     var twoFA = "0000";

     if (sessionToken == ""){

         consoleMessage(frame.n, 'Enter with 2FA Code:');

         stdin2FA.addListener("data", function(d) {

             twoFA = d.toString().trim();

             if (twoFA != "0000"){

                 var requestPayload = { "Code": twoFA };

                 frame.o = JSON.stringify(requestPayload);

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

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

                     if (error != undefined){

                         console.log('<- Authenticate2FA.error: (' + error + ')');

                     }

                 });

             }

         });

     }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));

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

             if (error != undefined){

                 console.log('<- Authenticate2FA.error: (' + error + ')');

             }

         });

         GetUserInfo(frame);

     }



 }

 //Function SendOrder
 function SendOrder(frame){

     frame.n = "SendOrder";

     var requestPayload = {

             "AccountId": 84437,
             "ClientOrderId": 0,
             "Quantity": 0.00001,
             "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));

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

         ws = new WebSocket('wss://apifoxbitprodlb.alphapoint.com/WSGateway/')

         console.log('SendOrder.error: (' + error + ')');

     });

 }


 function CancelOrder(frame, OrderId){

     frame.n = "CancelOrder";

     requestPayload2 = {
         "OMSId": 1,
         "AccountId":81
     };

     frame.o = JSON.stringify(requestPayload2);

     ws.send(JSON.stringify(frame), function ack(error) {
         console.log('CancelOrder.error: (' + error + ')');
     });

 }

 function GetOrderHistory(frame){

     frame.n = "GetOrderHistory";

     requestPayload2 = {
         "OMSId": 1,
         "AccountId":81
     };

     frame.o = JSON.stringify(requestPayload2);

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

         console.log('GetOrderHistory.error: (' + error + ')');

     });

 }

 function GetOpenOrders(frame){

     frame.n = "GetOpenOrders";

     requestPayload2 = {
         "AccountId":81,
         "OMSId": 1
     };

     frame.o = JSON.stringify(requestPayload2);

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

         console.log('GetOpenOrders.error: (' + error + ')');

     });

 }

 function GetUserInfo(frame){

     frame.n = "GetUserInfo";

     requestPayload2 = {
     };

     frame.o = JSON.stringify(requestPayload2);

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

         console.log('GetUserInfo.error: (' + error + ')');

     });

 }

 function GetUserConfig(frame){

     frame.n = "GetUserConfig";

     requestPayload2 = {

     };

     frame.o = JSON.stringify(requestPayload2);

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

         console.log('GetUserInfo.error: (' + error + ')');

     });

 }

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

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

 }

Endpoint Público

Os Endpoints públicos são acessados sem necessidade de autenticação.

LogOut

Finaliza a conexão atual.

Request:

{ }

>> Não é necessário enviar qualquer dado.

Response:

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


ResetPassword

ResetPassword é um processo de dois passos. Primeiro chame ResetPassword o username, após a conclusão um e-mail será enviado para sua conta com um link pedindo que recadastre a senha.

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

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

Retorna detalhado do par. 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

Retorna array detalhado do par. 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

Retorna detalhado sobre o par solicitado.

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

Retorna array detalhado sobre o par solicitado.

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

Retorna snapshot do book level2 de um instrumento específico. (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

Retorna histórico de Ticker do instrumento específico:

Request:

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

Response:

>>> Retorna o seguinte 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

Retorna Ticker level1 de um instrumento específico. (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

Retorna Ticker level1 de um instrumento específico. (array)

Request:

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

ou

{
    "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

Assina o evento Ticker com um retorno periódico.

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
    }
]

UnsubscribeLevel1

Revoga assinatura do evento Market data feed Level1.

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

Revoga assinatura do evento Market data feed Level2.

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

Revoga assinatura do evento Ticker.

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

Revoga assinatura do evento Trades Mareket Data Feed.

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

Endpoint Autenticado

Aqui estão os Endpoints que necessitam de autenticação prévia.

GetAvailablePermissionList

Retorna um array com permissões que podem ser atribuidas ao usuário que solicita.

Request:

{ }

Response:

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


GetUserConfig

Retorna configurações definidas pelo usuário.

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

Retorna informações básicas sobre o usuário que solicita.

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

Retorna permissões específicas para o usuário solicitante.

Request:

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

Response:

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


RemoveUserConfig

Remove configuração do usuário através de 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

Define um array arbitrário no campo Config com par key/value.

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

Insere informações básicas sobre o usuário.

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

Cancela todas as ordens abertas para o instrumento especificado.

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

Cancela ordem específica que ainda não foi executada.

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

Cancela ordem específica que ainda não foi executada.

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

Chamada única que cancela uma ordem não executada e inclui uma nova ordem no lugar.

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,
}


GetAccountInfo

Retorna informação sobre a conta do usuário logado.

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

Retorna um array com o histórico do balanço do usuário

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


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

Envia uma ordem de compra/venda.

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

Erro 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

GetAllDepositTickets

Retorna todos os tickets de depósitos enviados.

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

Retorna todos os tickets de saque enviados.

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

GetDepositTicket

Retorna informação sobre depósito solicitado.

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": 1,
    "AccountId": 4,
    "AssetId": 2,
    "AssetName": "US Dollar",
    "Amount": 10,
    "OMSId": 1,
    "RequestCode": "866f21fe-3461-41d1-91aa-5689bc38503f",
    "RequestIP": "90.171.32.77",
    "RequestUser": 1,
    "RequestUserName": "admin",
    "OperatorId": 1,
    "Status": "New",
    "FeeAmt": 0,
    "UpdatedByUser": 1,
    "UpdatedByUserName": "admin",
    "TicketNumber": 67,
    "DepositInfo": "{
    "Full Name":"Test",
    "language":"en",
    "Bank Name":""
}",
    "CreatedTimestamp": "2017-12-14T15:13:31Z",
    "LastUpdateTimeStamp": "2017-12-14T15:13:31Z",
    "Comments": [],
    "Attachments": []
}
String Value
AssetManagerId integer
AccountId integer
AssetId integer
AssetName string
Amount decimal
OMSId integer
RequestCode string
RequestIP string
RequestUser integer
RequestUserName string
OperatorId integer
Status string
FeeAmt decimal
UpdatedByUser integer
UpdatedByUserName string
TicketNumber integer
DepositInfo string
CreatedTimestamp string
LastUpdateTimestamp string
Comments string
Attachments string

GetWithdrawTicket

Retorna informação sobre saque solicitado.

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