NAV Navbar
javascript python

概要

GMOコインのAPIは認証不要のPublic APIとAPIキーによる認証が必要なPrivate APIを提供しています。

//Node.js v10.15.3 にて動作確認したサンプルコードをRequest exampleに記載しています。
#Python 3.7.2 にて動作確認したサンプルコードをRequest exampleに記載しています。

エンドポイント

Public APIとPrivate APIのエンドポイントが異なりますのでご注意下さい。

バージョン

現在バージョン: v1

制限

リクエストの制限APIによりリクエスト回数に制限をかけております。

口座開設

口座をお持ちでない場合 無料口座開設

APIキー作成

口座開設完了後、会員ページからAPIキーが作成できます。

APIキーを生成する際、機能ごとにパーミッションを設定することができます。

認証

var request   = require('request');
var crypto    = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp = Date.now().toString();
var method    = 'POST';
var endPoint  = 'https://END_POINT_URL';
var path      = '/v1/PATH';
var reqBody   = {};

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
  console.log(body);
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://END_POINT_URL'
path      = '/v1/PATH'
reqBody   = {}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (res.json())

Private APIの認証Private APIではAPIキーとAPIシークレットを使用してHTTPヘッダに下記の認証情報を含める必要があります。

Signatureの作成API-SIGNは、リクエスト時のUnix Timestamp,HTTPメソッド,リクエストのパス,リクエストボディを文字列として連結したものをHMAC-SHA256形式でAPIシークレットキーを使って署名した結果となります。

Public API

取引所ステータス

Request example:

var request = require('request');

var endPoint = 'https://api.coin.z.com/public';
var path     = '/v1/status';

request(endPoint + path, function (err, response, payload) {
    console.log(JSON.stringify(JSON.parse(payload), null, 2));
});
import requests
import json

endPoint = 'https://api.coin.z.com/public'
path     = '/v1/status'

response = requests.get(endPoint + path)
print(response.json())

Response example:

{
  "status": 0,
  "data": {
    "status": "OPEN"
  },
  "responsetime": "2019-03-19T02:15:06.001Z"
}

取引所の稼動状態を取得します。

Request

GET /public/v1/status

Parameters

無し

Response

Property Name Value Description
status string 取引所ステータス: MAINTENANCE PREOPEN OPEN

最新レート

Request example:

var request = require('request');

var endPoint = 'https://api.coin.z.com/public';
var path     = '/v1/ticker?symbol=BTC';

request(endPoint + path, function (err, response, payload) {
    console.log(JSON.stringify(JSON.parse(payload), null, 2));
});
import requests
import json

endPoint = 'https://api.coin.z.com/public'
path     = '/v1/ticker?symbol=BTC'

response = requests.get(endPoint + path)
print(json.dumps(response.json(), indent=2))

Response example:

{
  "status": 0,
  "data": [
    {
      "ask": "750760",
      "bid": "750600",
      "high": "762302.7269572",
      "last": "756662.3802628",
      "low": "704874.663486",
      "symbol": "BTC",
      "timestamp": "2018-03-30T12:34:56.789Z",
      "volume": "194785.84845239"
    }
  ],
  "responsetime": "2019-03-19T02:15:06.014Z"
}

指定した銘柄の最新レートを取得します。
全銘柄分の最新レートを取得する場合はsymbolパラメータ指定無しでの実行をおすすめします。

Request

GET /public/v1/ticker

Parameters

Parameter Type Required Available Values
symbol string optional 指定しない場合は全銘柄分の最新レートを返す。BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY

Response

Property Name Value Description
list.volume string 24時間の取引量

板情報

Request example:

var request = require('request');

var endPoint = 'https://api.coin.z.com/public';
var path     = '/v1/orderbooks?symbol=BTC';

request(endPoint + path, function (err, response, payload) {
    console.log(JSON.stringify(JSON.parse(payload), null, 2));
});
import requests
import json

endPoint = 'https://api.coin.z.com/public'
path     = '/v1/orderbooks?symbol=BTC'

