zaifapi class : LastPrice(string) method

Description

Gets the closing price.

Syntax

zaifapiInstance.LastPrice(string currencyPair)

Arguments

ClassNameDescription
stringcurrencyPairA currency pair.

Return value

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

Sample code

1:

zaifapi zaifapiIns = new zaifapi();

2:

zaifres zaifresIns = zaifapiIns.LastPrice("btc_jpy");

3:

string jsonStr = zaifresIns.Result;

Example for JSON-text

{"last_price": 905965.0}

Notes

It is a public API for the spot transaction. You can get the information without setting the API key and the secret key.

If a valid currency pair is specified as an argument, the closing price on that currency pair 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.

{"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 © Cooker All rights reserved.