交易所 API 概要

交易所API大致分为两个。无需验证的公共 API以及需要验证的 私有 API

公共 API 可以参考交易所的订单状况、公开的交易记录、交易版信息。

私有 API 可以确认交易所的新订单及其取消、个人余额等信息。

请求URL

https://coincheck.com

验证

使用私有 API 需要验证。这里是关于验证方法的说明。

创建API密钥

首先,必须创建API密钥。通过API密钥创建。

这里生产的访问键、秘密访问密钥不可对外公开。

使用密钥创建请求。

权限设置

此外,生成密钥时,可以设置各功能的权限。

也可以设置为允许任何IP地址使用。

APIパーミッション設定のイメージ
API权限设置

创建请求

验证的请求,需要将下面的信息包含在 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 createHeader(String url) {
        Map map = new HashMap();
        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 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 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下载包。

 coincheckjp/coincheck-php

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

 dsaki/CoinCheckScala

分页

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

可以参考交易所的订单状况、公开的交易记录、板信息。

报价

可以简便地获得各种最新信息。

HTTP REQUEST

GET /api/ticker

{"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"
{"success":true,"pagination":{"limit":1,"order":"desc","starting_after":null,"ending_before":null},"data":[{"id":82,"amount":"0.28391","rate":35400,"pair":"btc_jpy","order_type":"sell","created_at":"2015-01-10T05:55:38.000Z"},{"id":81,"amount":"0.1","rate":36120,"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"
  • 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 货币对
{"rate": "60000"}

RESPONSE ITEMS

  • rate 汇率

私有 API

可以确认交易所的新订单及其取消、您的余额等。

订单

您可以使用交易所订单相关的API。

新订单

向交易所发布新交易。

例如、想使用 30000 JPY/BTC 购买10 BTC时,请按照下述内容指定。
rate: 30000, amount: 10, order_type: "buy", pair: "btc_jpy"

买入订单时,如果已经存在低于指定价格的卖出订单,则按卖出订单价格从低到高结算。卖出订单不足时,将保留为未结算订单。卖出订单同理。

如何订购

共有8种order_type

  • "buy" 限价订单 现金交易 买入
  • "sell" 限价订单 现金交易 売り
  • "market_buy" 时价订单 现金交易 买入
  • "market_sell" 时价订单 现金交易 卖出
  • "leverage_buy" 限价订单 新杠杆交易 买入
  • "leverage_sell" 限价订单 新杠杆交易 卖出
  • "close_long" 限价订单 杠杆交易结算 卖出
  • "close_short" 限价订单 杠杆交易结算 买入

"buy"

限价订单 现金交易 买入

  • *rate 订单率。(例)28000
  • *amount 订单量。(例)0.1

"sell"

限价订单 现金交易 売り

  • *rate 订单率。(例)28000
  • *amount 订单量。(例)0.1

"market_buy"

时价订单 现金交易 买入

买入的时价订单需要发送使用的日元数量。

  • *market_buy_amount 时价买入时使用的日元金额。(例)10000

"market_sell"

时价订单 现金交易 卖出

  • *amount 订单量。(例)0.1

"leverage_buy"

限价订单 新杠杆交易 买入

  • rate 订单率。不指定则默认为时价订单。
  • *amount 订单量。(例)0.1

"leverage_sell"

限价订单 新杠杆交易 卖出

  • rate 订单率。不指定则默认为时价订单。
  • *amount 订单量。(例)0.1

"close_long"

限价订单 杠杆交易结算 卖出

提交结算当前持仓的订单。长期持仓使用 close_long 结算,短期持仓使用 close_short 结算。

  • rate 订单率。不指定则默认为时价订单。
  • *amount 订单量。(例)0.1
  • *position_id 结算持仓的ID

"close_short"

限价订单 杠杆交易结算 买入

提交结算当前持仓的订单。长期持仓使用 close_long 结算,短期持仓使用 close_short 结算。

  • rate 订单率。不指定则默认为时价订单。
  • *amount 订单量。(例)0.1
  • *position_id 结算持仓的ID

HTTP REQUEST

POST /api/exchange/orders

PARAMETERS

  • *pair 交易对。当前仅限 "btc_jpy"
  • *order_type 订购方法
  • rate 订单率。(例)28000
  • amount 订单量。(例)0.1
  • market_buy_amount 时价买入时使用的日元金额。(例)10000
  • position_id 结算持仓的ID
  • stop_loss_rate 止损率 ( 何为止损率? )
{"success": true, "id": 12345, "rate": "30010.0", "amount": "1.3", "order_type": "sell", "stop_loss_rate": null, "pair": "btc_jpy", "created_at": "2015-01-10T05:55:38.000Z"}

RESPONSE ITEMS

  • id 新订单的ID
  • rate 订单率
  • amount 订单量
  • order_type 订购方法
  • 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 订单创建日期

取消订单

可以指定新订单或者未结算的订单列表的ID,取消订单。

HTTP REQUEST

DELETE /api/exchange/orders/[id]

PARAMETERS

{"success": true, "id": 12345}

RESPONSE ITEMS

  • id 已取消订单的ID

交易记录

可以参考您的最新交易记录。

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"

持仓列表

显示杠杆交易的持仓列表。杠杆交易的订单通过 新订单 操作。

HTTP REQUEST

GET /api/exchange/leverage/positions

PARAMETERS

  • status 可以指定"open", "closed"
{"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"}]}]}

RESPONSE ITEMS

  • id ID
  • pair 交易对
  • status 持仓状态 ( "open", "closed" )
  • created_at 持仓创建日期
  • closed_at 持仓的结算完了日期
  • open_rate 格持仓的平均取得价格
  • closed_rate 持仓的平均结算价格
  • amount 当前持仓量(BTC)
  • all_amount 持仓量(BTC)
  • side 持仓种类 ( "buy", "sell" )
  • pl 收益
  • new_order 新订单相关信息
  • close_orders 结算订单相关信息

账户

可以取得个人账户的余额及各种信息。

余额

确认账户余额。

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

GET /api/accounts/leverage_balance

{"success":true,"margin":{"jpy":"131767.22675655"},"margin_available":{"jpy":"116995.98446494"},"margin_level":"8.36743"}

RESPONSE ITEMS

  • margin[jpy] 保证金
  • margin_available[jpy] 可以使用的保证金
  • margin_level 保证金维持率

汇出比特币

将比特币发送至指定地址。

HTTP REQUEST

POST /api/send_money

PARAMETERS

  • *address 收取方的比特币地址
  • *amount 发送比特币数量
{"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

POST /api/deposit_money/[id]/fast

PARAMETERS

{"success": true}

账户信息

显示账户信息。

HTTP REQUEST

GET /api/accounts

{"success": true, "id": 10000, "email": "test@gmail.com", "identity_status": "identity_pending", "bitcoin_address": "1v6zFvyNPgdRvhUufkRoTtgyiw1xigncc", "lending_leverage": "3.0", "taker_fee": "0.15", "maker_fee": "0.0" }

RESPONSE ITEMS

  • id 账户ID。与日元付款时指定的ID一致。
  • email 注册的电子邮件地址
  • identity_status 显示本人身份验证资料的提交状态。
  • bitcoin_address 您的存款用比特币地址
  • lending_leverage 显示您的杠杆。
  • taker_fee 显示作为Taker下订单时的手续费。
  • maker_fee 显示作为Maker下订单时的手续费。

提取日元

可以通过银行转账提取日元。

银行账户列表

返回客户取款用的注册的银行账户列表。

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

{"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 转账手续费

取消提款申请

取消提款申请。

只能取消statuspending 的提款申请。

HTTP REQUEST

DELETE /api/withdraws/[id]

PARAMETERS

{"success":true}

信用交易

coincheck可以通过借入比特币, Ether, ETC进行信用交易。

杠杆当前的设置为3倍。

5倍杠杆仅适用于提交本人身份验证资料的用户。

例如,使用日元作为保证金借入比特币,卖出后再次回购、还款时,可以实现卖空。

详情请见 信用交易

借款申请

申请借款。

HTTP REQUEST

POST /api/lending/borrows

PARAMETERS

  • *amount 借用数量
  • *currency 货币(BTC, ETH)
{"success": true, "id": 12345, "rate": "0.0005", "amount": "1.3", "currency": "BTC", "created_at": "2015-01-10T05:55:38.000Z"}

RESPONSE ITEMS

  • id ID
  • rate 每日汇率(BTCは0.05%, ETHは0.05%)
  • amount 订单量
  • currency 货币
  • created_at 订单创建日期

借款列表

显示您的借款货币列表。

可以基于此 id 返还

HTTP REQUEST

GET /api/lending/borrows/matches

{"success": true, "matches": [{"id": 12345, "borrow_id": 6789, "rate": "0.0005", "amount": "1.3", "pending_amount": "1.30065", "currency": "BTC", "deadline": "2015-01-10T05:55:38.000Z"}]}

RESPONSE ITEMS

  • id ID
  • borrow_id 借款申请的ID
  • rate 每日汇率(当前固定为 0.05%)
  • amount 借款量
  • pending_amount 借款量(含利息)
  • currency 货币
  • deadline 返还期限

还款

可以基于 id 进行返还

HTTP REQUEST

POST /api/lending/borrows/[id]/repay

PARAMETERS

{"success": true, "id": 12345}

RESPONSE ITEMS

  • id ID

转账

可以进行杠杆账户和现金交易账户间的余额转账。

向杠杆账户转账

从现金交易账户向杠杆账户转账。

HTTP REQUEST

POST /api/exchange/transfers/to_leverage

PARAMETERS

  • *currency 货币(当前仅支持JPY)
  • *amount 转移数量
{"success":true}

从杠杆账户转账

从杠杆账户向现金交易账户汇款。

HTTP REQUEST

POST /api/exchange/transfers/from_leverage

PARAMETERS

  • *currency 货币(当前仅支持JPY)
  • *amount 转移数量
{"success":true}

WebSocket API β版

WebSocket API在HTTP通信很难实现,实时交流相对容易,可以取得交易所公开的交易记录、板信息。

WebSocket API为β版,可能存在式样变化或操作不稳定的情况。此外,可用的货币对仅限"btc_jpy"。(2017/03/03时点)

概要

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"}))

公共频道

公共频道是无需验证的频道。

交易记录

取得最近的交易记录。

例) [pair] = btc_jpy

REQUEST

{"type":"subscribe","channel":"[pair]-trades"}

RESPONSE

[2357062,"[pair]","148638.0","5.0","sell"]
[2357068,"[pair]","148642.0","0.7828","buy"]

RESPONSE ITEMS

["ID","交易对","订单率","订单量","订购方法"]

板信息

定期发送板信息的差值。

例) [pair] = btc_jpy

REQUEST

{"type":"subscribe", "channel":"[pair]-orderbook"}

RESPONSE

["[pair]",{"bids":[["148634.0","0"],["148633.0","0.0574"]],"asks":[["148834.0","0"],["148833.0","1.0581"]]}]

RESPONSE ITEMS

  • asks 卖出订单信息
  • bids 买入订单信息
["订单率","订单量"]

日本語で表示しますか?

はい いいえ もう表示しない

Show in English?

Yes No Never