response = requests.get(endPoint + path)
print(json.dumps(response.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "asks": [
      {
        "price": "455659",
        "size": "0.1"
      }
    ],
    "bids": [
      {
        "price": "455659",
        "size": "0.1"
      }
    ],
    "symbol": "BTC"
  },
  "responsetime": "2019-03-19T02:15:06.026Z"
}

指定した銘柄の板情報(snapshot)を取得します。

Request

GET /public/v1/orderbooks

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY

Response

Property Name Value Description
asks array 売り注文の情報
bids array 買い注文の情報

取引履歴

Request example:

var request = require('request');

var endPoint = 'https://api.coin.z.com/public';
var path     = '/v1/trades?symbol=BTC&page=1&count=10';

request(endPoint + path, function (err, response, payload) {
    console.log(JSON.stringify(JSON.parse(payload), null, 2));
});
import requests
import json

endPoint = 'https://api.coin.z.com/public'
path     = '/v1/trades?symbol=BTC&page=1&count=10'

response = requests.get(endPoint + path)
print(json.dumps(response.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "pagination": {
      "currentPage": 1,
      "count": 30
    },
    "list": [
      {
        "price": "750760",
        "side": "BUY",
        "size": "0.1",
        "timestamp": "2018-03-30T12:34:56.789Z"
      }
    ]
  },
  "responsetime": "2019-03-28T09:28:07.980Z"
}

指定した銘柄の取引履歴を取得します。

Request

GET /public/v1/trades

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
page number optional 取得対象ページ: 指定しない場合は1を指定したとして動作する。
count number optional 1ページ当りの取得件数: 指定しない場合は100(最大値)を指定したとして動作する。

Response

Property Name Value Description
price string 約定価格
side string 売買区分: BUY SELL
size string 約定数量
timestamp string 約定日時

Private API

余力情報を取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey     = 'YOUR_API_KEY';
var secretKey  = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/account/margin';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/account/margin'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "profitLoss": "8019",
    "actualProfitLoss": "5204923",
    "margin": "7298",
    "availableAmount": "5189523"
  },
  "responsetime": "2019-03-19T02:15:06.051Z"
}

余力情報を取得します。

Request

GET /private/v1/account/margin

Parameters

無し

Response

Property Name Value Description
profitLoss string 評価損益
actualProfitLoss string 時価評価総額
margin string 拘束証拠金
availableAmount string 取引余力

資産残高を取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey     = 'YOUR_API_KEY';
var secretKey  = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/account/assets';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/account/assets'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": [
    {
      "symbol": "JPY",
      "amount": "993982448",
      "available": "993982448",
      "conversionRate": "1"
    },
    {
      "symbol": "BTC",
      "amount": "4.0002",
      "available": "4.0002",
      "conversionRate": "859614"
    }
  ],
  "responsetime": "2019-03-19T02:15:06.055Z"
}

資産残高を取得します。

Request

GET /private/v1/account/assets

Parameters

無し

Response

Property Name Value Description
symbol string 銘柄名: JPY BTC ETH BCH LTC XRP
amount string 残高
available string 利用可能金額(残高 - 出金予定額)
conversionRate string 円転レート

注文情報取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/orders';
var parameters = '?orderId=123456789';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/orders'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = { "orderId": 123456789 }

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "list": [
      {
        "rootOrderId": 123456789,
        "orderId": 123456789,
        "symbol": "BTC",
        "side": "BUY",
        "orderType": "NORMAL",
        "executionType": "MARKET",
        "settleType": "OPEN",
        "size": "1",
        "executedSize": "1",
        "price": "0",
        "status": "WAITING",
        "timeInForce": "FAK",
        "timestamp": "2019-03-19T02:15:06.059Z"
      }
    ]
  },
  "responsetime": "2019-03-19T02:15:06.059Z"
}

指定した注文IDの注文情報を取得します。
対象: 現物取引、レバレッジ取引

Request

GET /private/v1/orders

Parameters

Parameter Type Required Available Values
orderId number
*required

Response

