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

Must provide “security” and “refno” field (that is FI’s order refno).

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:

For tradable symbols (such as pairs), there is summary of:

  • "high"

  • "low"

  • "open"

  • "close"

CLOSE prevcloseprice

OPEN openingprice

PERCENT Change calc

LOW lowprice

The corresponding time (which is in EPOCH milliseconds),"tradeqty" for total qty and "tradeamount" for total amount.

SUBSCRIBEONOPEN

SUBSCRIBE

SUBCRIBEHIGHLOW

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

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

QUERY MULTI ORDERS

SAMPLE REQUEST MULTI ORDERS

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

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

SAMPLE RESPONSE RETRY CRYPTO DEPOSIT

LAST SALE HISTORY

This is to query the matched trades for a symbol.

SAMPLE REQUEST GET LAST SALE DATA

SAMPLE RESPONSE GET LAST SALE DATA

TRADE REPORTS

This is to query for trade reports if you have reporting enabled.

SAMPLE REQUEST TO SEE WHAT REPORTS ARE AVAILIBLE

SAMPLE RESPONSE TO SEE WHAT REPORTS ARE AVAILIBLE

SAMPLE REQUEST TO DOWNLOAD REPORT

SAMPLE RESPONSE TO DOWNLOAD REPORT

If "moredata" is true you need to concat the data reponses for the whole file

Javascript code to concat and get file:

Last updated

Was this helpful?