zaifapi class : ActivePositions(string,string,string) method
Description
Gets a list of unfilled orders.
Syntax
zaifapiInstance.ActivePositions(string type, string groupId, string currencyPair)
Arguments
Class | Name | Description |
string | type | "margin" or "futures"。 |
string | groupId | A group identifier. |
string | currencyPair | A currency pair. |
Return value
Class | Description |
zaifres | A 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.ActivePositions("futures", "1", "btc_jpy"); |
5: | string jsonStr = zaifresIns.Result; |
Example for JSON-text
{"success": 1, "return": {"6185413": {"group_id": 1, "currency_pair": "btc_jpy", "action": "bid", "amount": 0.001, "price": 810000.0, "limit": 860000.0, "stop": 780000.0, "timestamp": "1558280346", "leverage": 5.0, "fee_spent": 0.0, "deposit_jpy": 176.14}}} |
{"success": 1, "return": {}} |
Notes
It is a trade API for the leverage transaction. You can not get the information if do not set the API key and the secret key.
It returns a list of unfilled orders for the margin transaction of the spot market if the type argument is specified the "margin". In this case, the groupId argument must be specified an empty string.
It returns a list of unfilled orders for the AirFX market if the type argument is specified the "futures". In this case, the groupId argument must be specified the "1".
It returns a list of unfilled orders for all currency pair if the currencyPair argument is specified an empty string. However, leverage transaction is effective only with the "btc_jpy", so it makes the same result as the "btc_jpy".
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.