Property Name Value Description
rootOrderId number 親注文ID
orderId number 注文ID
symbol string 銘柄名: BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
orderType string 取引区分: NORMAL LOSSCUT
executionType string 注文タイプ: MARKET LIMIT
settleType string 決済区分: OPEN CLOSE
size string 発注数量
executedSize string 約定数量
price string 注文価格(MARKET注文の場合は空)
status string 注文ステータス: WAITING ORDERED MODIFYING CANCELLING CANCELED EXECUTED EXPIRED
timeInForce string 執行数量条件: FAK FAS
timestamp string 注文日時

有効注文一覧

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/activeOrders';
var parameters = '?symbol=BTC&page=1&count=10';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/activeOrders'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {
    "symbol": "BTC",
    "page": 1,
    "count": 10
}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "pagination": {
      "currentPage": 1,
      "count": 30
    },
    "list": [
      {
        "rootOrderId": 123456789,
        "orderId": 123456789,
        "symbol": "BTC",
        "side": "BUY",
        "orderType": "NORMAL",
        "executionType": "LIMIT",
        "settleType": "OPEN",
        "size": "1",
        "executedSize": "0",
        "price": "840000",
        "status": "ORDERED",
        "timeInForce": "FAS",
        "timestamp": "2019-03-19T01:07:24.217Z"
      }
    ]
  },
  "responsetime": "2019-03-19T01:07:24.217Z"
}

有効注文一覧を取得します。
対象: 現物取引、レバレッジ取引

Request

GET /private/v1/activeOrders

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
page number optional 取得対象ページ: 指定しない場合は1を指定したとして動作する。
count number optional 1ページ当りの取得件数: 指定しない場合は100(最大値)を指定したとして動作する。

Response

Property Name Value Description
rootOrderId number 親注文ID
orderId number 注文ID
symbol string 銘柄名: BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
orderType string 取引区分: NORMAL LOSSCUT
executionType string 注文タイプ: MARKET LIMIT
settleType string 決済区分: OPEN CLOSE
size string 発注数量
executedSize string 約定数量
price string 注文価格(MARKET注文の場合は空)
status string 注文ステータス: WAITING ORDERED MODIFYING CANCELLING CANCELED EXECUTED EXPIRED
timeInForce string 執行数量条件: FAK FAS
timestamp string 注文日時

約定情報取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/executions';
var parameters = '?orderId=123456789';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/executions'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {
    "orderId": 123456789
}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "list": [
      {
        "executionId": 72123911,
        "orderId": 123456789,
        "symbol": "BTC",
        "side": "BUY",
        "settleType": "OPEN",
        "size": "0.7361",
        "price": "877404",
        "lossGain": "0",
        "fee": "323",
        "timestamp": "2019-03-19T02:15:06.081Z"
      }
    ]
  },
  "responsetime": "2019-03-19T02:15:06.081Z"
}

約定情報を取得します。
対象: 現物取引、レバレッジ取引

Request

GET /private/v1/executions

Parameters

Parameter Type Required Available Values
orderId number
*
orderId executionId いずれか一つが必須。
executionId number
*
orderId executionId いずれか一つが必須。

Response

Property Name Value Description
executionId number 約定ID
orderId number 注文ID
symbol string 銘柄名: BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
settleType string 決済区分: OPEN CLOSE
size string 発注数量
price string 約定レート
lossGain string 決済損益
fee string 取引手数料
timestamp string 約定日時

最新の約定一覧

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/latestExecutions';
var parameters = '?symbol=BTC&page=1&count=100';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/latestExecutions'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {
    "symbol": "BTC",
    "page": 1,
    "count": 100
}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "pagination": {
      "currentPage": 1,
      "count": 30
    },
    "list": [
      {
        "executionId": 72123911,
        "orderId": 123456789,
        "symbol": "BTC",
        "side": "BUY",
        "settleType": "OPEN",
        "size": "0.7361",
        "price": "877404",
        "lossGain": "0",
        "fee": "323",
        "timestamp": "2019-03-19T02:15:06.086Z"
      }
    ]
  },
  "responsetime": "2019-03-19T02:15:06.086Z"
}

