Links

QUERY ORDERS & TRADES

Clients can retrieve open and executed order information
QUERY TRADE
SAMPLE REQUEST TRADE
{“type”:”querytrade”, “fromtime”:”1555522543000”}
This is to query the trades for a user.
Only administrator can specify “userid” field.
  • “fromtime” field is optional, if set, it is to specify cutofftime to query
  • “security” field is optional, if set, it is to return trades for that security only
SAMPLE RESPONSE ON SUCCESS OR FAILURE
  • “total_rec” tells you how many records there are available.
For each record, there is “rec_no”, this is just for counting. Total number of records received should match value in “total_rec” field. It should be sort by “time”.
If there are more than 100 records, system can send you multiple response, each will have100 records.
{“result”:”OK”,”userid”:”0003”,”type”:”querytrade”,”total_rec”:0}
{“result”:”OK”,”data”:[{“refno”:”5GQBE9BCZOO0A3”,”category”:”CROX”,”ex
ecqty”:”10”,”execprice”:”30”,”traderefno”:”5GQBE9BCZOO0A32_5GQBE9BCZOO2”,”side”:
“B”,”trdtime”:”1557323619303”,”rec_no”:1,”security”:”MSFT”,”type”:”sale”},{“refn
o”:”5GQBE9BCZN4GA7”,”category”:”CROX”,”execqty”:”10”,”execprice”:”100.5”,”trader
efno”:”5GQBE9BCZN4GA72_5GQBE9BCZN4I”,”side”:”B”,”trdtime”:”1557323603427”,”rec_n
o”:2,”security”:”ZVZZT”,”type”:”sale”}],”type”:”querytrade”,”total_rec”:2}
QUERY ORDER
SAMPLE REQUEST TRADE
{“refno”:”5GS08WTIE8CWA0”,”security”:”BTCUSD”,”type”:”queryorder”}
Must provide “security” and “refno” field (that is FI’s order refno).
{“result”:”OK”,”refno”:”5GS08WTIE8CWA0”,”data”:{“updtime”:”15575052350
85”,”tif”:”GTC”,”execamount”:”10000”,”qty”:”1000”,”security”:”BTCUSD”,”type”:”or
der”,”clientorderid”:”ID1”,”liveqty”:”900”,”category”:”BRUT”,”refno”:”5GS08WTIE8
CWA0”,”price”:”100”,”execqty”:”100”,”side”:”S”},”security”:”BTCUSD”,”type”:”quer
yorder”}
{“result”:”order not found”,”refno”:”5GS08WTIE8CWA0”,”security”:”BTCUS
D”,”type”:”queryorder”}
TRADE HISTORY
  • Symbol- type=getsymbols Close- type=highlow. Get data per symbol if exists
  • Open- type=subscribeonopen
  • % Change - calculating is (openingprice - prevcloseprice)/prevcloseprice * 100
    • openingprice from type=highlow
    • prevcloseprice from type=highlow
  • High- type=highlow. Get data per symbol if exists
  • Low- type=highlow. Get data per symbol if exists • Best Bid - type=subscribe . Max price from bids
  • Best Ask - type=subscribe. Min price from asks
  • Quantity in Trade - type=subscribe. Sum of qty from books
Must set “security” field for the symbol that you query.
Optional field “extradays”, by default, system return last 24-hour trade info back to you. If you need extra history, set “extradays”, for example to “3” for 3 extra previous day history info.
The query returns the trade history in 1-minute block. If that minute has trade, a corresponding block will be return with summary of that minute high/low/first/last trade price as well as volume and num of trades info.
There can be multiple responses to one query if there are more than 100 entries in response. Each response will carry maximum of 100 entries. “total_rec” tells how many records there should be, and “rec_no” tell you current number of record.
Trading Statistics for Symbols
SAMPLE REQUEST EXAMPLES:
{“type”:”tradehistory”,”security”:”BTCUSD”},
{“result”:”OK”,”data”:[{“lastprice”:”11
1”,”starttime”:”1556194354163”,”lastttime”:”1556194368559”,”volume”:”2”,”highpri
ce”:”125”,”blocktime”:”1556194320000”,”rec_no”:1,”numoftrades”:”2”,”startprice”:
“125”,”lowprice”:”111”},{“lastprice”:”135”,”starttime”:”1556194413020”,”lastttim
e”:”1556194413020”,”volume”:”1”,”highprice”:”135”,”blocktime”:”1556194380000”,”r
ec_no”:2,”numoftrades”:”1”,”startprice”:”135”,”lowprice”:”135”},{“lastprice”:”13
5”,”starttime”:”1556194529756”,”lastttime”:”1556194538364”,”volume”:”2”,”highpri
ce”:”160”,”blocktime”:”1556194500000”,”rec_no”:3,”numoftrades”:”2”,”startprice”:
“160”,”lowprice”:”135”},{“lastprice”:”140”,”starttime”:”1556194560524”,”lastttim
e”:”1556194560524”,”volume”:”1”,”highprice”:”140”,”blocktime”:”1556194560000”,”r
ec_no”:4,”numoftrades”:”1”,”startprice”:”140”,”lowprice”:”140”}],”security”:”BTC
USD”,”type”:”tradehistory”,”total_rec”:4}
For tradable symbols (such as pairs), there is summary of:
  • "high"
  • "low"
  • "open"
  • "close"
