Home News DOC Class DL Others Rice
Class  >  zaifapi  >  TradeHistory(int,string)
zaifapi class : TradeHistory(int,string) method

Description

Gets personal trade history.

Syntax

zaifapiInstance.TradeHistory(int count, string currencyPair)

Arguments

ClassNameDescription
intcountA number of records to retrieve.
stringcurrencyPairA currency pair.

Return value

ClassDescription
zaifresA response to the request which have a JSON-text.

Sample code

1:

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

2:

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

3:

zaifapi zaifapiIns = new zaifapi(apiKey, secretKey);

4:

zaifres zaifresIns = zaifapiIns.TradeHistory(2, "btc_jpy");

5:

string jsonStr = zaifresIns.Result;

Example for JSON-text

{"success": 1, "return": {"138689610": {"currency_pair": "btc_jpy", "action": "bid", "amount": 0.1234, "price": 495505.0, "fee": 0, "fee_amount": 0, "your_action": "ask", "bonus": null, "timestamp": "1550151405", "comment": ""}, "137697013": {"currency_pair": "btc_jpy", "action": "bid", "amount": 0.5234, "price": 495400.0, "fee": 0.0, "fee_amount": 0.0, "your_action": "bid", "bonus": null, "timestamp": "1550978545", "comment": ""}}}

Notes

It is a trade API for the spot transaction. You can not get the information if do not set the API key and the secret key.

If count argument is set not greater than 0, returns up to 1000 record.

If an empty string is set for the currencyPair argument, the trade history of "btc_jpy", "mona_jpy", "mona_btc", "xem_jpy", and "xem_btc" is returned.

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

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

{"success": 0, "error": "..."}

"error" is different for each API 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 will be returned.

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

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 © Rice All rights reserved.