最新約定一覧を取得します。
対象: 現物取引、レバレッジ取引

Request

GET /private/v1/latestExecutions

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
page number optional 取得対象ページ: 指定しない場合は1を指定したとして動作する。
count number optional 1ページ当りの取得件数: 指定しない場合は100(最大値)を指定したとして動作する。

Response

Property Name Value Description
executionId number 約定ID
orderId number 注文ID
symbol string 銘柄名: BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
settleType string 決済区分: OPEN CLOSE
size string 発注数量
price string 約定レート
lossGain string 決済損益
fee string 取引手数料
timestamp string 約定日時

建玉一覧を取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/openPositions';
var parameters = '?symbol=BTC_JPY&page=1&count=100';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/openPositions'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {
    "symbol": "BTC_JPY",
    "page": 1,
    "count": 100
}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "pagination": {
      "currentPage": 1,
      "count": 30
    },
    "list": [
      {
        "positionId": 1234567,
        "symbol": "BTC_JPY",
        "side": "BUY",
        "size": "0.22",
        "orderdSize": "0",
        "price": "876045",
        "lossGain": "14",
        "leverage": "10",
        "losscutPrice": "832243",
        "timestamp": "2019-03-19T02:15:06.094Z"
      }
    ]
  },
  "responsetime": "2019-03-19T02:15:06.095Z"
}

有効建玉一覧を取得します。
対象: レバレッジ取引

Request

GET /private/v1/openPositions

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
page number optional 取得対象ページ: 指定しない場合は1を指定したとして動作する。
count number optional 1ページ当りの取得件数: 指定しない場合は100(最大値)を指定したとして動作する。

Response

Property Name Value Description
positionId number 建玉ID
symbol string 銘柄名: BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
size string 建玉数量
orderdSize string 発注中数量
price string 建玉レート
lossGain string 評価損益
leverage string レバレッジ
losscutPrice string ロスカットレート
timestamp string 約定日時

建玉サマリーを取得

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'GET';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/positionSummary';
var parameters = '?symbol=BTC_JPY';

var text = timestamp + method + path;
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path + parameters,
    "method": method,
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'GET'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/positionSummary'

text = timestamp + method + path
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()
parameters = {
    "symbol": "BTC_JPY"
}

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.get(endPoint + path, headers=headers, params=parameters)
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": {
    "list": [
      {
        "symbol": "BTC_JPY",
        "side": "BUY",
        "sumPositionQuantity": "11.6999",
        "sumOrderQuantity": "2",
        "averagePositionRate": "715656",
        "positionLossGain": "250675"
      }
    ]
  },
  "responsetime": "2019-03-19T02:15:06.102Z"
}

建玉サマリーを取得します。
対象: レバレッジ取引

Request

GET /private/v1/positionSummary

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY

Response

Property Name Value Description
symbol string 銘柄名: BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string 売買区分: BUY SELL
sumPositionQuantity string 建玉数量
sumOrderQuantity string 発注中数量
averagePositionRate string 平均建玉レート
positionLossGain string 評価損益

