Zaif
Spot trading on the Japanese exchange Zaif (API address https://api.zaif.jp). It uses REST only, with no market-data or order push. Private endpoints (/tapi) are signed with a Zaif API key (Access Key and Secret Key). The exchange has no K-line or all-market ticker endpoint, supports GTC limit orders only, and does not support conditional orders or order amendment.
Names and Configuration
exchange.GetName(): Zaif (Spot).
| Field | Required |
|---|---|
| Access Key | Yes |
| Secret Key | Yes |
Trading Pairs and Contract Codes
Pair examples: BTC_JPY, ETH_JPY
Trading pairs are written BASE_QUOTE, matching the Zaif native code btc_jpy. For pairs whose currency names contain . (such as the native polygon.mv_jpy), write the . in the currency name as -: POLYGON-MV_JPY; exchange.GetMarkets() and the account assets return currency names in the same form.
Function Support
Not supported (the call fails with an error and returns null): exchange.GetTickers, exchange.ModifyOrder, exchange.CreateConditionOrder, exchange.ModifyConditionOrder, exchange.CancelConditionOrder, exchange.GetConditionOrder, exchange.GetConditionOrders, exchange.GetHistoryConditionOrders.
Served through a fallback:
exchange.GetRecords: The exchange has no K-line endpoint; bars are synthesized by the docker from trades. The first call covers only the few bars spanned by recent trades, and more accumulate with later calls.exchange.GetOrder: The exchange has no single-order query interface, so the order is looked up among the current open orders and the historical orders. The historical orders are rebuilt from trade records whoseIdis not guaranteed to equal the order ID, so a completed order may not be found.
Notes
- Market orders are not supported, only GTC limit orders: a
tifofiocorfok, orpostOnly, fails. - Without the
symbolargument,exchange.GetOrders()queries the current trading pair only. The returned open orders carry no fill information, soDealAmountis 0. - Zaif has no order history endpoint, so
exchange.GetHistoryOrders()is rebuilt from the trade history (trade_history): each trade is returned as a filled order, withPriceandAvgPriceset to that trade's price,AmountandDealAmountset to that trade's amount, andTypeset to this account's side in the trade (the trade's aggressor side for self-trades). Trade records carry no order ID, so an order filled in several trades shows up as several rows that cannot be merged;Idis the trade record's number and is not guaranteed to equal the order ID returned when the order was placed; orders cancelled without any fill never appear, and an order cancelled after a partial fill shows only the filled part. Withoutlimit, at most 100 rows are returned;sinceis passed to the exchange with second precision, and with it the earliest records after that time are returned, without it the most recent ones. Withoutsymbol, regular pairs and token pairs (the exchange'sis_token) are queried once each and merged; the exchange allows at most 12 calls to this endpoint per 60 seconds. exchange.GetTicker()has no opening price (Openis 0), and the exchange gives no ticker time, soTimeis the local time.