CLOSE prevcloseprice
{"type":"subscribehighlow","security":"LTCUSD"} {"openingprice":"166.39","security":"LTCUSD","highprice":"45000","lowprice":"1","prevcloseprice":"176","type":"highlow"}
OPEN openingprice
{"type":"subscribehighlow","security":"LTCUSD"} R {"openingprice":"166.39","security":"LTCUSD","highprice":"45000","lowprice":"1","prevcloseprice":"176","type":"highlow"}
PERCENT Change calc
(openingprice - prevcloseprice)/prevcloseprice *100 4. High - highprice Q {"type":"subscribehighlow","security":"LTCUSD"} R {"openingprice":"166.39","security":"LTCUSD","highprice":"45000","lowprice":"1","prevcloseprice":"176","type":"highlow"}
LOW lowprice
{"type":"subscribehighlow","security":"LTCUSD"} R {"openingprice":"166.39","security":"LTCUSD"
The corresponding time (which is in EPOCH milliseconds),"tradeqty" for total qty and "tradeamount" for total amount.
SUBSCRIBEONOPEN
{"type":"subscribeonopen","security":"AAPL"}
{"result":"OK","security":"AAPL","type":"subscribeonopen"}
SUBSCRIBE
{"type":"subscribe","request":[{"security":"AAPL","msg":"ibook"},
{"security":"AAPL","msg":"itrade"}]}
{"security":"AAPL","books":[{"side":"B","act":"U","src":"CROX","price":"87","qty":"10","id":247697979505377328,"time":
"1610626921561","mpid":"FDML","key":"5XW4NNPLZZKKC0"},{"side":"B","act":"U","src":"CROX","price":
"87","qty":"10","id":247697979505377327,"time":"1610626867059","mpid":"FDML","key":"5XW4NNPLZZKJC0"},{"side":"B","act":
"U","src":"CROX","price":"99","qty":"10","id":247697979505377326,"time":
"1610626859320","mpid":"FDML","key":"5XW4NNPLZZKIC0"},{"side":"S","act":"U","src":"CROX","price":"100","qty":"65","id":
247697979505377325,"time":"1610626845129","mpid":"FINT","key":"5XVXU4B5E67XC0"},{"side":"S","act":"U","src":"CROX","price":
"702","qty":"75","id":247697979505377324,"time":"1610600824281","mpid":"FINT","key":"5XVXU4B5E67VC0"},{"side":"S","ioi":
true,"act":"U","src":"CROX","price":"140","qty":"20","id":247697979505377323,"time":"1610600823886","mpid":"FINT","key":
"5VREII6NO0K4C0"},{"side":"B","ioi":true,"act":"U","src":"CROX","price":"123","qty":"456","id":247697979505377322,"time":
"1610600823886","mpid":"FINT","key":"5VREII6NO0K0C0"}],"type":"book"}
{"security":"AAPL","src":"CROX","price":"100","qty":"10","time":"1610626844292","type":"trade","matchid":"5XW4NNPLZZKH"}
{"request":[{"msg":"ibook","result":"OK","security":"AAPL"},{"msg":"itrade","result":"OK","security":"AAPL"}],"type":"subscribe"}
SUBCRIBEHIGHLOW
{"type":"subscribehighlow","security":"AAPL"}
{"openingprice":"100","security":"AAPL","highprice":"100","lowprice":
"100","prevcloseprice":"100","type":"highlow"}
{"result":"OK","security":"AAPL","type":"subscribehighlow"}
TRADEHISTORY
{"type":"tradehistory","security":"AAPL"}
{"result":"OK","security":"AAPL","data":[{"volume":"34","numoftrades":"2",
"lastttime":"1610578178456","blocktime":"1610578140000","highprice":"702",
"lowprice":"702","rec_no":1,"starttime":"1610578152233","lastprice":"702",
"startprice":"702"},{"volume":"56","numoftrades":"2","lastttime":"1610578259882",
"blocktime":"1610578200000","highprice":"702","lowprice":"702","rec_no":2,
"starttime":"1610578203880","lastprice":"702","startprice":"702"},{"volume":"8",
"numoftrades":"8","lastttime":"1610578270925","blocktime":"1610578260000",
"highprice":"100","lowprice":"100","rec_no":3,"starttime":"1610578270917",
"lastprice":"100","startprice":"100"},{"volume":"10","numoftrades":"1",
"lastttime":"1610626844761","blocktime":"1610626800000","highprice":"100",
"lowprice":"100","rec_no":4,"starttime":"1610626844761","lastprice":"100",
"startprice":"100"}],"total_rec":4,"type":"tradehistory"}
Where we use the message subscribeonopen, subscribe (book, trade), subscribehighlow:
MARKET STATISTICS MAIN PAGE OF PORTAL
  • Portal -> Market
  • Portal -> Market -> Trade
TRADE HISTORY:
  • Portal -> Market -> Trade - Only Chart
  • AZ -> Market -> Daily Trade Summary Testing
ADDITIONAL
for assets (such as BTC, USD), there is summary of:
  • "totaldeposit"
  • "totalwithdraw"
  • "commamount"
For tradable symbols (such as pairs), there is summary of "high","low","open","close" and the corresponding time (which is in EPOCH milliseconds),"tradeqty" for total qty and "tradeamount" for total amount.
For assets (such as BTC, USD), there is summary of "totaldeposit","totalwithdraw", in addition to "commamount"
EXAMPLE OF STATISTICAL DATA QUERY
{"totaltrades":9,"totalwithdraws":0,"details":[{"totalwithdraw":"0","commamount":"0.00929954",
"security":"BTC","totaldeposit":"0"},{"totalwithdraw":"0","commamount":"57.33","security":"USD",
"totaldeposit":"0"},{"totalwithdraw":"0","highprice":"9500","openprice":"9250","openpricetime":1594100407327,
"security":"BTCUSD","tradeamount":"28673.63995859","lowprice":"9000","tradeqty":"3.09985704","totaldeposit":"0",
"lowpricetime":1594117449631,"closeprice":"9001","closepricetime":1594117752683,"highpricetime":1594100620114}],
"totaldeposits":0,"totalcommtrades":18}
TRADE SUMMARY QUERY
querytradesummary” can pass “date” or use “date” as filter.
ce":"45000","lowprice":"1","prevcloseprice":"176","type":"highlow"}
totaltrades” is total number of trades. “totalcommtrades” is total number of commission trades. If it is not 0, then “details” field will carry an array of total commission by symbols.
EXAMPLE OF COMMISSIONS TRADES
{"result":"OK","data":[{"details":[],"totaltrades":0,"totalcommtrades"
:0,"tabletype":"DailySummary","rec_no":1,"date":"20200630"},{"details":[],"total
trades":0,"totalcommtrades":0,"tabletype":"DailySummary","rec_no":2,"date":"2020
0629"}],"type":"querytradesummary","total_rec":2}
QUERY MULTI ORDERS
SAMPLE REQUEST MULTI ORDERS
{“type”:”querymultiorders”, “fromtime”:”1555522543000”}
This is to query the orders for a user. Only administrator can specify “userid” field.
  • “fromtime” field is optional, if set, it is to specify "cutofftime" to query
  • “security” field is optional, if set, it is to return trades for that security only.
SAMPLE RESPONSE MULTI ORDERS
{“result”:”OK”,”data”:[{“updtime”:”1562593041099”,”liveqty”:”0”,”refno
“:”5IF6Q7Y8LI8WA0”,”category”:”STAGE”,”execqty”:”0”,”price”:”100.59”,”side”:”B”,
“execamount”:”0”,”qty”:”100”,”rec_no”:1,”security”:”ZVZZT”,”type”:”order”},{“upd
time”:”1562593042339”,”liveqty”:”0”,”refno”:”5IF6Q7Y8LGPKA7”,”category”:”STAGE”,
“execqty”:”0”,”price”:”100.58”,”side”:”B”,”execamount”:”0”,”qty”:”100”,”rec_no”:
2,”security”:”ZVZZT”,”type”:”order”},{“updtime”:”1562593042339”,”liveqty”:”0”,”r
efno”:”5IF6Q7Y8LGPJA7”,”category”:”STAGE”,”execqty”:”0”,”price”:”100.57”,”side”:
“B”,”execamount”:”0”,”qty”:”100”,”rec_no”:3,”security”:”ZVZZT”,”type”:”order”},{
“updtime”:”1562593042339”,”liveqty”:”0”,”refno”:”5IF6Q7Y8LGPIA7”,”category”:”STA
GE”,”execqty”:”0”,”price”:”100.56”,”side”:”B”,”execamount”:”0”,”qty”:”100”,”rec_
no”:4,”security”:”ZVZZT”,”type”:”order”},{“updtime”:”1562593042339”,”liveqty”:”0
“,”refno”:”5IF6Q7Y8LGPHA7”,”category”:”STAGE”,”execqty”:”0”,”price”:”100.55”,”si
de”:”B”,”execamount”:”0”,”qty”:”100”,”rec_no”:5,”security”:”ZVZZT”,”type”:”order
“},{“updtime”:”1562593042339”,”liveqty”:”0”,”refno”:”5IF6Q7Y8LGPGA7”,”category”:
“STAGE”,”execqty”:”0”,”price”:”100.54”,”side”:”B”,”execamount”:”0”,”qty”:”100”,”
rec_no”:6,”security”:”ZVZZT”,”type”:”order”},{“updtime”:”1562593042339”,”liveqty
“:”0”,”refno”:”5IF6Q7Y8LGPFA7”,”category”:”STAGE”,”execqty”:”0”,”price”:”100.53”
,”side”:”B”,”execamount”:”0”,”qty”:”100”,”rec_no”:7,”security”:”ZVZZT”,”type”:”o
rder”},{“updtime”:”1562593042339”,”liveqty”:”0”,”refno”:”5IF6Q7Y8LGPEA7”,”catego
ry”:”STAGE”,”execqty”:”0”,”price”:”100.52”,”side”:”B”,”execamount”:”0”,”qty”:”10
0”,”rec_no”:8,”security”:”ZVZZT”,”type”:”order”},{“updtime”:”1562593042339”,”liv
eqty”:”0”,”refno”:”5IF6Q7Y8LGPDA7”,”category”:”STAGE”,”execqty”:”0”,”price”:”100
.51”,”side”:”B”,”execamount”:”0”,”qty”:”100”,”rec_no”:9,”security”:”ZVZZT”,”type
“:”order”},{“updtime”:”1562593042332”,”liveqty”:”0”,”refno”:”5IF6Q7Y8LGPCA7”,”ca
tegory”:”STAGE”,”execqty”:”0”,”price”:”100.5”,”side”:”B”,”execamount”:”0”,”qty”:
“100”,”rec_no”:10,”security”:”ZVZZT”,”type”:”order”}],”type”:”querymultiorders”,
“total_rec”:10}
QUERY/RETRY DIGITAL ASSET DEPOSIT
Only super user can use it.
  • “blockhash”, required, this is the blockchain hash from the blockchain deposit transaction “security”, required, corresponding crypto currency name.
SAMPLE REQUEST RETRY CRYPTO DEPOSIT
{““type”:”querymultiorders”}
SAMPLE RESPONSE RETRY CRYPTO DEPOSIT
{“amount”:”0.0001”,”result”:”OK”,”userid”:”BITTEST”,”blockhash”:”1c9a3
c059a17be3c6964e3be75ad05d34d44007c4536e7fa761c0f28dc6ce438”,”security”:”TBTC”,”
type”:”retrycryptodeposit”}
{“result”:”deposit already exist”,”blockhash”:”1c9a3c059a17be3c6964e3b
e75ad05d34d44007c4536e7fa761c0f28dc6ce438”,”security”:”TBTC”,”type”:”retrycrypto