注文

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/order';
var reqBody    = {
    symbol: "BTC_JPY",
    side: "BUY",
    executionType: "LIMIT",
    price: "430001",
    size: "0.02"
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/order'
reqBody = {
    "symbol": "BTC_JPY",
    "side": "BUY",
    "executionType": "LIMIT",
    "price": "430001",
    "size": "0.02"
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": "637000",
  "responsetime": "2019-03-19T02:15:06.108Z"
}

新規注文をします。
対象: 現物取引、レバレッジ取引

Request

POST /private/v1/order

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC ETH BCH LTC XRP BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string
*required
BUY SELL
executionType string
*required
MARKET LIMIT
price string
*executionTypeによる
LIMIT の場合は必須、 MARKET の場合は不要。
size string
*required

Response

Property Name Value Description
data string 注文対象のorderId

注文変更

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/changeOrder';
var reqBody    = {
    orderId: 2,
    price: "1201"
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/changeOrder'
reqBody = {
    "orderId": 2,
    "price": "1201"
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "responsetime": "2019-03-19T01:07:24.557Z"
}

注文変更をします。
対象: 現物取引、レバレッジ取引

Request

POST /private/v1/changeOrder

Parameters

Parameter Type Required Available Values
orderId number
*required
price string
*required

注文キャンセル

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/cancelOrder';
var reqBody    = {
    orderId: 2
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/cancelOrder'
reqBody = {
    "orderId": 2
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "responsetime": "2019-03-19T01:07:24.557Z"
}

注文取消をします。
対象: 現物取引、レバレッジ取引

Request

POST /private/v1/cancelOrder

Parameters

Parameter Type Required Available Values
orderId number
*required

決済注文

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/closeOrder';
var reqBody   = {
    "symbol": "BTC_JPY",
    "side": "BUY",
    "executionType": "LIMIT",
    "price": "85201",
    "settlePosition": [
        {
            "positionId": 1000342,
            "size": "3.44"
        }
    ]
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/closeOrder'
reqBody = {
    "symbol": "BTC_JPY",
    "side": "BUY",
    "executionType": "LIMIT",
    "price": "85201",
    "settlePosition": [
        {
            "positionId": 1000342,
            "size": "3.44"
        }
    ]
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": "637000",
  "responsetime": "2019-03-19T01:07:24.557Z"
}

決済注文をします。
対象: レバレッジ取引

Request

POST /private/v1/closeOrder

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string
*required
BUY SELL
executionType string
*required
MARKET LIMIT
price string
*executionTypeによる
LIMIT の場合は必須、 MARKET の場合は不要。
settlePosition.positionId number
*required
建玉は1つのみ指定可能。
settlePosition.size string
*required
建玉は1つのみ指定可能。

Response

Property Name Value Description
data string 決済注文対象のorderId

一括決済注文

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/closeBulkOrder';
var reqBody   = {
    "symbol": "BTC_JPY",
    "side": "BUY",
    "executionType": "LIMIT",
    "price": "85201",
    "size": "3.44"
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/closeBulkOrder'
reqBody = {
    "symbol": "BTC_JPY",
    "side": "BUY",
    "executionType": "LIMIT",
    "price": "85201",
    "size": "3.44"
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "data": "637000",
  "responsetime": "2019-03-19T01:07:24.557Z"
}

一括決済注文をします。
対象: レバレッジ取引

Request

POST /private/v1/closeBulkOrder

Parameters

Parameter Type Required Available Values
symbol string
*required
BTC_JPY ETH_JPY BCH_JPY LTC_JPY XRP_JPY
side string
*required
BUY SELL
executionType string
*required
MARKET LIMIT
price string
*executionTypeによる
LIMIT の場合は必須、 MARKET の場合は不要。
size string
*required

Response

Property Name Value Description
data string 一括決済注文対象のorderId

ロスカットレート変更

Request example:

var request = require('request');
var crypto  = require('crypto');

var apiKey    = 'YOUR_API_KEY';
var secretKey = 'YOUR_SECRET_KEY';

var timestamp  = Date.now().toString();
var method     = 'POST';
var endPoint   = 'https://api.coin.z.com/private';
var path       = '/v1/changeLosscutPrice';
var reqBody   = {
    "positionId": 305885,
    "losscutPrice": "750000"
}

var text = timestamp + method + path + JSON.stringify(reqBody);
var sign = crypto.createHmac('sha256', secretKey).update(text).digest('hex');
var options = {
    "url": endPoint + path,
    "method": method,
    "body": JSON.stringify(reqBody),
    "headers": {
        "API-KEY": apiKey,
        "API-TIMESTAMP": timestamp,
        "API-SIGN": sign
    }
};

request(options, function (err, response, body) {
    console.log(JSON.stringify(JSON.parse(body), null, 2));
});
import requests
import json
import hmac
import hashlib
import time
from datetime import datetime

apiKey    = 'YOUR_API_KEY'
secretKey = 'YOUR_SECRET_KEY'

timestamp = '{0}000'.format(int(time.mktime(datetime.now().timetuple())))
method    = 'POST'
endPoint  = 'https://api.coin.z.com/private'
path      = '/v1/changeLosscutPrice'
reqBody = {
    "positionId": 305885,
    "losscutPrice": "750000"
}

text = timestamp + method + path + json.dumps(reqBody)
sign = hmac.new(bytes(secretKey.encode('ascii')), bytes(text.encode('ascii')), hashlib.sha256).hexdigest()

headers = {
    "API-KEY": apiKey,
    "API-TIMESTAMP": timestamp,
    "API-SIGN": sign
}

res = requests.post(endPoint + path, headers=headers, data=json.dumps(reqBody))
print (json.dumps(res.json(), indent=2))

Response example:

{
  "status": 0,
  "responsetime": "2019-03-19T01:07:24.557Z"
}

建玉のロスカットレート変更をします。
対象: レバレッジ取引

Request

POST /private/v1/changeLosscutPrice

Parameters

Parameter Type Required Available Values
positionId number
*required
losscutPrice string
*required

リファレンス

APIのパラメータやレスポンスにより返ってくる各種コードについて説明します。

パラメータ

パラメータの値とその内容について説明します。

symbol: 銘柄名

Value Description
BTC ビットコイン
ETH イーサリアム
BCH ビットコインキャッシュ
LTC ライトコイン
XRP リップル
BTC_JPY ビットコイン/円
ETH_JPY イーサリアム/円
BCH_JPY ビットコインキャッシュ/円
LTC_JPY ライトコイン/円
XRP_JPY リップル/円

side: 売買区分

Value Description
BUY
SELL

executionType: 注文タイプ

Value Description
MARKET 成行
LIMIT 指値

timeInForce: 執行数量条件

Value Description
FAK 注文が一部約定後に未執行数量が残った場合、その残数量を失効とする条件
FAS 注文が一部約定後に未執行数量が残った場合、その残数量を有効とする条件

HTTPステータスコード

Status Code Description
200 処理が正常終了した場合に返ってくるコードです。
404 URLが不正な場合などに返ってくるコードです。

ステータスコード

Status Code Description
0 処理が正常終了した場合に返ってくるコードです。

エラーコード

Error Code Description
ERR-430 約定情報取得において、orderId/executionIdの設定が不正な場合に返ってきます。
ERR-554 サーバーが利用不可能な状態の場合に返ってきます。
ERR-5003 API呼出上限を越えた場合に返ってきます。
ERR-5008 リクエストヘッダーに設定されているAPI-TIMESTAMPが公開APIのシステム時刻より遅い場合に返ってきます。
ERR-5009 リクエストヘッダーに設定されているAPI-TIMESTAMPが公開APIのシステム時刻より早い場合に返ってきます。
ERR-5106 パラメーターが不正な場合に返ってきます。
ERR-5012 APIキーの認証エラーが不正な場合などに返ってきます。
ERR-5014 お客様のご確認、ご同意が必要な処理を実行する際に、お客様に未確認・未同意事項がある場合に返ってきます。
ERR-5121 注文時の価格が低すぎて注文できない状態の場合に返ってきます。
ERR-5122 指定された注文番号が執行中など注文できない状態の場合に返ってきます。
ERR-5123 指定された注文番号が存在しない場合に返ってきます。
ERR-5201 定期メンテナンス時にPublic/Private APIを呼び出した場合に返ってきます。
ERR-5202 取引所APIの緊急メンテナンス時にPublic/Private APIを呼び出した場合に返ってきます。
ERR-5203 取引所プレオープン中に注文および注文変更した場合に返ってきます。
ERR-5204 リクエスト時に各APIのURLが不正な場合に返ってきます。
ERR-5206 注文変更を実行時に注文毎の変更可能回数が上限に達している場合に返ってきます。上限に達して更に注文変更を行いたい場合は、1度注文キャンセルをしてから新規に注文をしていただくようにお願い致します。

更新履歴

2019-07-03

制限

2019-06-12

GET /public/v1/ticker

2019-05-29

バージョン v1 をリリースしました。