交易所 API 概要
交易所API大致分为两个。无需验证的公共 API以及需要验证的 私有 API。
公共 API 可以参考交易所的订单状况、公开的交易记录、交易版信息。
私有 API 可以确认交易所的新订单及其取消、个人余额等信息。
请求URL
https://coincheck.com
验证
使用私有 API 需要验证。这里是关于验证方法的说明。
创建API密钥
首先,必须创建API密钥。通过API密钥创建。
这里生产的访问键、秘密访问密钥不可对外公开。
使用密钥创建请求。
权限设置
此外,生成密钥时,可以设置各功能的权限。
也可以设置为允许任何IP地址使用。

创建请求
验证的请求,需要将下面的信息包含在 HTTP Header 中。
- ACCESS-KEY 使用API密钥 创建的访问键
- ACCESS-NONCE 每个请求需要增加正整数。通常使用UNIX时间戳。最大值为9223372036854775807 。按API密钥进行管理。
- ACCESS-SIGNATURE 将在后面描述SIGNATURE
创建SIGNATURE
SIGNATURE是将ACCESS-NONCE, 请求方URL, 请求主体 转换成一连串的文字列,使用HMAC-SHA256 哈希格式的密钥署名的结果。
Ruby
require "openssl" nonce = Time.now.to_i.to_s url = "https://coincheck.com/api/accounts/balance" body = "hoge=foo" message = nonce + url + body secret = "API_SECRET" OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), secret, message) # => "3919705fea4b0cd073b9c6e01e139f3b056782c57c5cffd5aea6d8c4ac98bef7"
PHP
$strUrl = "https://coincheck.com/api/accounts/balance"; $intNonce = time(); $arrQuery = array("hoge" => "foo"); $strAccessSecret = "API_SECRET"; $strMessage = $intNonce . $strUrl . http_build_query($arrQuery); $strSignature = hash_hmac("sha256", $strMessage, $strAccessSecret); # => "3bc1f33d802056c61ba8c8108f6ffb7527bcd184461a3ea0fed3cee0a22ae15d"
请求例
Ruby
require 'net/http' require 'uri' require 'openssl' key = "API_KEY" secret = "API_SECRET" uri = URI.parse "https://coincheck.com/api/accounts/balance" nonce = Time.now.to_i.to_s message = nonce + uri.to_s signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), secret, message) headers = { "ACCESS-KEY" => key, "ACCESS-NONCE" => nonce, "ACCESS-SIGNATURE" => signature } https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true response = https.start { https.get(uri.request_uri, headers) } puts response.body
Java
import com.google.api.client.http.*; import com.google.api.client.http.apache.ApacheHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import org.apache.commons.codec.binary.Hex; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; public class CoincheckApi { private String apiKey; private String apiSecret; public static void main(String[] args) { String key = "API_KEY"; String secret = "API_SECRET"; CoincheckApi api = new CoincheckApi(key, secret); System.out.println(api.getTicker()); System.out.println(api.getBalance()); } public CoincheckApi(String apiKey, String apiSecret) { this.apiKey = apiKey; this.apiSecret = apiSecret; } public String getTicker() { String url = "https://coincheck.com/api/accounts/ticker"; String jsonString = requestByUrlWithHeader(url, createHeader(url)); return jsonString; } public String getBalance() { String url = "https://coincheck.com/api/accounts/balance"; String jsonString = requestByUrlWithHeader(url, createHeader(url)); return jsonString; } private Map<String, String> createHeader(String url) { Map<String, String> map = new HashMap<String, String>(); String nonce = createNonce(); map.put("ACCESS-KEY", apiKey); map.put("ACCESS-NONCE", nonce); map.put("ACCESS-SIGNATURE", createSignature(apiSecret, url, nonce)); return map; } private String createSignature(String apiSecret, String url, String nonce) { String message = nonce + url; return HMAC_SHA256Encode(apiSecret, message); } private String createNonce() { long currentUnixTime = System.currentTimeMillis() / 1000L; String nonce = String.valueOf(currentUnixTime); return nonce; } private String requestByUrlWithHeader(String url, final Map<String, String> headers){ ApacheHttpTransport transport = new ApacheHttpTransport(); HttpRequestFactory factory = transport.createRequestFactory(new HttpRequestInitializer() { public void initialize(final HttpRequest request) throws IOException { request.setConnectTimeout(0); request.setReadTimeout(0); request.setParser(new JacksonFactory().createJsonObjectParser()); final HttpHeaders httpHeaders = new HttpHeaders(); for (Map.Entry<String, String> e : headers.entrySet()) { httpHeaders.set(e.getKey(), e.getValue()); } request.setHeaders(httpHeaders); } }); String jsonString; try { HttpRequest request = factory.buildGetRequest(new GenericUrl(url)); HttpResponse response = request.execute(); jsonString = response.parseAsString(); } catch (IOException e) { e.printStackTrace(); jsonString = null; } return jsonString; } public static String HMAC_SHA256Encode(String secretKey, String message) { SecretKeySpec keySpec = new SecretKeySpec( secretKey.getBytes(), "hmacSHA256"); Mac mac = null; try { mac = Mac.getInstance("hmacSHA256"); mac.init(keySpec); } catch (NoSuchAlgorithmException e) { // can't recover throw new RuntimeException(e); } catch (InvalidKeyException e) { // can't recover throw new RuntimeException(e); } byte[] rawHmac = mac.doFinal(message.getBytes()); return Hex.encodeHexString(rawHmac); } }
程序库
使用coincheck的API开发,分配面向各编程语言的程序库。
Ruby
在命令行中运行一下命令,
$ gem install ruby_coincheck_client
Bundler环境下,在Gemfile中按照下面的描述使用。
gem 'ruby_coincheck_client'
可以从GitHub下载gem文件
coincheckjp/ruby_coincheck_client
PHP
在composer.json 中定义包。
{ "require": { "coincheck/coincheck": "1.0.0" } }
安装。
$ composer install
可以从GitHub下载包。
Scala
val key = "YOUR-KEY-HERE" val secret = "YOUR-SECRET-HERE" import net.pocketengineer.coincheckscala.CoinCheckApiService import net.pocketengineer.coincheckscala.model._ val cc = new CoinCheckApiService(key, secret) // Ticker val ticker: Ticker = cc.getTicker // OrderBook val orderBook: OrderBook = cc.getOrderBook // Account Info val balance: Balance = cc.getAccountInfo // Trade val orderId: Long = cc.tradeBtc(28400, 0.01F, BUY) // OpenOrder val openOrders: List[OpenOrder] = cc.getOpenOrder // Cancel Order val isSuccess: Boolean = cc.cancelOrder(ORDER_ID)
Build
sbt assembly
分页
coincheck的一些API分页,可以通过分割数据获得。
PARAMETERS
- limit 可以指定每页取得的件数。
- order 可以指定"desc", "asc" 。
- starting_after 如果指定ID,您可以设置缩小范围的列表起始位置。
- ending_before 如果指定ID,您可以设置缩小范围的列表结束位置。
{"success":true,"pagination":{"limit":1,"order":"desc","starting_after":null,"ending_before":null},"data":[{"id":10,"pair":"btc_jpy","status":"open","created_at":"2015-12-02T05:27:53.000Z","closed_at":null,"open_rate":"43553.0","closed_rate":null,"amount":"1.51347797","all_amount":"1.51045705","side":"sell","pl":"-8490.81029287","new_order":{"id":23104033,"side":"sell","rate":null,"amount":null,"pending_amount":"0","status":"complete","created_at":"2015-12-02T05:27:52.000Z"},"close_orders":[{"id":23755132,"side":"buy","rate":"10000.0","amount":"1.0","pending_amount":"0.0","status":"cancel","created_at":"2015-12-05T05:03:56.000Z"}]}]}
公共 API
可以参考交易所的订单状况、公开的交易记录、板信息。
报价
可以简便地获得各种最新信息。
如果不指定pair的情况下,将会取得btc_jpy的信息。
HTTP REQUEST
GET /api/ticker
PARAMETERS
- pair 货币对。当前可选 btc_jpy, etc_jpy, lsk_jpy, mona_jpy, omg_jpy, plt_jpy, fnct_jpy 。
{"last":27390,"bid":26900,"ask":27390,"high":27659,"low":26400,"volume":"50.29627103","timestamp":1423377841}
RESPONSE ITEMS
- last 最终交易价格
- bid 当前买入订单的最高价格
- ask 当前卖出订单的最高价格
- high 24小时内的最高交易价格
- low 24小时内的最低交易价格
- volume 24小时的交易量
- timestamp 当前时间
全部交易记录
取得最近交易记录。
HTTP REQUEST
GET /api/trades
PARAMETERS
- *pair 货币对。当前可选 btc_jpy, etc_jpy, lsk_jpy, mona_jpy, omg_jpy, plt_jpy, fnct_jpy。
{"success":true,"pagination":{"limit":1,"order":"desc","starting_after":null,"ending_before":null},"data":[{"id":82,"amount":"0.28391","rate":"35400.0","pair":"btc_jpy","order_type":"sell","created_at":"2015-01-10T05:55:38.000Z"},{"id":81,"amount":"0.1","rate":"36120.0","pair":"btc_jpy","order_type":"buy","created_at":"2015-01-09T15:25:13.000Z"}]}
板信息
获得板信息。
HTTP REQUEST
GET /api/order_books
{"asks":[[27330,"2.25"],[27340,"0.45"]],"bids":[[27240,"1.1543"],[26800,"1.2226"]]}
RESPONSE ITEMS
- asks 卖出订单信息
- bids 买入订单信息
汇率计算
依据交易所的订单计算汇率。
HTTP REQUEST
GET /api/exchange/orders/rate
PARAMETERS
- *order_type 订单类型("sell" or "buy")
- *pair 货币对。当前可选 btc_jpy, etc_jpy, lsk_jpy, mona_jpy, omg_jpy, plt_jpy, fnct_jpy。
- amount 订单量。(例)0.1
- price 订单金额。(例)28000
- ※ price或amount必须被指定为参数。
{"success":true,"rate": 60000, "price": 60000, "amount": 1.0}
RESPONSE ITEMS
- rate 订单率
- price 订单金额
- amount 订单量
获取参考利率
获得参考利率。
HTTP REQUEST
GET /api/rate/[pair]
PARAMETERS
- *pair 货币对 (例如 "btc_jpy" )
{"rate": "60000"}
RESPONSE ITEMS
- rate 汇率
私有 API
可以确认交易所的新订单及其取消、您的余额等。
订单
您可以使用交易所订单相关的API。
新订单
向交易所发布新交易。
例如、想使用 30000 JPY/BTC 购买10 BTC时,请按照下述内容指定。
rate: 30000, amount: 10, order_type: "buy", pair: "btc_jpy"
买入订单时,如果已经存在低于指定价格的卖出订单,则按卖出订单价格从低到高结算。卖出订单不足时,将保留为未结算订单。卖出订单同理。
关于接口的访问限制
向交易所提交订单的接口的访问限制是5次/1秒。
如果超过5次/1秒的访问限制,接口将会返回429:too_many_requests的异常。
对于任意的虚拟货币都采用统一访问限制,不会根据交易货币的不同而改变。
请注意,Coincheck会根据系统的负载对上述访问限制进行调整。
如何订购
共有4种order_type 。
- "buy" 限价订单 现金交易 买入
- "sell" 限价订单 现金交易 売り
- "market_buy" 时价订单 现金交易 买入
- "market_sell" 时价订单 现金交易 卖出
"buy"
限价订单 现金交易 买入
- *rate 订单率。(例)28000
- *amount 订单量。(例)0.1
"sell"
限价订单 现金交易 売り
- *rate 订单率。(例)28000
- *amount 订单量。(例)0.1
"market_buy"
时价订单 现金交易 买入
买入的时价订单需要发送使用的日元数量。
- *market_buy_amount 时价买入时使用的日元金额。(例)10000
"market_sell"
时价订单 现金交易 卖出
- *amount 订单量。(例)0.1
HTTP REQUEST
POST /api/exchange/orders
PARAMETERS
- *pair 货币对。当前可选 btc_jpy, etc_jpy, lsk_jpy, mona_jpy, omg_jpy, plt_jpy, fnct_jpy 。
- *order_type 订购方法
- rate 订单率。(例)28000
- amount 订单量。(例)0.1
- market_buy_amount 时价买入时使用的日元金额。(例)10000
- stop_loss_rate 止损率 ( 何为止损率? )
- time_in_force Time In Force(optional)。"good_til_cancelled"(the order will last until it is completed or you cancel it. default action) or "post_only"(the order will exist as a maker order on the order book, but never match with orders that are already on the book)
{"success": true, "id": 12345, "rate": "30010.0", "amount": "1.3", "order_type": "sell", "time_in_force": "good_til_cancelled", "stop_loss_rate": null, "pair": "btc_jpy", "created_at": "2015-01-10T05:55:38.000Z"}
RESPONSE ITEMS
- id 新订单的ID
- rate 订单率
- amount 订单量
- order_type 订购方法
- time_in_force Time In Force
- stop_loss_rate 止损率
- pair 货币对
- created_at 订单创建时间
未结算的订单列表
在列表中显示账户未结算的订单。
HTTP REQUEST
GET /api/exchange/orders/opens
{"success":true,"orders":[{"id":202835,"order_type":"buy","rate":26890,"pair":"btc_jpy","pending_amount":"0.5527", "pending_market_buy_amount": null,"stop_loss_rate": null, "created_at": "2015-01-10T05:55:38.000Z"},{"id":202836,"order_type":"sell","rate":26990,"pair":"btc_jpy","pending_amount":"0.77", "pending_market_buy_amount": null,"stop_loss_rate": null, "created_at": "2015-01-10T05:55:38.000Z"},{"id":38632107,"order_type":"buy","rate":null,"pair":"btc_jpy","pending_amount":null,"pending_market_buy_amount": "10000.0", "stop_loss_rate":"50000.0","created_at":"2016-02-23T12:14:50.000Z"}]}
RESPONSE ITEMS
- id 订单ID(与新订单的ID相同)
- rate 订单率( null 时,默认为时价订单)
- pending_amount 订单的未结算量
- pending_market_buy_amount 订单的未结算量(仅限现金时价买入时)
- order_type 订单类型("sell" or "buy")
- stop_loss_rate 止损率
- pair 货币对
- created_at 订单创建日期
取消订单
HTTP REQUEST
DELETE /api/exchange/orders/[id]
PARAMETERS
{"success": true, "id": 12345}
RESPONSE ITEMS
- id 已取消订单的ID
订单取消状态
You can refer to the cancellation processing status of the order.
HTTP REQUEST
GET /api/exchange/orders/cancel_status?id=[id]
PARAMETERS
- *id New Order Or, you can cancel by specifyingunsettle order list's ID.
{"success": true, "id": 12345, "cancel": true, "created_at": "2020-07-29T17:09:33.000Z"}
RESPONSE ITEMS
- id Order ID
- cancel Canceled(true or false)
- created_at Ordered time
交易记录
可以参考您的最新交易记录。
HTTP REQUEST
GET /api/exchange/orders/transactions
{"success":true,"transactions":[{"id":38,"order_id":49,"created_at":"2015-11-18T07:02:21.000Z","funds":{"btc":"0.1","jpy":"-4096.135"},"pair":"btc_jpy","rate":"40900.0","fee_currency":"JPY","fee":"6.135","liquidity":"T","side":"buy"},{"id":37,"order_id":48,"created_at":"2015-11-18T07:02:21.000Z","funds":{"btc":"-0.1","jpy":"4094.09"},"pair":"btc_jpy","rate":"40900.0","fee_currency":"JPY","fee":"-4.09","liquidity":"M","side":"sell"}]}
RESPONSE ITEMS
- id ID
- order_id 订单ID
- created_at 交易创建时间
- funds 各余额增减量
- pair 货币对
- rate 成交价格
- fee_currency 手续费的货币
- fee 产生的手续费
- liquidity "T" ( Taker ) or "M" ( Maker )
- side "sell" or "buy"
交易记录(分页)
可以参考您的最新交易记录。
HTTP REQUEST
GET /api/exchange/orders/transactions_pagination
{"success":true,"pagination":{"limit":1,"order":"desc","starting_after":null,"ending_before":null},"data":[{"id":38,"order_id":49,"created_at":"2015-11-18T07:02:21.000Z","funds":{"btc":"0.1","jpy":"-4096.135"},"pair":"btc_jpy","rate":"40900.0","fee_currency":"JPY","fee":"6.135","liquidity":"T","side":"buy"},{"id":37,"order_id":48,"created_at":"2015-11-18T07:02:21.000Z","funds":{"btc":"-0.1","jpy":"4094.09"},"pair":"btc_jpy","rate":"40900.0","fee_currency":"JPY","fee":"-4.09","liquidity":"M","side":"sell"}]}
RESPONSE ITEMS
- id ID
- order_id 订单ID
- created_at 交易创建时间
- funds 各余额增减量
- pair 货币对
- rate 成交价格
- fee_currency 手续费的货币
- fee 产生的手续费
- liquidity "T" ( Taker ) or "M" ( Maker )
- side "sell" or "buy"
账户
可以取得个人账户的余额及各种信息。
余额
确认账户余额。
jpy, btc 中不包含未结算订单文使用的 jpy_reserved, btc_reserved。
HTTP REQUEST
GET /api/accounts/balance
{"success": true, "jpy": "0.8401", "btc": "7.75052654", "jpy_reserved": "3000.0", "btc_reserved": "3.5002", "jpy_lend_in_use": "0", "btc_lend_in_use": "0.3", "jpy_lent": "0", "btc_lent": "1.2", "jpy_debt": "0", "btc_debt": "0"}
RESPONSE ITEMS
- jpy 日元余额
- btc 比特币余额
- jpy_reserved 未结算的买入订单中使用的日元总和
- btc_reserved 未结算的卖出订单中使用的比特币总和
- jpy_lend_in_use 借贷申请中的日元总和(当前不提供日元借贷功能)
- btc_lend_in_use 借贷申请中的比特币总和(当前不提供比特币借贷功能)
- jpy_lent 借贷的日元总和(当前不提供日元借贷功能)
- btc_lent 借贷的比特币总和(当前不提供比特币借贷功能)
- jpy_debt 借入日元总和
- btc_debt 借入比特币总和
汇出比特币
将比特币发送至指定地址。
HTTP REQUEST
POST /api/send_money
PARAMETERS
- *remittee_list_id RemitteeList Id sending to
- *amount 发送比特币数量
- *purpose_type Purpose Type
- purpose_details Purpose Details
{"remittee_list_id": 12345, "amount": "0.000001", "purpose_type": "payment_of_importing", "purpose_details": { "specific_items_of_goods": "食料品", "place_of_origin": "カナダ", "place_of_loading": "アメリカ" }}
PURPOSE TYPES
The following is a list of keys that can be specified for purpose_type. Depending on the value of purpose_type, it may be necessary to specify detailed information in object format in purpose_details.
- vasp_service_usage Use of a crypto asset marketplace and exchange service
- payment_of_goods Settlement of payment of goods within the country
- inheritance_or_donating Inheritance, gift of living expenses
-
payment_of_importing
Settlement of Import Payments
- Additional fields that need to be specified in purpose_details.
-
- *specific_items_of_goods Specific Items of Goods
- *place_of_origin Place of Origin
- *place_of_loading Place of Loading
-
payment_of_intermediary_trade
Settlement of Intermediary Trade Payments
- Additional fields that need to be specified in purpose_details.
-
- *specific_items_of_goods Specific Items of Goods
- *place_of_origin Place of Origin
- *place_of_loading Place of Loading
- *place_of_destination Place of Destination
-
other
Other
- Additional fields that need to be specified in purpose_details.
-
- *extra_text Specific Purpose of the Transfer
{"success": true, "id": "276", "address": "1v6zFvyNPgdRvhUufkRoTtgyiw1xigncc", "amount": "1.5", "fee": "0.002"}
RESPONSE ITEMS
- id 汇款ID
- address 收取方的比特币地址
- amount 发送的比特币数量
- fee 手续费
汇出记录
比特币的汇出记录
HTTP REQUEST
GET /api/send_money
PARAMETERS
- *currency 货币(当前仅支持 BTC )
{"success": true, "sends": [{ "id": 2, "amount": "0.05", "currency": "BTC", "fee": "0.0", "address": "13PhzoK8me3u5nHzzFD85qT9RqEWR9M4Ty", "created_at": "2015-06-13T08:25:20.000Z" }, { "id": 1, "amount": "0.05", "currency": "BTC", "fee": "0.0001", "address": "118ekvRwx6uc4241jkuQt5eYvLiuWdMW2", "created_at": "2015-06-13T08:21:18.000Z" }] }
RESPONSE ITEMS
- id 汇款ID
- amount 发送的比特币数量
- fee 手续费
- currency 货币
- address 收取方的比特币地址
- created_at 汇款处理的创建日期
接收记录
比特币的接收记录。
HTTP REQUEST
GET /api/deposit_money
PARAMETERS
- *currency 货币(当前仅支持 BTC )
{"success": true, "deposits": [{ "id": 2, "amount": "0.05", "currency": "BTC", "address": "13PhzoK8me3u5nHzzFD85qT9RqEWR9M4Ty", "status": "confirmed", "confirmed_at": "2015-06-13T08:29:18.000Z", "created_at": "2015-06-13T08:22:18.000Z" }, { "id": 1, "amount": "0.01", "currency": "BTC", "address": "13PhzoK8me3u5nHzzFD85qT9RqEWR9M4Ty", "status": "received", "confirmed_at": "2015-06-13T08:21:18.000Z", "created_at": "2015-06-13T08:21:18.000Z" }] }
RESPONSE ITEMS
- id 接收ID
- amount 接收的比特币数量
- currency 货币
- address 接收方的比特币地址
- status 状态
- confirmed_at 接收的批准日期
- created_at 接收处理的创建日期
账户信息
显示账户信息。
HTTP REQUEST
GET /api/accounts
{ "success": true, "id": 10000, "email": "test@gmail.com", "identity_status": "identity_pending", "bitcoin_address": "1v6zFvyNPgdRvhUufkRoTtgyiw1xigncc", "taker_fee": "0.15", "maker_fee": "0.0", "exchange_fees": { "btc_jpy": { "maker_fee_rate": "0.0", "taker_fee_rate": "0.0" }, "etc_jpy": { "maker_fee_rate": "0.05", "taker_fee_rate": "0.1" }, "lsk_jpy": { "maker_fee_rate": "0.0", "taker_fee_rate": "0.0" }, "mona_jpy": { "maker_fee_rate": "0.0", "taker_fee_rate": "0.0" }, "omg_jpy": { "maker_fee_rate": "0.0", "taker_fee_rate": "0.0" }, "plt_jpy": { "maker_fee_rate": "0.05", "taker_fee_rate": "0.1" }, "fnct_jpy": { "maker_fee_rate": "0.0", "taker_fee_rate": "0.0" } } }
RESPONSE ITEMS
- id 账户ID。与日元付款时指定的ID一致。
- email 注册的电子邮件地址
- identity_status 显示本人身份验证资料的提交状态。
- bitcoin_address 您的存款用比特币地址
- taker_fee 显示作为Taker下订单时的手续费率(%)。(BTC_JPY)
- maker_fee 显示作为Maker下订单时的手续费率(%)。(BTC_JPY)
- exchange_fees 显示每个板的费用。
提取日元
可以通过银行转账提取日元。
银行账户列表
返回客户取款用的注册的银行账户列表。
HTTP REQUEST
GET /api/bank_accounts
{"success":true,"data":[{"id":243,"bank_name":"みずほ","branch_name":"東京営業部","bank_account_type":"futsu","number":"0123456","name":"タナカ タロウ"}]}
RESPONSE ITEMS
- id ID
- bank_name 银行名
- branch_name 支行名
- bank_account_type 银行账户类型(futsu : 普通账户, toza : 活期存款账户)
- number 账号
- name 账户名
注册银行账户
注册取款的银行账户。
HTTP REQUEST
POST /api/bank_accounts
PARAMETERS
- *bank_name 银行
- *branch_name 支行名
- *bank_account_type 银行账户类型(futsu : 普通账户, toza : 活期存款账户)
- *number 账号(例)"0123456"
- *name 账户名
{"success":true,"data":{"id":641,"bank_name":"熊本","branch_name":"田中","bank_account_type":"futsu","number":"0123456","name":"hoge"}}
RESPONSE ITEMS
- id ID
- bank_name 银行
- branch_name 支行名
- bank_account_type 银行账户类型(futsu : 普通账户, toza : 活期存款账户)
- number 账号(例)"0123456"
- name 账户名
删除银行账户
删除取款的银行账户。
HTTP REQUEST
DELETE /api/bank_accounts/[id]
PARAMETERS
- *id 银行账户列表のID
{"success":true}
提款记录
显示日元提款申请的记录。
HTTP REQUEST
GET /api/withdraws
{"success":true,"pagination":{"limit":25,"order":"desc","starting_after":null,"ending_before":null},"data":[{"id":398,"status":"finished","amount":"242742.0","currency":"JPY","created_at":"2014-12-04T15:00:00.000Z","bank_account_id":243,"fee":"400.0", "is_fast": true}]}
RESPONSE ITEMS
- id ID
- status 提款状态 ( pending 未处理, processing 手续中, finished 完成, canceled 已取消)
- amount 金额
- currency 货币
- created_at 创建日期
- bank_account_id 银行账户のID
- fee 转账手续费
- is_fast 快速提款选项.目前已停止
创建提款申请
申请日元提款。
HTTP REQUEST
POST /api/withdraws
PARAMETERS
- *bank_account_id 银行账户的ID
- *amount 金额
- *currency 货币 ( 当前仅支持 "JPY" )
{"success":true,"data":{"id":1043,"status":"pending","amount":"10000.0","currency":"JPY","created_at":"2015-08-31T11:32:45.213Z","bank_account_id":243,"fee":"300.0"}}
RESPONSE ITEMS
- id ID
- status 提款状态 ( pending 未处理, processing 手续中, finished 完成, canceled 已取消)
- amount 金额
- currency 货币 ( 当前仅支持 "JPY" )
- created_at 创建日期
- bank_account_id 银行账户的ID
- fee 转账手续费
取消提款申请
取消提款申请。
只能取消status 为 pending 的提款申请。
HTTP REQUEST
DELETE /api/withdraws/[id]
PARAMETERS
- *id 提款申请的ID
{"success":true}
WebSocket API β版
WebSocket API在HTTP通信很难实现,实时交流相对容易,可以取得交易所公开的交易记录、板信息。
WebSocket API为β版,可能存在式样变化或操作不稳定的情况。此外,当前可选的货币对有btc_jpy, etc_jpy, lsk_jpy, mona_jpy, omg_jpy, plt_jpy, fnct_jpy。(截止2020/09/30)
概要
WebSocket 连接
wss://ws-api.coincheck.com/
Subscribe
开始接收信息,首先需要向服务器发送订阅请求。该请求必须是JSON编码。
测试方法
//JavaScript
//Chrome环境下执行
socket = new WebSocket("wss://ws-api.coincheck.com/")
socket.send(JSON.stringify({type: "subscribe", channel: "btc_jpy-orderbook"}))
socket.send(JSON.stringify({type: "subscribe", channel: "btc_jpy-trades"}))
公共频道
公共频道是无需验证的频道。
交易记录
以0.1秒的间隔,推送发生的所有交易记录。
REQUEST ITEMS
{"type":"subscribe","channel":"[pair]-trades"}
RESPONSE ITEMS
["成交时间 (unix 时间戳)", "成交 ID","交易对","成交价格","成交量","订单类型","Taker的订单ID","Maker的订单ID"]
※ 只推送吃单情報。
REQUEST EXAMPLE
{"type":"subscribe","channel":"btc_jpy-trades"}
RESPONSE EXAMPLES
※ 以2次元配列的形式来推送
[["1663318663","2357062","btc_jpy","2820896.0","5.0","sell","1193401","2078767"],["1663318892","2357068","btc_jpy","2820357.0","0.7828","buy","4456513","8046665"]]
交易板
定期发送板信息的差值。
REQUEST ITEMS
{"type":"subscribe", "channel":"[pair]-orderbook"}
RESPONSE ITEMS
["[pair]",{"bids":[["订单价格","订单量"],["订单价格","订单量"]],"asks":[["订单价格","订单量"],["订单价格","订单量"]], "last_update_at": "事件时间 (unix 时间戳)"}]
※ “bids”是买单情报,“asks”是卖单情报。
REQUEST EXAMPLE
{"type":"subscribe", "channel":"btc_jpy-orderbook"}
RESPONSE EXAMPLES
["btc_jpy",{"bids":[["148634.0","0.12"],["148633.0","0.0574"]],"asks":[["148834.0","0.0812"],["148833.0","1.0581"]],"last_update_at":"1659321701"}]