bitbankapi class : TradeHistory(string,long,long,long,long,string) method

Description

Gets trade history.

Syntax

bitbankapiInstance.TradeHistory(string currencyPair, long count, long orderId, long since, long end, string order)

Arguments

ClassNameDescription
stringcurrencyPairCurrency pair.
longcountAmount to get.
longorderIdOrder id.
longsinceUNIX timestamp to start getting.
longendUNIX timestamp to end getting.
stringorderSort order. "asc" or "desc"

Return value

ClassDescription
bitbankresResponse to request, with JSON-text.

Sample code

1:

string apiKey = "3622c294-zs5m-587w-vv7j-sdf454h1sdbl";

2:

string secretKey = "4be789k3-dd7r-9d23-jy45-qng4c83hjk1g";

3:

bitbankapi bitbankapiIns = new bitbankapi(apiKey, secretKey);

4:

bitbankres bitbankresIns = bitbankapiIns.TradeHistory("btc_jpy", 10L, 0L, 0L, 0L, "");

5:

string jsonStr = bitbankresIns.Result;

Example for JSON-text

{"success":1,"data":{"trades":[{"trade_id":23286271,"order_id":411169732,"pair":"btc_jpy","side":"buy","type":"market","amount":"0.0018","price":"790699","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1527541825000},{"trade_id":23286089,"order_id":411169354,"pair":"btc_jpy","side":"buy","type":"market","amount":"0.0040","price":"791861","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1527541772000},{"trade_id":23286087,"order_id":411169354,"pair":"btc_jpy","side":"buy","type":"market","amount":"0.0010","price":"791836","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1527541772000},{"trade_id":23285969,"order_id":411169026,"pair":"btc_jpy","side":"buy","type":"market","amount":"0.0250","price":"791871","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1527541724000},{"trade_id":22274881,"order_id":407381911,"pair":"btc_jpy","side":"sell","type":"market","amount":"0.0061","price":"917738","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526989518000},{"trade_id":22274879,"order_id":407381911,"pair":"btc_jpy","side":"sell","type":"market","amount":"0.0100","price":"917739","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526989518000},{"trade_id":22274877,"order_id":407381911,"pair":"btc_jpy","side":"sell","type":"market","amount":"0.0013","price":"917740","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526989518000},{"trade_id":22274875,"order_id":407381911,"pair":"btc_jpy","side":"sell","type":"market","amount":"0.0013","price":"917865","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526989518000},{"trade_id":22274873,"order_id":407381911,"pair":"btc_jpy","side":"sell","type":"market","amount":"0.0013","price":"917865","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526989518000},{"trade_id":22274137,"order_id":407377888,"pair":"btc_jpy","side":"buy","type":"market","amount":"0.0200","price":"916255","maker_taker":"taker","fee_amount_base":"0.00000000","fee_amount_quote":"0.0000","executed_at":1526988919000}]}}

Notes

Private API. API key and secret key are necessary.

Valid first argument : btc_jpy, xrp_jpy, ltc_btc, eth_btc, mona_jpy, mona_btc, bcc_jpy, bcc_btc

To get all trade history for the currency pair, specify a number less than or equal to zero for the second argument.

If any argument from the third to fifth is unnecessary, specify a number less than or equal to zero, and the argument will be ignored.

The sixth argument specifies the sorted order of the trade history in the JSON-text. the trade history is sorted with UNIX timestamp. Please specify "asc" (ascending order) or "desc" (descending order). If not required, please specify an empty string and it will be ignored. In that case, the order is descending ("desc": default value).

An instance of the bitbankres class is returned as the response to the request. This instance holds the JSON-text of the result of the response.

If the argument is incorrect, the following JSON-text will be returned.

{"success":0,"data":{"code":xxxxx}}

The "code" is a different number for each error.

If an HTTP error occurs, the following JSON-text will be returned.

{"success": -1000,"error": { "statuscode" : 404, "message": "Not Found"}}

"statuscode" and "message" are different for each HTTP error.

If the request times out, the following JSON-text is returned.

{"success": -1001,"error": { "typename" : "TaskCanceledException", "message": "A task was cancelled."}}

If the request fails due to other exceptions, the following JSON-text will be returned.

{"success": -1002,"error": { "typename" : "...", "message": "..."}}

"typename" and "message" are different for each exception.

Links for reference

Copyright © Cooker All rights reserved.