概览
欢迎查看 FTX API 文档。 我们提供完整的 REST、Websocket 和 FIX API 以满足您的算法交易需求。您可以在https://github.com/ftexchange/ftx上找到每个连接选项的示例代码。
REST API
基于 HTTP 的 API,具有完整的交易和资产管理功能,包括公共委托簿和交易数据以及私人账户数据和下单管理。
REST 端点网址:https://ftx.com/api
使用 JSON 发起请求和回复。
身份验证
import time
import hmac
from requests import Request
ts = int(time.time() * 1000)
request = Request('GET', '<api_endpoint>')
prepared = request.prepare()
signature_payload = f'{ts}{prepared.method}{prepared.path_url}'.encode()
signature = hmac.new('YOUR_API_SECRET'.encode(), signature_payload, 'sha256').hexdigest()
prepared.headers['FTX-KEY'] = 'YOUR_API_KEY'
prepared.headers['FTX-SIGN'] = signature
prepared.headers['FTX-TS'] = str(ts)
# Only include line if you want to access a subaccount. Remember to URI-encode the subaccount name if it contains special characters!
# prepared.headers['FTX-SUBACCOUNT'] = 'my_subaccount_nickname'
var method = HttpMethod.Get
var endpoint = $"/api/account";
var request = new HttpRequestMessage(method, endpoint);
var _nonce = (DateTime.UtcNow - start).TotalMilliseconds;
var hashMaker = new HMACSHA256(Encoding.UTF8.GetBytes(""YOUR_API_SECRET""));
var signaturePayload = $"{_nonce}{method.ToString().ToUpper()}{endpoint}";
var hash = hashMaker.ComputeHash(Encoding.UTF8.GetBytes(signaturePayload));
var hashString = BitConverter.ToString(hash).Replace("-", string.Empty);
var signature = hashString.ToLower();
request.Headers.Add("FTX-KEY", "YOUR_API_KEY");
request.Headers.Add("FTX-SIGN", signature);
request.Headers.Add("FTX-TS", _nonce.ToString());
For authenticated requests, the following headers should be sent with the request:
FTX-KEY
: Your API keyFTX-TS
: Number of milliseconds since Unix epochFTX-SIGN
: SHA256 HMAC of the following four strings, using your API secret, as a hex string:- Request timestamp (e.g.
1528394229375
) - HTTP method in uppercase (e.g.
GET
orPOST
) - Request path, including leading slash and any URL parameters but not including the hostname (e.g.
/account
) - (POST only) Request body (JSON-encoded)
- Request timestamp (e.g.
FTX-SUBACCOUNT
(optional): URI-encoded name of the subaccount to use. Omit if not using subaccounts.
You will find a detailed example on how to authenticate here
费率限制
Hitting our rate limits will result in HTTP 429 errors. Non-order placement requests do not count towards rate limits. Rate limits are tiered by account trading volumes. For details, please see this post here. Note that limits in the linked post are at the account level
Pagination
Generalized Request
GET {endpoint}?start_time=1559881511&end_time=1559881711
FTX supports pagination on most REST API endpoints. Pagination allows you to specify the time range of data to be returned, which also enables you to retrieve more results than are returned by default. You can find sample Python code which demonstrates pagination using the start_time and end_time parameters here
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; filter starting time in seconds |
end_time | number | 1559881711 | optional; filter ending time in seconds |
子账户
To specify a subaccount, include its URI-encoded nickname in the header FTX-SUBACCOUNT
with the request.
获取所有子帐户
请求
GET /subaccounts
回复
{
"success": true,
"result": [
{
"nickname": "sub1",
"deletable": true,
"editable": true,
"competition": true
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nickname | string | sub1 | subaccount name |
deletable | boolean | true | 子帐户是否可以删除 |
editable | boolean | true | 子帐户的昵称是否可以更改 |
competition | boolean | true | whether the subaccount was created for a competition |
创建子帐户
请求
POST /subaccounts
{
"nickname": "sub2",
}
回复
{
"success": true,
"result": {
"nickname": "sub2",
"deletable": true,
"editable": true,
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nickname | string | sub2 |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nickname | string | sub2 | subaccount name |
deletable | boolean | true | 子帐户是否可以删除 |
editable | boolean | true | 子帐户的昵称是否可以更改 |
更改子帐户名称
请求
POST /subaccounts/update_name
{
"nickname": "sub2",
"newNickname": "newSub2"
}
回复
{
"success": true,
"result": null
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nickname | string | sub2 | 子帐户的当前昵称 |
newNickname | string | newSub2 | 子帐户的新昵称 |
删除子帐户
请求
DELETE /subaccounts
{
"nickname": "sub2",
}
回复
{
"success": true,
"result": null
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nickname | string | sub2 |
获取子帐户余额
请求
GET /subaccounts/{nickname}/balances
回复
{
"success": true,
"result": [
{
"coin": "USDT",
"free": 4321.2,
"total": 4340.2,
"spotBorrow": 0,
"availableWithoutBorrow": 2320.2
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDT | coin id |
free | number | 4321.2 | free amount |
total | number | 4340.2 | total amount |
spotBorrow | number | 0 | amount borrowed using spot margin |
availableWithoutBorrow | number | 2320.2 | amount available without borrowing |
在子帐户之间相互转账
请求
POST /subaccounts/transfer
{
"coin": "XRP",
"size": 10000,
"source": null,
"destination": "sub1",
}
回复
{
"success": true,
"result": {
"id": 316450,
"coin": "XRP",
"size": 10000,
"time": "2019-03-05T09:56:55.728933+00:00",
"notes": "",
"status": "complete",
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | XRP | |
size | number | 31431.0 | |
source | string | main | %{account}子帐户的名称。主帐户使用null 或'main' |
destination | string | sub1 | %{account}子帐户的名称。主帐户使用null 或'main' |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 316450 | |
coin | string | XRP | |
size | number | 10000 | |
time | string | 2019-03-05T09:56:55.728933+00:00 | |
notes | string | ||
status | string | complete | always 'complete' |
市场
This section covers all types of markets on FTX: spot, perpetual futures, expiring futures, and MOVE contracts. Examples for each type are BTC/USD
, BTC-PERP
, BTC-0626
, and BTC-MOVE-1005
. For futures that expired
in 2019, prepend a 2019
to the date, like so: BTC-20190628
or BTC-MOVE-20190923
.
获取市场
请求
GET /markets
回复
{
"success": true,
"result": [
{
"name": "BTC-PERP",
"baseCurrency": null,
"quoteCurrency": null,
"quoteVolume24h": 28914.76,
"change1h": 0.012,
"change24h": 0.0299,
"changeBod": 0.0156,
"highLeverageFeeExempt": false,
"minProvideSize": 0.001,
"type": "future",
"underlying": "BTC",
"enabled": true,
"ask": 3949.25,
"bid": 3949,
"last": 10579.52,
"postOnly": false,
"price": 10579.52,
"priceIncrement": 0.25,
"sizeIncrement": 0.0001,
"restricted": false,
"volumeUsd24h": 28914.76,
"largeOrderThreshold": 5000.0,
"isEtfMarket": false,
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
name | string | BTC-PERP | e.g. "BTC/USD" for spot, "BTC-PERP" for futures |
baseCurrency | string | BTC | 仅限现货市场 |
quoteCurrency | string | USD | 仅限现货市场 |
quoteVolume24h | number | 28914.76 | |
change1h | number | 0.012 | change in the past hour |
change24h | number | 0.0299 | change in the past 24 hours |
changeBod | number | 0.0156 | change since start of day (00:00 UTC) |
highLeverageFeeExempt | boolean | false | |
minProvideSize | number | 0.001 | Minimum maker order size (if >10 orders per hour fall below this size) |
type | string | future | "future" or "spot" |
underlying | string | BTC | 仅限期货市场 |
enabled | boolean | true | |
ask | number | 3949.25 | 最佳报价 |
bid | number | 3949.00 | 最佳报价 |
last | number | 3949.00 | 最近成交价 |
postOnly | boolean | false | if the market is in post-only mode (all orders get modified to be post-only, in addition to other settings they may have) |
price | number | 10579.52 | current price |
priceIncrement | number | 0.25 | |
sizeIncrement | number | 0.0001 | |
restricted | boolean | false | if the market has nonstandard restrictions on which jurisdictions can trade it |
volumeUsd24h | number | 28914.76 | USD volume in past 24 hours |
largeOrderThreshold | number | 5000.0 | threshold above which an order is considered large (for VIP rate limits) |
isEtfMarket | boolean | false | if the market has an ETF as its baseCurrency |
获取单个市场
请求
GET /markets/{market_name}
回复
See /markets
获取委托簿
请求
GET /markets/{market_name}/orderbook?depth={depth}
回复
{
"success": true,
"result": {
"asks": [
[
4114.25,
6.263
]
],
"bids": [
[
4112.25,
49.29
]
]
}
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market_name | string | BTC-0628 | Required. Name of the market. |
depth | number | 35 | max 100, default 20 |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
asks | array | [4114.25, 6.263] | Array with price and size |
bids | array | [4112, 49.29] | Array with price and size |
获取交易
Supports pagination
请求
GET /markets/{market_name}/trades
回复
{
"success": true,
"result": [
{
"id": 3855995,
"liquidation": false,
"price": 3857.75,
"side": "buy",
"size": 0.111,
"time": "2019-03-20T18:16:23.397991+00:00"
}
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market_name | string | BTC-0628 | name of the market |
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 3855995 | trade id |
liquidation | boolean | false | 如果这笔交易涉及清算单 |
price | number | 3857.75 | |
side | string | buy | |
size | number | 0.111 | |
time | string | 2019-03-20T18:16:23.397991+00:00 |
获取历史价格
Supports pagination
Historical prices of expired futures can be retrieved with this end point but make sure to specify start time and end time.
请求
GET /markets/{market_name}/candles?resolution={resolution}&start_time={start_time}&end_time={end_time}
回复
{
"success": true,
"result": [
{
"close": 11055.25,
"high": 11089.0,
"low": 11043.5,
"open": 11059.25,
"startTime": "2019-06-24T17:15:00+00:00",
"volume": 464193.95725
}
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market_name | string | BTC-0628 | name of the market |
resolution | number | 300 | 窗口时长(秒为)。 选项:15, 60, 300, 900, 3600, 14400, 86400, or any multiple of 86400 up to 30*86400 |
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
startTime | string | 2019-06-24T17:15:00+00:00 | 窗口开始时间 |
open | number | 11059.25 | 开始时间的标记价格 |
close | number | 11055.25 | 窗口结束时的标记价格:startTime(开始时间)+ 时间单位 |
high | number | 11089.0 | 窗口最高标记价格 |
low | number | 11059.25 | 窗口最低标记价格 |
volume | number | 464193.95725 | 窗口内交易量 |
期货
This section covers all types of futures on FTX: perpetual, expiring, and MOVE. Examples for each type are BTC-PERP
, BTC-0626
, and BTC-MOVE-1005
. For futures that expired
in 2019, prepend a 2019
to the date, like so: BTC-20190628
.
列出所有期货
请求
GET /futures
回复
{
"success": true,
"result": [
{
"ask": 4196,
"bid": 4114.25,
"change1h": 0,
"change24h": 0,
"changeBod": 0,
"volumeUsd24h": 100000000,
"volume": 24390.24,
"description": "Bitcoin March 2019 Futures",
"enabled": true,
"expired": false,
"expiry": "2019-03-29T03:00:00+00:00",
"index": 3919.58841011,
"imfFactor": 0.002,
"last": 4196,
"lowerBound": 3663.75,
"mark": 3854.75,
"name": "BTC-0329",
"openInterest": 12.23,
"openInterestUsd": 47265.8925,
"perpetual": false,
"positionLimitWeight": 1.0,
"postOnly": false,
"priceIncrement": 0.25,
"sizeIncrement": 0.0001,
"underlying": "BTC",
"upperBound": 4112.2,
"type": "future"
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ask | number | 4196.0 | 委托簿最佳报价 |
bid | number | 4114.25 | 委托簿最佳报价 |
change1h | number | 0.0 | 最近一小时的价格变动 |
change24h | number | 0.0 | 过去 24 小时内的价格变动 |
changeBod | number | 0.0 | 自午夜UTC(北京時間早上8:00)以来的价格变化 |
volumeUsd24h | number | 100000000 | 最近24小时的美元交易量 |
volume | number | 24390.24 | 过去 24 小时内的交易量 |
description | string | Bitcoin March 2019 Futures | |
enabled | boolean | true | |
expired | boolean | false | |
expiry | string | 2019-03-29T03:00:00+00:00 | |
index | number | 3919.58841011 | 指数成分市场的平均市价 |
imfFactor | number | 0.002 | |
last | number | 4196.0 | 期货最近成交价 |
lowerBound | number | 3663.75 | 期货可以交易的最低价 |
mark | number | 3854.75 | 期货标记价格 |
name | string | BTC-0329 | |
openInterest | number | 12.23 | open interest (in number of contracts) |
openInterestUsd | number | 47265.8925 | open interest (in USD) |
perpetual | boolean | false | 此合约是否为永续合约 |
positionLimitWeight | number | 1.0 | |
postOnly | boolean | false | |
priceIncrement | number | 0.25 | |
sizeIncrement | number | 0.0001 | |
underlying | string | BTC | |
upperBound | number | 4112.2 | 期货可以交易的最高价 |
type | string | future | “合约”,“永续”或“波动”之一 |
获取期货
请求
GET /futures/{future_name}
回复
{
"success": true,
"result": {
"ask": 4196,
"bid": 4114.25,
"change1h": 0,
"change24h": 0,
"description": "Bitcoin March 2019 Futures",
"enabled": true,
"expired": false,
"expiry": "2019-03-29T03:00:00+00:00",
"index": 3919.58841011,
"last": 4196,
"lowerBound": 3663.75,
"mark": 3854.75,
"name": "BTC-0329",
"perpetual": false,
"postOnly": false,
"priceIncrement": 0.25,
"sizeIncrement": 0.0001,
"underlying": "BTC",
"upperBound": 4112.2,
"type": "future"
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ask | number | 4196.0 | 委托簿最佳报价 |
bid | number | 4114.25 | 委托簿最佳报价 |
change1h | number | 0.0 | 最近一小时的价格变动 |
change24h | number | 0.0 | 过去 24 小时内的价格变动 |
description | string | Bitcoin March 2019 Futures | |
enabled | boolean | true | |
expired | boolean | false | |
expiry | string | 2019-03-29T03:00:00+00:00 | |
index | number | 3919.58841011 | 指数成分市场的平均市价 |
last | number | 4196.0 | 期货最近成交价 |
lowerBound | number | 3663.75 | 期货可以交易的最低价 |
mark | number | 3854.75 | 期货标记价格 |
name | string | BTC-0329 | |
perpetual | boolean | false | 此合约是否为永续合约 |
postOnly | boolean | false | |
priceIncrement | number | 0.25 | |
sizeIncrement | number | 0.0001 | |
underlying | string | BTC | |
upperBound | number | 4112.2 | 期货可以交易的最高价 |
type | string | future | “合约”,“永续”或“波动”之一 |
获取期货统计数据
请求
GET /futures/{future_name}/stats
回复
{
"success": true,
"result": {
"volume": 1000.23,
"nextFundingRate": 0.00025,
"nextFundingTime": "2019-03-29T03:00:00+00:00",
"expirationPrice": 3992.1,
"predictedExpirationPrice": 3993.6,
"strikePrice": 8182.35,
"openInterest": 21124.583
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
volume | number | 1000.23 | 最近24小时内交易的数量 |
nextFundingRate | number | 0.00025 | 后续融资费率(只适用于永续合约) |
nextFundingTime | string | 2019-03-29T03:00:00+00:00 | 后续融资时间(仅适用于永续合约) |
expirationPrice | number | 3992.1 | 期货到期的价格(仅在期货到期时适用) |
predictedExpirationPrice | number | 3993.0 | 仅适用于期货未到期的情况 |
openInterest | number | 21124.583 | 本期货持仓合约数量 |
strikePrice | number | 8182.35009484 | 到期日开始时标的价格(仅适用于MOVE合约) |
获取融资利率
Supports pagination
请求
GET /funding_rates
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
future | string | BTC-PERP | optional |
回复
{
"success": true,
"result": [
{
"future": "BTC-PERP",
"rate": 0.0025,
"time": "2019-06-02T08:00:00+00:00"
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
future | string | BTC-PERP | |
rate | number | 0.0025 | |
time | string | 2019-06-02T08:00:00+00:00 |
Get index weights
请求
GET /indexes/{index_name}/weights
Note that this only applies to index futures, e.g. ALT/MID/SHIT/EXCH/DRAGON.
回复
{
"success": true,
"result": {
"BCH": 0.3492,
"BNB": 2.8632,
"BSV": 0.3471,
"EOS": 18.1707,
"ETH": 0.5724,
"LTC": 1.2973,
"XRP": 573.6345,
}
}
Get expired futures
Returns the list of all expired futures.
请求
GET /expired_futures
回复
{
"success": true,
"result": [
{
"ask": null,
"bid": null,
"description": "Bitcoin March 2020 Futures",
"enabled": false,
"expired": true,
"expiry": "2020-03-27T03:00:00+00:00",
"expiryDescription": "March 2020",
"group": "quarterly",
"imfFactor": 0.002,
"index": 6807.943073426,
"last": 6804.75,
"lowerBound": 6467.75,
"marginPrice": 6801.1226609324885,
"mark": 6801.1226609324885,
"moveStart": null,
"name": "BTC-0327",
"perpetual": false,
"positionLimitWeight": 2.0,
"postOnly": false,
"priceIncrement": 0.5,
"sizeIncrement": 0.0001,
"type": "future",
"underlying": "BTC",
"underlyingDescription": "Bitcoin",
"upperBound": 7152.75
}
]
}
Get historical index
Supports pagination
请求
GET /indexes/{market_name}/candles?resolution={resolution}&start_time={start_time}&end_time={end_time}
回复
{
"success": true,
"result": [
{
"close": 11055.25,
"high": 11089.0,
"low": 11043.5,
"open": 11059.25,
"startTime": "2019-06-24T17:15:00+00:00",
"volume": null
}
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market_name | string | BTC | name of the market |
resolution | number | 300 | 窗口时长(秒为)。 选项:15, 60, 300, 900, 3600, 14400, 86400, or any multiple of 86400 up to 30*86400 |
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
startTime | string | 2019-06-24T17:15:00+00:00 | start time of the window |
open | number | 11059.25 | mark price at startTime |
close | number | 11055.25 | mark price at the end of the window: startTime + resolution |
high | number | 11089.0 | highest mark price over the window |
low | number | 11059.25 | lowest mark price over the window |
volume | number | null | volume traded in the window |
Get index constituents
请求
GET /index_constituents/{underlying}
回复
{
"success": true,
"result": [
["binance","BTC","TUSD"],
["bitstamp","BTC","USD"],
["bittrex","BTC","USD"],
...
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
underlying | string | BTC | underlying coin for index |
回复格式
Response is a list of index inputs, each row contains:
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
exchange | string | binance | index constituent source |
base currency | string | BTC | |
quote currency | string | TUSD |
账户
获取账户信息
请求
GET /account
回复
{
"success": true,
"result": {
"backstopProvider": true,
"collateral": 3568181.02691129,
"freeCollateral": 1786071.456884368,
"initialMarginRequirement": 0.12222384240257728,
"leverage": 10,
"liquidating": false,
"maintenanceMarginRequirement": 0.07177992558058484,
"makerFee": 0.0002,
"marginFraction": 0.5588433331419503,
"openMarginFraction": 0.2447194090423075,
"takerFee": 0.0005,
"totalAccountValue": 3568180.98341129,
"totalPositionSize": 6384939.6992,
"username": "[email protected]",
"positions": [
{
"cost": -31.7906,
"entryPrice": 138.22,
"future": "ETH-PERP",
"initialMarginRequirement": 0.1,
"longOrderSize": 1744.55,
"maintenanceMarginRequirement": 0.04,
"netSize": -0.23,
"openSize": 1744.32,
"realizedPnl": 3.39441714,
"shortOrderSize": 1732.09,
"side": "sell",
"size": 0.23,
"unrealizedPnl": 0
}
]
}
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
backstopProvider | boolean | true | 该账户是否为是注册的流动性支持提供者 |
collateral | number | 3568181.02691129 | 抵押金额 |
freeCollateral | number | 1786071.456884368 | 免费抵押金额 |
initialMarginRequirement | number | 0.12222384240257728 | 单个期货品种的 initialMarginRequirement(初始保证金要求),按名义头寸加权。 如果 openMarginFraction(开仓保证金比例)低于该值则无法新开头寸。 |
liquidating | boolean | false | 如果账户正在清算则为是 |
maintenanceMarginRequirement | number | 0.07177992558058484 | 单个期货品种的 maintenanceMarginRequirement(持仓保证金要求)平均金额,按名义头寸加权。 如果保证金比例低于该值,则进入清算模式。 |
makerFee | number | 0.0002 - | |
marginFraction | number | 0.5588433331419503 - | 账户总值和账户名义头寸总额之比 |
openMarginFraction | number | 0.2447194090423075 | 已实现账户价值总额和已建立名义头寸总额之比 |
takerFee | number | 0.0005 | |
totalAccountValue | number | 3568180.98341129 | 以头寸标记价格计算的账户总值 |
totalPositionSize | number | 6384939.6992 | 以标记价格计算的账户持有头寸总额 |
username | string | [email protected] |
|
leverage | number | 10.0 | Max account leverage |
positions | array | See Get positions for details |
Request historical balances and positions snapshot
请求
POST /historical_balances/requests
{
"accounts": ["main", "subaccount1"],
"endTime": 1646376865,
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
accounts | list | ["main", "subaccount1"] | list of subaccounts to request results for |
endTime | number | 1646376865 | time to fetch balances and positions for |
回复
{
"success": true,
"result": 12332
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 12332 | id of the snapshot |
Get historical balances and positions snapshot
请求
GET /historical_balances/requests/<request_id>
需要验证身份。
回复
{
"success": true,
"result": {
"id": 12332,
"accounts": ["main", "subaccounts"],
"time": 1646356865,
"endTime": 1646376865,
"status": "done",
"error": false,
"results": [
{"account": "main", "ticker": "BTC-PERP", "size": -1.2, "price": 40122.13},
{"account": "main", "ticker": "USD", "size": 10000.3},
]
}
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 12332 | |
accounts | list | ["main", "subaccount1"] | list of subaccounts to request results for |
time | number | 1646356865 | time the request was made |
endTime | number | 1646376865 | time of balances and positions |
error | boolean | false | if there was an error in generating the snapshot |
status | string | complete | one of 'requested', 'processing', 'done', 'cancelled' |
results | dict | balance and position snapshots |
Each item in results
has the format:
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
account | string | main | name of subaccount |
ticker | string | BTC-PERP | name of product (future, option, token, or currency) |
size | number | -1.2 | size of balance or position at endTime |
price | number | 40122.13 | mark price of future at endTime (null for options and balances entries) |
Get all historical balances and positions snapshots
请求
GET /historical_balances/requests
需要验证身份。
回复
{
"success": true,
"result": [
{
"id": 12332,
"accounts": ["main", "subaccounts"],
"time": 1646356865,
"endTime": 1646376865,
"status": "done",
"error": false,
"results": [
{"account": "main", "ticker": "BTC-PERP", "size": -1.2, "price": 40122.13},
{"account": "main", "ticker": "USD", "size": 10000.3},
]
}
]
}
获取头寸
请求
GET /positions
回复
{
"success": true,
"result": [
{
"cost": -31.7906,
"cumulativeBuySize": 1.2,
"cumulativeSellSize": 0.0,
"entryPrice": 138.22,
"estimatedLiquidationPrice": 152.1,
"future": "ETH-PERP",
"initialMarginRequirement": 0.1,
"longOrderSize": 1744.55,
"maintenanceMarginRequirement": 0.04,
"netSize": -0.23,
"openSize": 1744.32,
"realizedPnl": 3.39441714,
"recentAverageOpenPrice": 135.31,
"recentBreakEvenPrice": 135.31,
"recentPnl": 3.1134,
"shortOrderSize": 1732.09,
"side": "sell",
"size": 0.23,
"unrealizedPnl": 0,
"collateralUsed": 3.17906
}
]
}
需要验证身份。
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
showAvgPrice | boolean | false | optional |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
cost | number | -31.7906 | 建立此头寸所支付的金额等于头寸大小*建仓价格。 做多为正,做空为负。 |
cumulativeBuySize | number | 1.2 | |
cumulativeSellSize | number | 0.0 | |
entryPrice | number | 138.22 | 上一次实现盈亏后此头寸的平均成本:每当实现未实现的盈亏时,此字段就会设置为标记价格,未实现盈亏会设置为0,并且实现盈亏会根据未实现盈亏的先前值进行更改。 |
estimatedLiquidationPrice | number | 152.1 | |
future | string | ETH-PERP | 期货名称 |
initialMarginRequirement | number | 0.1 | 建立新头寸的最低保证金比例 |
longOrderSize | number | 1744.55 | 所有未执行报价累计数额 |
maintenanceMarginRequirement | number | 0.04 | 避免清算的最低保证金比例 |
netSize | number | -0.23 | 头寸大小。 做多为正,做空为负。 |
openSize | number | 1744.32 | 未执行挂单得到部分执行时可能的最大绝对头寸 |
realizedPnl | number | 3.39441714 | |
recentAverageOpenPrice | number | 135.31 | |
recentBreakEvenPrice | number | 135.31 | |
recentPnl | number | 3.1134 | |
shortOrderSize | number | 1732.09 | 所有未执行挂单累计数额 |
side | string | sell | 做空为“卖出”,做多为“买入” |
size | number | 0.23 | netSize 的绝对价值 |
unrealizedPnl | number | 0.0 | |
collateralUsed | number | 3.17906 | Is equal to:
|
更改账户杠杆倍数
请求
POST /account/leverage
{
"leverage": 10,
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
leverage | number | 10 | desired account-wide leverage setting |
钱包
获取币
请求
GET /wallet/coins
回复
{
"success": true,
"result": [
{
"bep2Asset": null,
"canConvert": true,
"canDeposit": true,
"canWithdraw": true,
"collateral": true,
"collateralWeight": 0.975,
"creditTo": null,
"erc20Contract": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"fiat": false,
"hasTag": false,
"id": "USDT",
"isToken": false,
"methods": ["omni", "erc20", "trx", "sol"],
"name": "USD Tether",
"splMint": "BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4",
"trc20Contract": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"usdFungible": false
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
canDeposit | boolean | true | true if this coin can be deposited via a crypto transaction |
canWithdraw | boolean | true | true if this coin can be withdrawn via a crypto transaction |
hasTag | boolean | false | true if addresses for this coin have a tag |
id | string | USDT | |
name | string | USD Tether | |
bep2Asset | string | null | |
canConvert | boolean | true | |
collateral | boolean | true | |
collateralWeight | number | 0.975 | |
creditTo | string | null | |
erc20Contract | string | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | |
fiat | boolean | false | |
isToken | boolean | false | |
methods | array | ["omni", "erc20", "trx", "sol"] | |
splMint | string | BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4 | |
trc20Contract | string | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | |
usdFungible | boolean | false |
获取余额
请求
GET /wallet/balances
回复
{
"success": true,
"result": [
{
"coin": "USDTBEAR",
"free": 2320.2,
"spotBorrow": 0.0,
"total": 2340.2,
"usdValue": 2340.2,
"availableWithoutBorrow": 2320.2
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDTBEAR | coin id |
free | number | 2320.2 | free amount |
spotBorrow | number | 0 | amount borrowed using spot margin |
total | number | 2340.2 | total amount |
usdValue | number | 2340.2 | approximate total amount in USD |
availableWithoutBorrow | number | 2320.2 | amount available without borrowing |
获取所有帐户的余额
请求
GET /wallet/all_balances
回复
{
"success": true,
"result": {
"main": [
{
"coin": "USDTBEAR",
"free": 2320.2,
"spotBorrow": 0.0,
"total": 2340.2,
"usdValue": 2340.2,
"availableWithoutBorrow": 2320.2
},
{
"coin": "BTC",
"free": 2.0,
"spotBorrow": 0.0,
"total": 3.2,
"usdValue": 23456.7,
"availableWithoutBorrow": 2.0
}
],
"Battle Royale": [
{
"coin": "USD",
"free": 2000.0,
"spotBorrow": 0.0,
"total": 2200.0,
"usdValue": 2200.0,
"availableWithoutBorrow": 2000.0
}
]
}
}
需要验证身份。
响应将包含一个对象,其私钥是子帐户名称。主帐户将显示在私钥“主”下。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDTBEAR | coin id |
free | number | 2320.2 | free amount |
spotBorrow | number | 0 | amount borrowed using spot margin |
total | number | 2340.2 | total amount |
usdValue | number | 2340.2 | total amount in USD |
availableWithoutBorrow | number | 2320.2 | amount available without borrowing |
获取存款地址
请求
GET /wallet/deposit_address/{coin}?method={method}
回复
{
"success": true,
"result": {
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": null
}
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDT | |
method | string | erc20 | optional; for coins available on different blockchains (e.g USDT) |
- For
ERC20
tokens:method=erc20
- For
TRC20
tokens:method=trx
- For
SPL
tokens:method=sol
- For
Omni
tokens:method=omni
- For
BEP2
tokens:method=bep2
- For
Binance Smart Chain
tokens:method=bsc
- For
Fantom
tokens:method=ftm
- For
Avax
tokens:method=avax
- For
Matic
tokens:method=matic
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
|
tag | string | null |
optional |
Get deposit address list
请求
POST /wallet/deposit_address/list
[
{
"coin": "USDT",
"method": "erc20"
},
{
"coin": "ETH",
}
]
回复
{
"success": true,
"result": [{
"coin": "USDT"
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": "null"
}]
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDT | |
method | string | erc20 | optional; for coins available on different blockchains (e.g USDT) |
- For
ERC20
tokens:method=erc20
- For
TRC20
tokens:method=trx
- For
SPL
tokens:method=sol
- For
Omni
tokens:method=omni
- For
BEP2
tokens:method=bep2
- For
Binance Smart Chain
tokens:method=bsc
- For
Fantom
tokens:method=ftm
- For
Avax
tokens:method=avax
- For
Matic
tokens:method=matic
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDT | |
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
|
tag | string | null |
optional |
获取存入记录
请求
GET /wallet/deposits
回复
{
"success": true,
"result": [
{
"coin": "TUSD",
"confirmations": 64,
"confirmedTime": "2019-03-05T09:56:55.728933+00:00",
"fee": 0,
"id": 1,
"sentTime": "2019-03-05T09:56:55.735929+00:00",
"size": 99.0,
"status": "confirmed",
"time": "2019-03-05T09:56:55.728933+00:00",
"txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
}
]
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1564146934 | optional; minimum time of items to return, in Unix time (seconds since 1970-01-01) |
end_time | number | 1564233334 | optional; maximum time of items to return, in Unix time (seconds since 1970-01-01) |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | TUSD | coin id |
confirmations | number | 64 | number of blockchain confirmations |
confirmedTime | string | 2019-03-05T09:56:55.728933+00:00 | |
fee | number | 0.0 | fee, not included in size |
id | number | 1 | deposit id |
sentTime | string | 2019-03-05T09:56:55.735929+00:00 | |
size | string | 99.0 | |
status | string | confirmed | one of "confirmed", "unconfirmed", or "cancelled" |
time | string | 2019-03-05T09:56:55.728933+00:00 | |
txid | string | 0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1 |
optional |
notes | string | Transfer from main account to my_subaccount | optional |
获取提现历史记录
请求
GET /wallet/withdrawals
回复
{
"success": true,
"result": [
{
"coin": "TUSD",
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": null,
"fee": 0,
"id": 1,
"size": 99.0,
"status": "complete",
"time": "2019-03-05T09:56:55.728933+00:00",
"method": "erc20",
"txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
}
]
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1564146934 | optional; minimum time of items to return, in Unix time (seconds since 1970-01-01) |
end_time | number | 1564233334 | optional; maximum time of items to return, in Unix time (seconds since 1970-01-01) |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | TUSD | coin id |
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
deposit address the withdrawal was sent to |
tag | string | null | |
fee | number | 0.0 | fee, not included in size |
id | number | 1 | withdrawal id |
size | string | 99.0 | |
status | string | complete | one of "requested", "processing", "sent", "complete", or "cancelled" |
time | string | 2019-03-05T09:56:55.728933+00:00 | |
method string | erc20 | protocol used for the blockchain transfer | |
txid | string | 0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1 |
optional |
notes | string | Transfer from main account to my_subaccount | optional |
请求提现
请求
POST /wallet/withdrawals
{
"coin": "USDTBEAR",
"size": 20.2,
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": null,
"password": "my_withdrawal_password",
"code": 152823
}
回复
{
"success": true,
"result": {
"coin": "USDTBEAR",
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": null,
"fee": 0,
"id": 1,
"size": 20.2,
"status": "requested",
"time": "2019-03-05T09:56:55.728933+00:00",
"txid": null
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDTBEAR | coin to withdraw |
size | number | 20.2 | amount to withdraw |
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
address to send to |
tag | string | null | optional |
method | string | null | optional; blockchain to use for withdrawal |
password | string | null | optional; withdrawal password if it is required for your account |
code | string | null | optional; 2fa code if it is required for your account |
- For
ERC20
tokens:method=erc20
- For
TRC20
tokens:method=trx
- For
SPL
tokens:method=sol
- For
Omni
tokens:method=omni
- For
BEP2
tokens:method=bep2
- For
Binance Smart Chain
tokens:method=bsc
- For
Fantom
tokens:method=ftm
- For
Avax
tokens:method=avax
- For
Matic
tokens:method=matic
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDTBEAR | coin id |
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
deposit address the withdrawal was sent to |
tag | string | null | |
fee | number | 0.0 | fee, not included in size |
id | number | 1 | withdrawal id |
size | string | 20.2 | |
status | string | requested | one of "requested", "processing", "complete", or "cancelled" |
time | string | 2019-03-05T09:56:55.728933+00:00 | |
txid | string | null |
Get airdrops
This endpoint provides you with updates to your AMPL balances based on AMPL rebases.
请求
GET /wallet/airdrops
回复
{
"success": true,
"result": [
{
"coin": "AMPL",
"id": 1,
"size": 99.0,
"time": "2019-03-05T09:56:55.728933+00:00",
"status": "complete"
}
]
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1564146934 | optional; minimum time of items to return, in Unix time (seconds since 1970-01-01) |
end_time | number | 1564233334 | optional; maximum time of items to return, in Unix time (seconds since 1970-01-01) |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | AMPL | coin id |
id | number | 1 | aidrop id |
size | string | 99.0 | |
status | string | confirmed | one of "confirmed" or "pending" |
time | string | 2019-03-05T09:56:55.728933+00:00 |
Get withdrawal fees
请求
GET /wallet/withdrawal_fee
{
"coin": "USDC",
"size": 20.2,
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"tag": null
}
回复
{
"success": true,
"result": {
"method": "erc20",
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"fee": 0,
"congested": false
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | COIN | coin to withdraw |
size | number | 20.2 | amount to withdraw |
address | string | 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE |
address to send to |
tag | string | null | optional |
method | string | erc20 | optional; for coins available on different blockchains (e.g USDT) |
- For
ERC20
tokens:method=erc20
- For
TRC20
tokens:method=trx
- For
SPL
tokens:method=sol
- For
Omni
tokens:method=omni
- For
BEP2
tokens:method=bep2
- For
Binance Smart Chain
tokens:method=bsc
- For
Fantom
tokens:method=ftm
- For
Avax
tokens:method=avax
- For
Matic
tokens:method=matic
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
method | string | blockchain protocol that will be used | |
fee | number | 0 | fee that will be charged on the withdrawal (size - fee will be sent to the destination) |
congested | boolean | false | if this blockchain is currently congested |
Get saved addresses
This endpoint provides you with your saved addresses
请求
GET /wallet/saved_addresses
回复
{
"success": true,
"result": [
{
"address": "0xb2EA1CC386A260c9Ae3ebda2cb7AEd212b034Ab4",
"coin": "ETH",
"fiat": false,
"id": 31189,
"isPrimetrust": false,
"lastUsedAt": "2020-09-21T15:38:11.795763+00:00",
"name": "MetaMask 1",
"tag": null,
"whitelisted": true,
"whitelistedAfter": "2020-08-26T09:41:53.959256+00:00"
},
{
"address": "0xE4Ba8791E0fdbdc50024898A384FecFD90e69553",
"coin": "ETH",
"fiat": false,
"id": 46725,
"isPrimetrust": false,
"lastUsedAt": "2020-09-21T09:16:46.918175+00:00",
"name": "Ledger Nano S",
"tag": null,
"whitelisted": true,
"whitelistedAfter": "2020-09-21T09:16:16.829467+00:00"
}
]
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | ETH | optional, filters saved addresses by coin; |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
address | string | "0xb2EA1CC386A260c9Ae3ebda2cb7AEd212b034Ab4" | |
coin | string | ETH | coin id |
fiat | boolean | false | |
id | int | 31189 | |
isPrimetrust | boolean | false | |
lastUsedAt | string | "2020-09-21T15:38:11.795763+00:00" | |
tag | string | null | |
whitelisted | boolean | true | true if the address is whitelisted, null if the address has never been whitelisted or has been unwhitelisted |
whitelistedAfter | string | "2020-09-21T09:16:16.829467+00:00" | Date after which the address has been whitelisted, null if the address has never been whitelisted or has been unwhitelisted |
Create saved addresses
请求
POST /wallet/saved_addresses
{
"coin": "USDC",
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"wallet": "sol",
"addressName": "MetaMask",
"code": 123456
}
回复
{
"success": true,
"result": {
"address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
"coin": "USDC",
"fiat": false,
"id": 52382,
"isPrimetrust": false,
"isSwipeCard": false,
"lastUsedAt": "2020-10-08T06:11:03.072427+00:00",
"name": "MetaMask",
"tag": null,
"wallet": "sol",
"whitelisted": null,
"whitelistedAfter": null
}
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USDC | coin id |
address | string | 0xb2EA1CC386A260c9Ae3ebda2cb7AEd212b034Ab4 | |
wallet | string | sol | chain; must be supplied for multi-chain coins |
addressName | string | MetaMask | |
isPrimetrust | boolean | false | |
tag | string | null | optional, tag for the address |
whitelist | boolean | false | Pass true if the user has whitelisting enabled and would like this new address to be whitelisted |
code | number | 123456 | optional; 2fa code if it is required for your account |
- For
ERC20
tokens:wallet=erc20
- For
TRC20
tokens:wallet=trx
- For
SPL
tokens:wallet=sol
- For
Omni
tokens:wallet=omni
- For
BEP2
tokens:wallet=bep2
- For
Binance Smart Chain
tokens:wallet=bsc
- For
Fantom
tokens:wallet=ftm
- For
Avax
tokens:wallet=avax
- For
Matic
tokens:wallet=matic
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
address | string | 0xb2EA1CC386A260c9Ae3ebda2cb7AEd212b034Ab4 | |
coin | string | USDC | coin id |
fiat | boolean | false | |
id | int | 52382 | |
isPrimetrust | boolean | false | |
isSwipeCard | boolean | false | |
lastUsedAt | string | 2020-10-08T06:11:03.072427+00:00 | |
name | string | MetaMask | |
tag | string | null | |
wallet | string | sol | chain; must be supplied for multi-chain coins |
whitelisted | boolean | null | true if the address is whitelisted, null if the address has never been whitelisted or has been unwhitelisted |
whitelistedAfter | boolean | null | Date after which the address has been whitelisted, null if the address has never been whitelisted or has been unwhitelisted |
Delete saved addresses
请求
DELETE /wallet/saved_addresses/{saved_address_id}
回复
{
"success": true,
"result": "Address deleted"
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
saved_address_id | int | 52382 |
Register a SEN deposit
请求
POST /sen/deposits/{sen_link_id}
{
"size": 175.0
}
回复
"Success"
需要验证身份。
Register a SEN deposit within our system. In order to be auto-credited, you must register the deposit with us beforehand.
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
sen_link_id | int | 142 | Unique ID of the SEN link |
size | number | 175.0 | Amount of the deposit |
Request a SEN withdrawal
请求
POST /sen/withdrawals/{sen_link_id}
{
"size": 175.0
}
回复
"Success"
需要验证身份。
Request a Signet withdrawal.
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
signet_link_id | int | 142 | Unique ID of the SEN link |
size | number | 175.0 | Amount of the withdrawal |
Register a Signet deposit
请求
POST /signet/deposits/{signet_link_id}
{
"size": 175.0
}
回复
"Success"
需要验证身份。
Request a Signet withdrawal.
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
signet_link_id | int | 142 | Unique ID of the Signet link |
size | number | 175.0 | Amount of the deposit |
Request a Signet withdrawal
请求
POST /signet/withdrawals/{signet_link_id}
{
"size": 175.0
}
回复
"Success"
需要验证身份。
Request a Signet withdrawal.
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
signet_link_id | int | 142 | Unique ID of the Signet link |
size | number | 175.0 | Amount of the withdrawal |
买卖盘
获取未执行的挂单
请求
GET /orders?market={market}
回复
{
"success": true,
"result": [
{
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"filledSize": 10,
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"price": 0.306525,
"avgFillPrice": 0.306526,
"remainingSize": 31421,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null
}
]
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | BTC-0329 | optional; market to limit orders |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 9596912 | |
market | string | XRP-PERP | |
type | string | limit | |
side | string | sell | |
price | number | 0.306525 | |
size | number | 31431.0 | |
filledSize | number | 10.0 | |
remainingSize | number | 31421.0 | |
avgFillPrice | number | 0.306526 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | optional; client order id |
获取订单历史记录
请求
GET /orders/history?market={market}
回复
{
"success": true,
"result": [
{
"avgFillPrice": 10135.25,
"clientId": null,
"createdAt": "2019-06-27T15:24:03.101197+00:00",
"filledSize": 0.001,
"future": "BTC-PERP",
"id": 257132591,
"ioc": false,
"market": "BTC-PERP",
"postOnly": false,
"price": 10135.25,
"reduceOnly": false,
"remainingSize": 0.0,
"side": "buy",
"size": 0.001,
"status": "closed",
"type": "limit"
},
],
"hasMoreData": false,
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | BTC-0329 | optional; market to limit orders |
side | string | buy | optional; buy or sell side |
orderType | string | limit | optional; market or limit orders |
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559901511 | optional; only fetch orders created before this time |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 257132591 | |
market | string | BTC-PERP | |
type | string | limit | |
side | string | buy | |
price | number | 10135.25 | |
size | number | 0.001 | |
filledSize | number | 0.001 | |
remainingSize | number | 0.0 | |
avgFillPrice | number | 10135.25 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
createdAt | string | 2019-06-27T15:24:03.101197+00:00 | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | optional; client order id |
获取未完成触发挂单
请求
GET /conditional_orders?market={market}
回复
{
"success": true,
"result": [
{
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"error": null,
"future": "XRP-PERP",
"id": 50001,
"market": "XRP-PERP",
"orderId": null,
"orderPrice": null,
"reduceOnly": false,
"side": "buy",
"size": 0.003,
"status": "open",
"trailStart": null,
"trailValue": null,
"triggerPrice": 0.49,
"triggeredAt": null,
"type": "stop"
"orderType": "market",
"filledSize": 0,
"avgFillPrice": null,
"retryUntilFilled": false
]
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | XRP-PERP | optional; market to limit orders |
type | string | stop | optional; type of trigger order (stop , trailing_stop , or take_profit ) |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
error | string | null | [DEPRECATED] error that occurred on most recent trigger, if exists; otherwise null |
future | string | XRP-PERP | |
id | number | 50001 | |
market | string | XRP-PERP | |
orderId | number | null | [DEPRECATED] order id of the most recent trigger, if exixsts; otherwise null |
orderPrice | number | 0.50 | Limit price for stop limit and take profit limit orders; otherwise null |
reduceOnly | boolean | false | |
side | string | buy | |
size | number | 31431.0 | |
status | string | open | Always open for this endpoint |
trailStart | number | null | trigger price - trail value; only for trailing stop orders |
trailValue | number | null | only for trailing stop orders |
triggerPrice | number | 0.49 | market price at which this order will trigger |
triggeredAt | string | null | time of first trigger. null if never triggered |
type | string | stop | Values are stop , trailing_stop , and take_profit |
orderType | string | market | Values are market , limit |
filledSize | number | 0 | |
avgFillPrice | number | null | |
retryUntilFilled | boolean | false | Whether or not to keep re-triggering until filled |
获取计划委托的触发价格/条件
请求
GET /conditional_orders/{conditional_order_id}/triggers
回复
{
"success": true,
"result": [
{
"error": null,
"filledSize": 4.0,
"orderSize": 10.0,
"orderId": 38066650,
"time": "2020-01-19T09:23:36.570904+00:00"
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
time | string | 2019-03-05T09:56:55.728933+00:00 | |
orderSize | number | 31431.0 | null if order failed to place |
filledSize | number | 0 | null if order failed to place |
orderId | number | null if order failed to place | |
error | string | null | reason for order failing to be placed, null if successful |
获取触发挂单历史记录
请求
GET /conditional_orders/history?market={market}
回复
{
"success": true,
"result": [
{
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"error": null,
"future": "XRP-PERP",
"id": 50000,
"market": "XRP-PERP",
"orderId": 2800000,
"orderPrice": null,
"reduceOnly": false,
"side": "buy",
"size": 31431,
"status": "triggered",
"trailStart": null,
"trailValue": null,
"triggerPrice": 0.37,
"triggeredAt": 2019-03-06T03:26:53.268723+00:00,
"type": "stop",
"orderType": "market",
"filledSize": 31431,
"avgFillPrice": 0.3701,
"orderStatus": "closed",
"orderType": "market",
"filledSize": 0,
"avgFillPrice": null,
"retryUntilFilled": false,
},
],
"hasMoreData": false,
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | BTC-0329 | optional; market to limit orders |
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559881511 | optional; only fetch orders created before this time |
side | string | buy | optional; valid values are buy and sell . |
type | string | trailing_stop | optional; valid values are stop , trailing_stop , and take_profit . |
orderType | string | limit | optional; valid values are market and limit . |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
error | string | null | [DEPRECATED] error that occurred on most recent trigger, if exists; otherwise null |
future | string | XRP-PERP | |
id | number | 50001 | |
market | string | XRP-PERP | |
orderId | number | null | [DEPRECATED] order ID if this order has triggered; otherwise null |
orderPrice | number | 0.50 | Limit price for stop limit and take profit limit orders; otherwise null |
reduceOnly | boolean | false | |
side | string | buy | |
size | number | 31431.0 | |
status | string | open | Values are open , cancelled , and triggered |
trailStart | number | null | trigger price - trail value; only for trailing stop orders |
trailValue | number | null | only for trailing stop orders |
triggerPrice | number | 0.49 | market price at which this order will trigger |
triggeredAt | string | null | time of first trigger. null if never triggered |
type | string | stop | Values are stop , trailing_stop , and take_profit |
orderType | string | market | Values are market and limit |
filledSize | number | 31431 | |
avgFillPrice | number | 0.3701 | |
orderStatus | string | closed | [DEPRECATED] status of most recent trigger's order: new , open or closed |
orderType | string | market | Values are market , limit |
filledSize | number | 0 | |
avgFillPrice | number | null | |
retryUntilFilled | boolean | false | Whether or not to keep re-triggering until filled |
下单
请求
POST /orders
{
"market": "XRP-PERP",
"side": "sell",
"price": 0.306525,
"type": "limit",
"size": 31431.0,
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null
}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"filledSize": 0,
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"price": 0.306525,
"remainingSize": 31431,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null,
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | XRP-PERP | e.g. "BTC/USD" for spot, "XRP-PERP" for futures |
side | string | sell | "buy" or "sell" |
price | number | 0.306525 | Send null for market orders. |
type | string | limit | "limit" or "market" |
size | number | 31431.0 | |
reduceOnly | boolean | false | optional; default is false |
ioc | boolean | false | optional; default is false |
postOnly | boolean | false | optional; default is false |
clientId | string | null | optional; client order id |
rejectOnPriceBand | boolean | false | optional; if the order should be rejected if its price would instead be adjusted due to price bands |
rejectAfterTs | number | null | optional; if the order would be put into the placement queue after this timestamp, instead reject it. If it would be placed on the orderbook after the timestamp, then immediately close it instead (as if it were, for instance, a post-only order that would have taken) |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
filledSize | number | 0.0 | |
future | string | XRP-PERP | |
id | number | 9596912 | |
market | string | XRP-PERP | |
price | number | 0.306525 | |
remainingSize | number | 31431.0 | |
side | string | sell | |
size | number | 31431.0 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
type | string | limit | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | optional; client order id, if supplied |
设置计划委托
计划委托包括了止损,移动止损以及止盈等委托。
请求
POST /conditional_orders
- 止损
{
"market": "XRP-PERP",
"side": "sell",
"triggerPrice": 0.306525,
"size": 31431.0,
"type": "stop",
"reduceOnly": false,
}
- 移动止损
{
"market": "XRP-PERP",
"side": "sell",
"trailValue": -0.05,
"size": 31431.0,
"type": "trailingStop",
"reduceOnly": false,
}
- 止盈
{
"market": "XRP-PERP",
"side": "buy",
"triggerPrice": 0.367895,
"size": 31431.0,
"type": "takeProfit",
"reduceOnly": false,
}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"triggerPrice": 0.306525,
"orderId": null,
"side": "sell",
"size": 31431,
"status": "open",
"type": "stop",
"orderPrice": null,
"error": null,
"triggeredAt": null,
"reduceOnly": false,
"orderType": "market",
"retryUntilFilled": false,
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | XRP-PERP | |
side | string | sell | "buy" or "sell" |
size | number | 31431.0 | |
type | string | stop | "stop", "trailingStop", "takeProfit"; default is stop |
reduceOnly | boolean | false | optional; default is false |
retryUntilFilled | boolean | false | Whether or not to keep re-triggering until filled. optional, default true for market orders |
为止损委托增加的参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
triggerPrice | number | 0.306525 | |
orderPrice | number | 0.3063 | optional; order type is limit if this is specified; otherwise market |
为移动止损委托增加的参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
trailValue | number | -0.05 | negative for "sell"; positive for "buy" |
为止盈委托增加的参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
triggerPrice | number | 0.306525 | |
orderPrice | number | 0.3067 | optional; order type is limit if this is specified; otherwise market |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
future | string | XRP-PERP | |
id | number | 9596912 | |
market | string | XRP-PERP | |
triggerPrice | number | 0.306525 | |
orderId | number | 123123 | [DEPRECATED] ID of the order sent on the most recent trigger, if exists |
side | string | sell | |
size | number | 31431.0 | |
status | string | Values are open , cancelled , and triggered |
|
type | string | stop | |
orderPrice | number | null | price of the order sent when this stop loss triggered |
error | string | null | [DEPRECATED] error message for unsuccessful order placement when this stop loss triggered |
triggeredAt | string | null | time at which this stop loss order triggered |
reduceOnly | boolean | false | |
orderType | string | market | Values are market , limit |
retryUntilFilled | boolean | false | Whether or not to keep re-triggering until filled |
修改订单
请求
POST /orders/{order_id}/modify
{
"size": 31431,
"price": 0.326525,
}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T11:56:55.728933+00:00",
"filledSize": 0,
"future": "XRP-PERP",
"id": 9596932,
"market": "XRP-PERP",
"price": 0.326525,
"remainingSize": 31431,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null,
}
}
Please note that the order's queue priority will be reset, and the order ID of the modified order will be different from that of the original order. Also note: this is implemented as cancelling and replacing your order. There's a chance that the order meant to be cancelled gets filled and its replacement still gets placed.
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
price | number | 0.306525 | optional; either price or size must be specified |
size | number | 31431.0 | optional; either price or size must be specified |
clientId | string | order1 | optional; client ID for the modified order |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T11:56:55.728933+00:00 | |
filledSize | number | 0.0 | |
future | string | XRP-PERP | |
id | number | 9596932 | |
market | string | XRP-PERP | |
price | number | 0.326525 | |
remainingSize | number | 31431.0 | |
side | string | sell | |
size | number | 31431.0 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
type | string | limit | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | optional; client order id, if supplied |
根据Client ID修改订单
请求
POST /orders/by_client_id/{client_order_id}/modify
{
"size": 31431,
"price": 0.326525,
}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T11:56:55.728933+00:00",
"filledSize": 0,
"future": "XRP-PERP",
"id": 9596932,
"market": "XRP-PERP",
"price": 0.326525,
"remainingSize": 31431,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null,
}
}
Please note that the order's queue priority will be reset, and the order ID of the modified order will be different from that of the original order. Also note: this is implemented as cancelling and replacing your order. There's a chance that the order meant to be cancelled gets filled and its replacement still gets placed.
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
price | number | 0.306525 | optional; either price or size must be specified |
size | number | 31431.0 | optional; either price or size must be specified |
clientId | string | order1 | optional; client ID for the modified order |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T11:56:55.728933+00:00 | |
filledSize | number | 0.0 | |
future | string | XRP-PERP | |
id | number | 9596932 | |
market | string | XRP-PERP | |
price | number | 0.326525 | |
remainingSize | number | 31431.0 | |
side | string | sell | |
size | number | 31431.0 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
type | string | limit | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | optional; client order id, if supplied |
修改触发订单
计划委托包括了止损,移动止损以及止盈等委托。
请求
POST /conditional_orders/{order_id}/modify
- 止损
{
"triggerPrice": 0.306225,
"size": 31431.0,
}
- 移动止损
{
"trailValue": -0.06,
"size": 31432.0,
}
- 止盈
{
"triggerPrice": 0.367885,
"size": 31433.0,
}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"triggerPrice": 0.306225,
"orderId": null,
"side": "sell",
"size": 31431,
"status": "open",
"type": "stop",
"orderPrice": null,
"error": null,
"triggeredAt": null,
"reduceOnly": false,
"orderType": "market",
"filledSize": 0,
"avgFillPrice": null,
"retryUntilFilled": false
}
}
需要验证身份。
净荷格式
请注意,修改后的订单的订单ID将与原始订单的ID不同。
止损订单参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
size | number | 31431.0 | |
triggerPrice | number | 0.306525 | |
orderPrice | number | 0.3063 | only for stop limit orders |
追踪止损单参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
size | number | 31431.0 | |
trailValue | number | -0.05 | negative for sell orders; positive for buy orders |
止盈订单参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
size | number | 31431.0 | |
triggerPrice | number | 0.306525 | |
orderPrice | number | 0.3067 | only for take profit limit orders |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
createdAt | string | 2019-03-05T12:56:55.728933+00:00 | |
future | string | XRP-PERP | |
id | number | 9596912 | |
market | string | XRP-PERP | |
triggerPrice | number | 0.306525 | |
orderId | number | 123123 | [DEPRECATED] ID of the order sent on the most recent trigger, if exists |
side | string | sell | |
size | number | 31431.0 | |
status | string | Values are open , cancelled , and triggered |
|
type | string | stop | |
orderPrice | number | null | price of the order sent when this stop loss triggered |
error | string | null | [DEPRECATED] error message for unsuccessful order placement of the most recent trigger, if exists |
triggeredAt | string | null | time at which this stop loss first triggered |
reduceOnly | boolean | false | |
orderType | string | market | Values are market , limit |
retryUntilFilled | boolean | false | Whether or not to keep re-triggering until filled |
获取订单状态
请求
GET /orders/{order_id}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"filledSize": 10,
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"price": 0.306525,
"avgFillPrice": 0.306526,
"remainingSize": 31421,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null,
"liquidation": False
}
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 9596912 | |
market | string | XRP-PERP | |
type | string | limit | |
side | string | sell | |
price | number | 0.306525 | |
size | number | 31431.0 | |
filledSize | number | 10.0 | |
remainingSize | number | 31421.0 | |
avgFillPrice | number | 0.306526 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | client order id |
通过客户编号获取订单状态
请求
GET /orders/by_client_id/{client_order_id}
回复
{
"success": true,
"result": {
"createdAt": "2019-03-05T09:56:55.728933+00:00",
"filledSize": 10,
"future": "XRP-PERP",
"id": 9596912,
"market": "XRP-PERP",
"price": 0.306525,
"avgFillPrice": 0.306526,
"remainingSize": 31421,
"side": "sell",
"size": 31431,
"status": "open",
"type": "limit",
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": "your_client_order_id"
}
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 9596912 | |
market | string | XRP-PERP | |
type | string | limit | |
side | string | sell | |
price | number | 0.306525 | |
size | number | 31431.0 | |
filledSize | number | 10.0 | |
remainingSize | number | 31421.0 | |
avgFillPrice | number | 0.306526 | |
status | string | new (accepted but not processed yet), open , or closed (filled or cancelled) |
|
createdAt | string | 2019-03-05T09:56:55.728933+00:00 | |
reduceOnly | boolean | false | |
ioc | boolean | false | |
postOnly | boolean | false | |
clientId | string | client order id |
撤单
请求
DELETE /orders/{order_id}
回复
{
"success": true,
"result": "Order queued for cancelation"
}
需要验证身份。
通过客户编号取消订单
请求
DELETE /orders/by_client_id/{client_order_id}
回复
{
"success": true,
"result": "Order queued for cancellation"
}
需要验证身份。
取消未完成触发挂单
请求
DELETE /conditional_orders/{id}
回复
{
"success": true,
"result": "Order cancelled"
}
需要验证身份。
取消所有挂单
此操作会取消您设置的条件委托(止损委托和跟踪止损委托)。
请求
DELETE /orders
{
"market": "BTC-PERP",
}
回复
{
"success": true,
"result": "Orders queued for cancelation"
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | USDTBEAR | optional; restrict to cancelling orders only on this market |
side | string | buy | optional; restrict to cancelling orders only on this side |
conditionalOrdersOnly | boolean | false | optional; restrict to cancelling conditional orders only |
limitOrdersOnly | boolean | false | optional; restrict to cancelling existing limit orders (non-conditional orders) only |
执行
请求
GET /fills?market={market}
回复
{
"success": true,
"result": [
{
"fee": 20.1374935,
"feeCurrency": "USD",
"feeRate": 0.0005,
"future": "EOS-0329",
"id": 11215,
"liquidity": "taker",
"market": "EOS-0329",
"baseCurrency": null,
"quoteCurrency": null,
"orderId": 8436981,
"tradeId": 1013912,
"price": 4.201,
"side": "buy",
"size": 9587,
"time": "2019-03-27T19:15:10.204619+00:00",
"type": "order"
}
]
}
需要验证身份。
Supports pagination
Please note that fills generated by Converts will show up as 'type': 'otc'
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | BTC-0329 | optional; market to limit fills |
start_time | number | 1564146934 | optional; minimum time of fills to return, in Unix time (seconds since 1970-01-01) |
end_time | number | 1564233334 | optional; maximum time of fills to return, in Unix time (seconds since 1970-01-01) |
order | string | null | optional; default is descending, supply 'asc' to receive fills in ascending order of time |
orderId | number | 50129784137 | optional; fetch fills for a specific order |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
fee | number | 20.1374935 | |
feeCurrency | string | USD | |
feeRate | number | 0.0005 | |
future | string | EOS-0329 | |
id | number | 11215 | fill id |
liquidity | string | taker | "taker" or "maker" |
market | string | EOS-0329 | |
baseCurrency | string | BTC | 仅限现货市场 |
quoteCurrency | string | USD | 仅限现货市场 |
orderId | number | 8436981 | |
tradeId | number | 1013912 | null for trades before 2019-02-19 10:00:00 |
price | number | 4.201 | |
side | string | buy | |
size | number | 9587.0 | |
time | string | 2019-03-27T19:15:10.204619+00:00 | |
type | string | order |
融资付款
需要验证身份。
Supports pagination
请求
GET /funding_payments
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
future | string | BTC-PERP | optional |
回复
{
"success": true,
"result": [
{
"future": "ETH-PERP",
"id": 33830,
"payment": 0.0441342,
"time": "2019-05-15T18:00:00+00:00",
"rate": 0.0001
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
future | string | ETH-PERP | |
id | number | 33830 | |
payment | number | 0.0441342 | |
time | string | 2019-05-15T18:00:00+00:00 |
杠杆代币
列出杠杆代币
请求
GET /lt/tokens
回复
{
"success": true,
"result": [
{
"name": "HEDGE",
"description": "1X Short Bitcoin Token",
"underlying": "BTC-PERP",
"leverage": -1.0,
"outstanding": 22155.41968804,
"pricePerShare": 110.87560713849138,
"positionPerShare": -0.001966859604267557,
"positionsPerShare": {"BTC-PERP": -0.001966859604267557},
"basket": {"BTC-PERP": -0.001966859604267557, "USD": 221.74748303105358},
"targetComponents": ["BTC-PERP"],
"underlyingMark": 56370.0,
"totalNav": 2456495.60931952,
"totalCollateral": 2465646.6953195203,
"contractAddress": "0x1FA3bc860bF823d792f04F662f3AA3a500a68814",
"currentLeverage": -0.9999663474588733,
"change1h": -0.008438973233561787,
"change24h": 0.014631456489264717,
"changeBod": -0.0017092321513513995
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
name | string | HEDGE | 代币名称 |
description | string | 1x Short Bitcoin Token | |
underlying | string | BTC-PERP | 此代币使用的标的期货合约名称 |
leverage | number | -1.0 | Target leverage |
outstanding | number | 22155.41968804 | 未偿付的代币数量 |
pricePerShare | number | 110.87560713849138 | totalNav divided by outstanding |
positionsPerShare | dict | {"BTC-PERP": -0.001966859604267557} |
Futures positions per share: one element for each item in targetComponents |
basket | dict | {"BTC-PERP": -0.001966859604267557, "USD": 221.74748303105358} |
Holdings per share |
targetComponents | list | ["BTC-PERP"] |
Futures to be included in the basket of the leverage token. For BVOL and IBVOL futures, this contains multiple entries |
totalNav | number | 2456495.60931952 | Total value of the leveraged token holdings (basket holdings marked to market times outstanding) |
totalCollateral | number | 2465646.6953195203 | Total collateral in the leveraged token account |
currentLeverage | number | -0.9999663474588733 | Current leverage |
positionPerShare | number | -0.001966859604267557 | 每种代币的标的期货头寸 |
underlyingMark | number | 56370.0 | 标的期货当前标记价格 |
contractAddress | string | 0x1FA3bc860bF823d792f04F662f3AA3a500a68814 |
代币 ERC20 智能合约地址 |
change1h | number | -0.008438973233561787 | 过去一小时内代币价格变化 |
change24h | number | 0.014631456489264717 | 过去一天代币价格变化 |
changeBod | number | -0.0017092321513513995 | Change in price since 00:00 UTC |
获取代币信息
请求
GET /lt/{token_name}
回复
{
"success": true,
"result": [
{
"name": "HEDGE",
"description": "1X Short Bitcoin Token",
"underlying": "BTC-PERP",
"leverage": -1.0,
"outstanding": 22155.41968804,
"pricePerShare": 110.87560713849138,
"positionPerShare": -0.001966859604267557,
"positionsPerShare": {"BTC-PERP": -0.001966859604267557},
"basket": {"BTC-PERP": -0.001966859604267557, "USD": 221.74748303105358},
"targetComponents": ["BTC-PERP"],
"underlyingMark": 56370.0,
"totalNav": 2456495.60931952,
"totalCollateral": 2465646.6953195203,
"contractAddress": "0x1FA3bc860bF823d792f04F662f3AA3a500a68814",
"currentLeverage": -0.9999663474588733,
"change1h": -0.008438973233561787,
"change24h": 0.014631456489264717,
"changeBod": -0.0017092321513513995
}
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
token_name | string | HEDGE | Required. Name of the token. |
获取加杠杆代币余额
请求
GET /lt/balances
回复
{
"success": true,
"result": [
{
"token": "HEDGE",
"balance": 8.8
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
token | string | HEDGE | |
balance | number | 8.8 |
列出杠杆代币创建请求
请求
GET /lt/creations
回复
{
"success": true,
"result": [
{
"id": 123,
"token": "HEDGE",
"requestedSize": 10,
"pending": false,
"createdSize": 10,
"price": 1234,
"cost": 12340,
"fee": 12.34,
"requestedAt": "2019-03-05T09:56:55.728933+00:00",
"fulfilledAt": "2019-03-05T09:56:55.728933+00:00"
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123 | |
token | string | HEDGE | 代币名称 |
requestedSize | number | 10 | 最初请求的代币数量 |
pending | boolean | false | |
createdSize | number | 10 | 创建的代币数量;可能小于请求数量 |
price | number | 1234 | 创建请求执行价格 |
cost | number | 12340 | 不含费用的代币创建成本 |
fee | number | 12.34 | 代币创建费用 |
requestedAt | string | 2019-03-05T09:56:55.728933+00:00 | 请求提交时间 |
fulfilledAt | string | 2019-03-05T09:56:55.728933+00:00 | 处理请求的时间 |
请求创建杠杆代币
请求
POST /lt/{token_name}/create
{
"size": 31431.0
}
回复
{
"success": true,
"result": {
"id": 123,
"token": "HEDGE",
"requestedSize": 10,
"cost": 12340,
"pending": true,
"requestedAt": "2019-03-05T09:56:55.728933+00:00"
}
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
token_name | string | HEDGE | required; name of the token |
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
size | number | 31431.0 | number of tokens to create |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123 | |
token | string | HEDGE | 代币名称 |
requestedSize | number | 10 | 请求的代币数量 |
cost | number | 12340 | 创建请求扣除的抵押金额 |
pending | boolean | true | |
requestedAt | string | 2019-03-05T09:56:55.728933+00:00 | 请求提交时间 |
列出杠杆代币兑换请求
请求
GET /lt/redemptions
回复
{
"success": true,
"result": [
{
"id": 123,
"token": "HEDGE",
"size": 10,
"pending": false,
"price": 1234,
"proceeds": 12340,
"fee": 12.34,
"requestedAt": "2019-03-05T09:56:55.728933+00:00",
"fulfilledAt": "2019-03-05T09:56:55.728933+00:00"
}
]
}
需要验证身份。
Supports pagination
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123 | |
token | string | HEDGE | 代币名称 |
size | number | 10 | 已兑换代币总量 |
pending | boolean | false | |
price | number | 1234 | 赎回请求执行价格 |
proceeds | number | 12340 | 赎回收益,未扣费 |
fee | number | 12.34 | 代币兑换费用 |
requestedAt | string | 2019-03-05T09:56:55.728933+00:00 | 请求提交时间 |
fulfilledAt | string | 2019-03-05T09:56:55.728933+00:00 | 处理请求的时间 |
请求兑换杠杆代币
请求
POST /lt/{token_name}/redeem
{
"size": 31431.0
}
回复
{
"success": true,
"result": {
"id": 123,
"token": "HEDGE",
"size": 10,
"projectedProceeds": 12340,
"pending": true,
"requestedAt": "2019-03-05T09:56:55.728933+00:00"
}
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
token_name | string | HEDGE | required; name of the token |
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
size | number | 31431.0 | number of tokens to create |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123 | |
token | string | HEDGE | - name of the token |
size | number | 10 | - number of tokens requsted to be redeemed |
projectedProceeds | number | 12340 | - estimated proceeds from the redemption |
pending | boolean | true | |
requestedAt | string | 2019-03-05T09:56:55.728933+00:00 | - time the request was submitted |
Request ETF rebalance info
请求
GET /etfs/rebalance_info
Provides information about the most recent rebalance of each ETF.
回复
{
"BNBBEAR": {
"orderSizeList": [
"751.80000000",
"751.80000000",
"751.80000000",
"1.10000000"
],
"side": "buy",
"time": "2021-05-03 13:03:48.585349"
},
"DOGEBEAR2021": {
"orderSizeList": [
"440614.00000000"
],
"side": "buy",
"time": "2021-05-03 13:31:44.577947"
},
"DOGEBEAR": {
"orderSizeList": [
"118599.00000000"
],
"side": "buy",
"time": "2021-05-03 13:31:45.746563"
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
[key] | string | BNBBEAR | ticker of the ETF |
orderSizeList | list of numbers | ["751.80000000", "751.80000000", "751.80000000", "1.10000000"] | List of order sizes in the rebalance |
side | string | buy | "buy" or "sell" depending on whether the rebalance involves buying or selling |
time | string | 2021-05-03 13:31:45.746563 | time of the rebalance |
期权
List quote requests
请求
GET /options/requests
回复
{
"success": true,
"result": [
{
"id": 512,
"option": {
"underlying": "BTC",
"type": "call",
"strike": 7800,
"expiry": "2020-01-08T03:00:00+00:00",
},
"side": "buy",
"size": 1.2,
"time": "2020-01-07T22:35:54.626023+00:00",
"requestExpiry": "2020-01-08T22:35:54.626023+00:00",
"status": "open",
},
],
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 512 | |
option | dict | option object; see below | |
size | number | 1.2 | |
side | string | buy | |
time | string | 2020-01-07T22:35:54.626023+00:00 | when the request was placed |
status | string | open | |
requestExpiry | string | 2020-01-08T22:35:54.626023+00:00 | when the request expires |
limitPrice | number | 10.2 | optional; omitted when the request has no limit price or it is hidden |
Note that option objects have the following format:
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
underlying | string | BTC | |
type | string | call | "call" or "put" |
strike | number | 7800 | |
expiry | string | 2020-01-08T03:00:00+00:00 |
Your quote requests
需要验证身份。
请求
GET /options/my_requests
回复
{
"success": true,
"result": [
{
"id": 512,
"option": {
"underlying": "BTC",
"type": "call",
"strike": 7800,
"expiry": "2020-01-08T03:00:00+00:00",
},
"side": "buy",
"size": 1.2,
"time": "2020-01-07T22:35:54.626023+00:00",
"requestExpiry": "2020-01-08T22:35:54.626023+00:00",
"status": "open",
"hideLimitPrice": true,
"limitPrice": 1.2,
"quotes": [
{
"collateral": 8762.71757981,
"id": 1029,
"price": 1.0,
"quoteExpiry": null,
"status": "open",
"time": "2020-01-07T22:49:31.367379+00:00".
},
],
},
],
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 512 | |
option | dict | option object; see List Quote Requests section | |
side | string | buy | |
size | number | 1.2 | |
time | string | 2020-01-07T22:35:54.626023+00:00 | when the request was placed |
status | string | open | |
requestExpiry | string | 2020-01-08T22:35:54.626023+00:00 | when the request expires |
quotes | array | list of quotes for your quote request; see below | |
hideLimitPrice | bool | true | whether or not to hide your limit price if it exists |
limitPrice | number | 1.2 | optional; omitted if your request does not have a limit price |
Note that quote objects have the following format:
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 1029 | |
status | string | open | |
collateral | number | 8762.71757981 | collateral locked by the quote |
price | number | 1.0 | |
quoteExpiry | string | null | optional |
time | string | 2020-01-07T22:49:31.367379+00:00 | when the quote was created |
Create quote request
请求
需要验证身份。
POST /options/requests
{
"underlying": "BTC",
"type": "call",
"strike": 7800,
"expiry": 1578625200,
"side": "buy",
"size": 5,
}
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
underlying | string | BTC | |
type | string | call | "call" or "put" |
strike | number | 7800 | |
expiry | number | 1578625200 | unix timestamp of option expiry. Must be in the future and at 03:00 UTC. |
side | string | buy | "buy" or "sell" |
size | number | 5 | |
limitPrice | number | 1.2 | optional limit price |
hideLimitPrice | bool | true | whether or not to hide your limit price from potential quoters, default true |
requestExpiry | number | null | optional; unix timestamp of request expiry, defaults to 5 minutes in the future |
counterpartyId | number | 1234567 | optional; when specified, makes the request private to the specified counterparty |
回复
{
"success": true,
"result": {
"id": 3,
"option": {
"expiry": "2020-01-10T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC"
},
"expiry": "2020-01-10T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC",
"requestExpiry": "2020-01-08T23:05:44.047653+00:00",
"side": "buy",
"size": 5,
"status": "open",
"time": "2020-01-07T23:05:44.047653+00:00"
},
}
Cancel quote request
需要验证身份。
请求
DELETE /options/requests/{request_id}
回复
{
"id": 3,
"option": {
"expiry": "2020-01-10T03:00:00+00:00",
"strike": 7800.0,
"type":"call",
"underlying": "BTC"
},
"requestExpiry": "2020-01-08T23:05:44.047653+00:00",
"side": "buy",
"size": 5.0,
"status": "cancelled",
"time": "2020-01-07T23:05:44.047653+00:00",
}
Get quotes for your quote request
需要验证身份。
请求
GET /options/requests/{request_id}/quotes
回复
{
"success": true,
"result": {
"collateral": 26862.33468643,
"id": 2,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike"': 10.0,
"type": "call",
"underlying": "BTC"
},
"price": 11.0,
"quoteExpiry": null,
"quoterSide": "sell",
"requestId": 4,
"requestSide": "buy",
"size": 3.0,
"status": "open",
"time": "2020-01-07T23:43:24.772581+00:00"
},
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 2 | id of the quote |
requestId | number | 4 | id of the quote request |
status | string | open | |
collateral | number | 26862.33468643 | collateral locked by the quote |
price | number | 11.0 | |
quoteExpiry | string | null | optional |
quoterSide | string | sell | |
requestSide | string | buy | |
size | number | 3.0 | |
time | string | 22020-01-07T23:43:24.772581+00:00 | when the quote was created |
option | option object; see List Quote Requests section | ||
requestLimitPrice | number | null | the quote request's limit price. omitted if does not exist or hidden |
Create quote
需要验证身份。
请求
POST /options/requests/{request_id}/quotes
{
"price": 11.0,
}
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
price | number | 11.0 | price of your quote |
回复
{
"success": true,
"result": {
"collateral": 26862.33468643,
"id": 2,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike"': 10.0,
"type": "call",
"underlying": "BTC"
},
"price": 11.0,
"quoteExpiry": null,
"quoterSide": "sell",
"requestId": 4,
"requestSide": "buy",
"size": 3.0,
"status": "open",
"time": "2020-01-07T23:43:24.772581+00:00"
},
}
Get my quotes
需要验证身份。
请求
GET /options/my_quotes
回复
{
"success": true,
"result": {
"collateral": 26862.33468643,
"id": 2,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 10.0,
"type": "call",
"underlying": "BTC"
},
"price": 11.0,
"quoteExpiry": null,
"quoterSide": "sell",
"requestId": 4,
"requestSide": "buy",
"size": 3.0,
"status": "open",
"time": "2020-01-07T23:43:24.772581+00:00"
},
}
Cancel quote
需要验证身份。
请求
DELETE /options/quotes/<quote_id>
回复
{
"success": true,
"result": {
"collateral": 0,
"id": 4,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC",
},
"price": 11,
"quoteExpiry": null,
"quoterSide": "sell",
"requestId": 4,
"requestSide": "buy",
"size": 3,
"status": "cancelled",
"time": "2020-01-08T00:20:00.532812+00:00",
},
}
Accept options quote
需要验证身份。
请求
POST /options/quotes/<quote_id>/accept
回复
{
"success": true,
"result": {
"collateral": 0,
"id": 5,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC",
},
"price": 11,
"quoteExpiry": null,
"quoterSide": "sell",
"requestId": 4,
"requestSide": "buy",
"size": 3,
"status": "filled",
"time": "2020-01-08T00:20:00.532812+00:00",
},
}
Get account options info
需要验证身份。
请求
GET /options/account_info
回复
{
"success": true,
"result": {
"usdBalance": 34.0,
"liquidationPrice": 1900.2,
"liquidating": false,
},
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
usdBalance | number | 34.0 | |
liquidationPrice | number | 1900.2 | estimated liquidation price |
liquidated | boolean | false | if the account is currently liquidating |
maintenanceMarginRequirement | number | 1200.12 | you will be liquidated if your account collateral + options usdBalance drops below this number |
initialMarginRequirement | number | 1523.13 |
Get options positions
需要验证身份。
请求
GET /options/positions
回复
{
"success": true,
"result": [
{
"entryPrice": 11.0,
"netSize": 3.0,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC",
},
"side": "buy",
"size": 3,
},
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
netSize | number | 3.0 | positive if long, negative if short |
entryPrice | number | 11.0 | average entry price |
size | number | 3.0 | absolute value of netSize |
option | option object; see List Quote Requests section | ||
side | string | buy | "buy" if long, "sell" if short |
pessimisticValuation | number | 1.1 | optional; pessimistic valuation of this position used for margin purposes |
pessimisticIndexPrice | number | 6280 | optional; index price corresponding to pessimistic valuation |
pessimisticVol | number | 0.17 | optional; vol corresponding to pessimistic valuation |
Get public options trades
Supports pagination
请求
GET /options/trades
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559901511 | optional; only fetch orders created before this time |
回复
{
"success": true,
"result": [
{
"id": 31,
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC",
},
"price": 3,
"size": 1,
"time": "2020-01-08T02:59:57.270744+00:00",
},
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 31 | |
size | number | 1.0 | |
price | number | 3.0 | |
option | option object; see List Quote Requests section | ||
time | string | "2020-01-08T02:59:57.270744+00:00" |
Get options fills
需要验证身份。
Supports pagination
请求
GET /options/fills
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559901511 | optional; only fetch orders created before this time |
回复
{
"success": true,
"result": [
{
"fee": 1.782852614186007,
"feeRate": 0.0001729,
"id": 5,
"liquidity": "taker",
"option": {
"expiry": "2020-01-08T03:00:00+00:00",
"strike": 7800,
"type": "call",
"underlying": "BTC"
},
"price": 3,
"quoteId": 6,
"side": "sell",
"size": 1,
"time": "2020-01-08T02:59:57.270744+00:00",
},
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 5 | |
size | number | 1.0 | |
price | number | 3.0 | |
option | option object; see List Quote Requests section | ||
time | string | "2020-01-08T02:59:57.270744+00:00" | |
liquidity | string | taker | "taker" or "maker" |
fee | number | 1.782852614186007 | |
feeRate | number | 0.0001729 | |
side | string | buy |
Get 24h option volume
请求
GET /stats/24h_options_volume
回复
{
"success": true,
"result": [
{
"contracts": 216.6842,
"underlying_total": 2111838.071037173,
}
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
contracts | number | 216.6842 | Number of contracts traded over the last 24 hours |
underlying_total | number | 2111838.071037173 | Notional value of the contracts traded over the last 24 hours |
Get option open interest
Supports pagination
请求
GET /options/historical_volumes/BTC
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559901511 | optional; only fetch orders created before this time |
回复
{
"success": true,
"result": [
{
"numContracts": 1.0,
"endTime": "2020-07-01T04:06:00.584303+00:00",
"startTime": "2020-07-01T03:06:00.543341+00:00"
}
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
numContracts | number | 12572.0898 | Volume (in BTC) |
endTime | string | "2020-07-01T04:06:00.584303+00:00" | |
startTime | string | "2020-07-01T03:06:00.543341+00:00" |
Get option open interest
请求
GET /options/open_interest/BTC
回复
{
"success": true,
"result": {
"openInterest": 12572.0898
}
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
openInterest | number | 12572.0898 | Open interest (in BTC) |
Get option open interest
Supports pagination
请求
GET options/historical_open_interest/BTC
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch orders created after this time |
end_time | number | 1559901511 | optional; only fetch orders created before this time |
回复
{
"success": true,
"result": [
{
"numContracts": 5870.6395,
"time": "2020-07-01T04:06:00.589877+00:00"
}
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
numContracts | number | 12572.0898 | Open interest (in BTC) |
time | string | "2020-07-01T04:06:00.589877+00:00" |
Staking
Get stakes
请求
GET /staking/stakes
回复
{
"success": true,
"result": [
{
"coin": "SRM",
"createdAt": "2020-08-12T12:13:56.900236+00:00",
"id": 2447,
"size": 0.1,
}
]
}
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
createdAt | string | 2020-08-12T12:13:56.900236+00:00 |
id | int | 2447 |
size | number | 0.1 |
Unstake request
请求
GET /staking/unstake_requests
回复
{
"success": true,
"result": [
{
"coin": "SRM",
"createdAt": "2020-08-12T20:49:07.210200+00:00",
"id": 121,
"size": 0.1,
"status": "pending",
"unlockAt": "2020-08-19T20:49:07.225716+00:00",
}
]
}
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
createdAt | string | 2020-08-12T20:49:07.210200+00:00 |
id | int | 121 |
size | number | 0.1 |
status | string | pending (pending, cancelled, processed) |
unlockAt | string | 2020-08-19T20:49:07.225716+00:00 |
Get stake balances
Returns actively staked, scheduled for unstaking and lifetime rewards balances
请求
GET /staking/balances
回复
{
"success": true,
"result": [
{ "coin": "SRM",
"lifetimeRewards": 1.98e-06,
"scheduledToUnstake": 0.1,
"staked": 0.0},
{ "coin": "MSRM",
"lifetimeRewards": 0,
"scheduledToUnstake": 0,
"staked": 0.0},
{ "coin": "MSRM_LOCKED",
"lifetimeRewards": 0,
"scheduledToUnstake": 0,
"staked": 0.0},
{ "coin": "SRM_LOCKED",
"lifetimeRewards": 1.98e-06,
"scheduledToUnstake": 0,
"staked": 0.0,
}
]
}
Unstake request
请求参数
请求
POST /staking/unstake_requests
回复
{
"success": true,
"result": [
{ "coin": "SRM",
"createdAt": "2020-08-12T21:03:21.539419+00:00",
"id": 122,
"size": 0.1,
"status": "pending",
"unlockAt": "2020-08-19T21:03:21.543783+00:00",
}
]
}
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
size | number | 0.1 |
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
createdAt | string | 2020-08-12T21:03:21.539419+00:00 |
size | number | 0.1 |
status | string | pending (pending, cancelled, processed) |
unlockAt | string | 2020-08-19T21:03:21.543783+00:00 |
Cancel unstake request
请求
DELETE /staking/unstake_requests/{request_id}
回复
{
"success": true,
"result": ["Cancelled"]
}
Get staking rewards
Supports pagination
请求
GET /staking/staking_rewards
回复
{
"success": true,
"result": [
{ "coin": "SRM",
"id": 99730,
"size": 0.1,
"status": "complete",
"time": "2020-08-12T20:15:25.260879+00:00"},
}
]
}
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
id | int | 99730 |
size | number | 0.1 |
status | string | complete |
time | string | 2020-08-12T20:15:25.260879+00:00 |
Stake request
请求参数
请求
POST /srm_stakes/stakes
回复
{
"success": true,
"result": [
{ "coin": "SRM",
"createdAt": "2020-08-12T21:17:39.884879+00:00",
"id": 3001,
"size": 0.1,
}
]
}
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
size | number | 0.1 |
姓名 | 类型 | 价值 |
---|---|---|
coin | string | SRM |
createdAt | string | 2020-08-12T21:17:39.884879+00:00 |
id | int | 3001 |
size | number | 0.1 |
Convert
请求报价
请求
POST /otc/quotes
{
"fromCoin": "BTC",
"toCoin": "USD",
"size": 0.05
}
回复
{
"success": true,
"result": {
"quoteId": 1031
}
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
fromCoin | string | BTC | |
toCoin | string | USD | |
size | number | 0.05 | denominated in units of fromCoin |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
quoteId | number | 1031 |
Get quote status
请求
GET /otc/quotes/{quoteId}
回复
{
"success": true,
"result": [
{
"baseCoin": "BTC",
"cost": 0.05,
"expired": false,
"expiry": 1630355607.399486,
"filled": false,
"fromCoin": "BTC",
"id": 1031,
"price": 7695.4,
"proceeds": 384.77,
"quoteCoin": "USD",
"side": "sell",
"toCoin": "USD"
}
]
}
需要验证身份。
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
market | string | BTC/USD | optional; market to limit orders |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
baseCoin | string | BTC | |
cost | number | 0.05 | cost of accepting the quote in units of fromCoin |
expired | bool | false | if the quote is expired (if so, cannot accep tit) |
filled | bool | false | if the quote is already accepted |
id | number | 1031 | |
price | number | 7695.4 | price in units of quoteCoin |
proceeds | number | 384.77 | proceeds of accepting the quote in units of toCoin |
quoteCoin | string | USD | |
side | string | "sell" | "sell" if fromCoin is baseCoin, otherwise "buy" |
toCoin | string | USD |
Accept quote
请求
POST /otc/quotes/{quote_id}/accept
回复
{
"success": true,
"result": null
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
quoteId | number | 1031 |
Spot Margin
Get lending history
请求
GET /spot_margin/history
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch history after this time |
end_time | number | 1559901511 | optional; only fetch history before this time |
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"time": "2021-04-06T20:00:00+00:00",
"rate": 0.00002283,
"size": 615974048.2224404
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USD | |
time | string | 2021-04-06T20:00:00+00:00 | |
rate | number | 0.00002283 | hourly lending rate for this cycle |
size | number | 615974048.2224404 | total size matched between borrowers and lenders |
Get borrow rates
请求
GET /spot_margin/borrow_rates
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"estimate": 1.45e-06,
"previous": 1.44e-06
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
estimate | number | 1.45e-06 | estimated hourly borrow rate for the next spot margin cycle |
previous | number | 1.44e-06 | hourly borrow rate in the previous spot margin cycle |
Get lending rates
请求
GET /spot_margin/lending_rates
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"estimate": 1.45e-06,
"previous": 1.44e-06
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
estimate | number | 1.45e-06 | estimated hourly lending rate for the next spot margin cycle |
previous | number | 1.44e-06 | hourly lending rate in the previous spot margin cycle |
Get daily borrowed amounts
请求
GET /spot_margin/borrow_summary
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"size": 120.1,
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
size | number | 120.1 | average matched borrowed and lent amount over the last 24h |
Get market info
请求
GET /spot_margin/market_info?market={market}
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"borrowed": 0.0,
"free": 3.87278021,
"estimatedRate": 1e-06,
"previousRate": 1e-06
},
{
"coin": "USD",
"borrowed": 0.0,
"free": 69966.22310497,
"estimatedRate": 1.027e-05,
"previousRate": 1.027e-05
}
]
}
需要验证身份。
Will return None if spot margin is not enabled in account settings.
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
borrowed | number | 0.0 | amount of coin currently borrowed |
free | number | 3.87278021 | amount of coin that can be spent buying the other coin in the supplied market, including what's borrowable with margin |
estimatedRate | number | 1.45e-06 | estimated hourly borrow rate for the next spot margin cycle |
previousRate | number | 1.44e-06 | hourly borrow rate in the previous spot margin cycle |
Get my borrow history
请求
Supports pagination
GET /spot_margin/borrow_history
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"cost": 0.00047864470072,
"rate": 1.961096e-05,
"size": 24.407,
"time": "2020-11-30T12:00:00+00:00"
}
]
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch history after this time |
end_time | number | 1559901511 | optional; only fetch history before this time |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
cost | number | 0.00047864470072 | amount of coin you paid as interest on the borrow |
rate | number | 1.961096e-05 | borrow rate |
size | number | 24.407 | amount borrowed |
time | string | 2020-11-30T12:00:00+00:00 | time of interest payment |
Get my lending history
请求
Supports pagination
GET /spot_margin/lending_history
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"proceeds": 0.00047864470072,
"rate": 1.961096e-05,
"size": 24.407,
"time": "2020-11-30T12:00:00+00:00"
}
]
}
需要验证身份。
Supports pagination
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional; only fetch history after this time |
end_time | number | 1559901511 | optional; only fetch history before this time |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
proceeds | number | 0.00047864470072 | amount of coin you were paid as interest on the loan |
rate | number | 1.961096e-05 | lending rate |
size | number | 24.407 | amount lent |
time | string | 2020-11-30T12:00:00+00:00 | time of interest payment |
Get lending offers
请求
GET /spot_margin/offers
回复
{
"success": true,
"result": [
{
"coin": "BTC",
"rate": 1e-06,
"size": 1.0
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | BTC | |
rate | number | 1e-06 | hourly rate at which you will lend, if matched |
size | number | 1.9 | amount you will lend, if matched |
Get lending info
请求
GET /spot_margin/lending_info
回复
{
"success": true,
"result": [
{
"coin": 'USD',
"lendable": 10026.5,
"locked": 100.0,
"minRate": 1e-06,
"offered": 100.0
}
]
}
需要验证身份。
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USD | |
lendable | number | 10026.5 | additional size you can lend |
locked | number | 100.0 | size either in lending offers or not yet unlocked from lending offers |
minRate | number | 1e-6 | minimum rate at which your offers will lend |
offered | number | 100.0 | size in your lending offers |
Submit lending offer
请求
POST /spot_margin/offers
{
"coin": "USD",
"size": 10.0,
"rate": 1e-6
}
回复
{
"success": true,
"result": null,
}
需要验证身份。
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
coin | string | USD | |
size | number | 10.0 | |
rate | number | 1e-6 |
NFTs
Rest API for NFTs on FTX.
NFT endpoints base URL: https://ftx.com/api/nft
List NFTs
请求
GET /nft/nfts
回复
{
"success": true,
"result": [
{
"id": 123456,
"name": "Rare NFT",
"description": "Rare art",
"issuer": "FTX",
"collection": "FTX rare art",
"series": "Art for charity",
"solMintAddress": "8Jntdo3RMxQyGvuRkRjFA3aJ",
"ethContractAddress": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"imageUrl": "https://www.static.ftx.com/art.jpg",
"videoUrl": "https://www.static.ftx.com/art.mp4",
"attributes": null,
"redeemable": true,
"redeemed": false,
"offerPrice": 1000.00,
"auction": {
"bestBid": 120.00,
"minNextBid": 125.00,
"endTime": "2021-06-11T07:23:24.106062+00:00",
"bids": 10
}
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123456 | unique ID of NFT |
name | string | Rare NFT | name of NFT |
description | string | Rare art | description of NFT |
issuer | string | FTX | entity issuing NFT |
collection | string | FTX rare art | NFT collection name |
series | string | Art for charity | NFT series |
solMintAddress | string | 8Jntdo3RMxQyGvuRkRjFA3aJ | |
ethContractAddress | string | 0x014Dc156cA770baC5475186834ecd2f624C990K | |
imageUrl | string | https://www.static.ftx.com/art.jpg | |
videoUrl | string | https://www.static.ftx.com/art.mp4 | |
attributes | string | null | |
redeemable | boolean | true | true if NFT is redeemable for goods |
redeemed | boolean | false | true if NFT is redeemable and has been redeemed |
offerPrice | number | 1000.00 | |
auction | array |
Get NFT info
请求
GET /nft/nft/{nft_id}
回复
{
"success": true,
"result": {
"id": 123456,
"name": "Rare NFT",
"description": "Rare art",
"issuer": "FTX",
"collection": "FTX rare art",
"series": "Art for charity",
"solMintAddress": "8Jntdo3RMxQyGvuRkRjFA3aJ",
"ethContractAddress": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"imageUrl": "https://www.static.ftx.com/art.jpg",
"videoUrl": "https://www.static.ftx.com/art.mp4",
"attributes": null,
"redeemable": true,
"redeemed": false,
"offerPrice": 1000.00,
"auction": {
"bestBid": 120.00,
"minNextBid": 125.00,
"endTime": "2021-06-11T07:23:24.106062+00:00",
"bids": 10
}
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123456 | unique ID of NFT |
name | string | Rare NFT | name of NFT |
description | string | Rare art | description of NFT |
issuer | string | FTX | entity issuing NFT |
collection | string | FTX rare art | NFT collection name |
series | string | Art for charity | NFT series |
solMintAddress | string | 8Jntdo3RMxQyGvuRkRjFA3aJ | |
ethContractAddress | string | 0x014Dc156cA770baC5475186834ecd2f624C990K | |
imageUrl | string | https://www.static.ftx.com/art.jpg | |
videoUrl | string | https://www.static.ftx.com/art.mp4 | |
attributes | string | null | |
redeemable | boolean | true | true if NFT is redeemable for goods |
redeemed | boolean | false | true if NFT is redeemable and has been redeemed |
offerPrice | number | 1000.00 | |
auction | array |
Get NFT trades
Supports pagination
请求
GET /nft/{nft_id}/trades
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复
{
"success": true,
"result": [
{
"id": 490,
"price": 333.0,
"time": "2021-06-10T19:48:34.313252+00:00"
}, {
"id": 47,
"price": 350.0,
"time": "2021-06-03T14:18:40.496298+00:00"
}, {
"id": 42,
"price": 139.0,
"time": "2021-06-03T13:57:00.467274+00:00"
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 42 | |
price | number | 333.0 | |
time | string | 2021-06-03T13:57:00.467274+00:00 |
Get all NFT trades
Supports pagination
请求
GET /nft/all_trades
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复
{
"success":true,
"result": [
{
"id":123,
"nft": {
"id": 123456,
"name": "Rare NFT",
"description": "Rare art",
"issuer": "FTX",
"collection": "FTX rare art",
"series": "Art for charity",
"solMintAddress": "8Jntdo3RMxQyGvuRkRjFA3aJ",
"ethContractAddress": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"imageUrl": "https://www.static.ftx.com/art.jpg",
"videoUrl": "https://www.static.ftx.com/art.mp4",
"attributes": null,
"redeemable": true,
"redeemed": false,
"offerPrice": 1000.00,
"auction": {
"bestBid": 120.00,
"minNextBid": 125.00,
"endTime": "2021-06-11T07:23:24.106062+00:00",
"bids": 10
}
},
"price": 1450.0,
"time": "2021-06-09T15:39:15.364317+00:00"
}, {
"id": 124,
......
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | Rare NFT | NFT trade id |
nft | array | See List NFTs for details | |
price | number | 1450.0 | trade price of NFT |
time | string | 2021-06-09T15:39:15.364317+00:00 |
Get NFT account info
请求
GET /nft/{nft_id}/account_info
回复
{
"success": true,
"result": {
"bid": 120.00,
"buyFee": 6.00,
"isBestBid": False,
"owned": False
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
bid | number | 120.00 | |
buyFee | number | 6.00 | |
isBestBid | boolean | False | |
owned | boolean | False |
Get all NFT collections
请求
GET /nft/collections
回复
{
"success": true,
"result": [
{
"issuer": "FTX",
"collection":"FTX Special"
}, {
"issuer": "FTX",
"collection": "FTX Swag"
}, .....
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
issuer | string | FTX | issuer of NFT collection |
collection | string | FTX | NFT collection name |
Get NFT balances
需要验证身份。
请求
GET /nft/balances
回复
{
"success": true,
"result": [
{
"id": 123456,
"name": "Rare NFT",
"description": "Rare art",
"issuer": "FTX",
"collection": "FTX rare art",
"series": "Art for charity",
"solMintAddress": "8Jntdo3RMxQyGvuRkRjFA3aJ",
"ethContractAddress": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"imageUrl": "https://www.static.ftx.com/art.jpg",
"videoUrl": "https://www.static.ftx.com/art.mp4",
"attributes": null,
"redeemable": true,
"redeemed": false,
"offerPrice": 1000.00,
"auction": {
"bestBid": 120.00,
"minNextBid": 125.00,
"endTime": "2021-06-11T07:23:24.106062+00:00",
"bids": 10
}
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 123456 | unique ID of NFT |
name | string | Rare NFT | name of NFT |
description | string | Rare art | description of NFT |
issuer | string | FTX | entity issuing NFT |
collection | string | FTX rare art | NFT collection name |
series | string | Art for charity | NFT series |
solMintAddress | string | 8Jntdo3RMxQyGvuRkRjFA3aJ | |
ethContractAddress | string | 0x014Dc156cA770baC5475186834ecd2f624C990K | |
imageUrl | string | https://www.static.ftx.com/art.jpg | |
videoUrl | string | https://www.static.ftx.com/art.mp4 | |
attributes | string | null | |
redeemable | boolean | true | true if NFT is redeemable for goods |
redeemed | boolean | false | true if NFT is redeemable and has been redeemed |
offerPrice | number | 1000.00 | |
auction | array |
Make NFT offer
需要验证身份。
请求
POST /nft/offer
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nftId | int | 12345 | |
price | number | 500.0 |
回复
See /nft/{nftId}
Buy NFT
需要验证身份。
请求
POST /nft/buy
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nftId | int | 12345 | |
price | number | 500.0 |
回复
See /nft/{nftId}
Create Auction
需要验证身份。
请求
POST /nft/auction
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
initialPrice | number | 120.0 | |
reservationPrice | number | 500.0 | |
duration | int | 3600 | duration in seconds |
回复
See /nft/{nftId}
Edit Auction
需要验证身份。
请求
POST /nft/edit_auction
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
reservationPrice | number | 600.0 |
回复
See /nft/{nftId}
Cancel Auction
需要验证身份。
请求
POST /nft/cancel_auction
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nftId | number | 12345 | |
reservationPrice | number | 500.0 |
回复
See /nft/{nftId}
Get bids
需要验证身份。
请求
GET /nft/bids
回复
See /nft/nfts
Place bid
需要验证身份。
请求
POST /nft/bids
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nftId | number | 12345 | |
price | number | 500.0 |
回复
See /nft/{nftId}
Get NFT deposits
需要验证身份。
Supports pagination
请求
GET /nft/deposits
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复
{
"success": true,
"result": [
{
"id": 999899,
"nft": {
See /nfts,
},
"status": "confirmed",
"time": "2021-06-10T09:15:43.136561+00:00",
"sentTime": "2021-06-11T07:23:24.106062+00:00",
"confirmedTime": "2021-06-11T07:27:40.237006+00:00",
"confirmations": 8,
}, {
"id": 777877,
.....
},
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | int | 999899 | |
nft | array | See List NFTs for details | |
status | string | confirmed | one of: unconfirmed, confirmed, cancelled |
time | string | 2021-06-10T09:15:43.136561+00:00 | NFT created at |
sentTime | string | 2021-06-11T07:23:24.106062+00:00 | |
confirmedTime | string | 2021-06-11T07:27:40.237006+00:00 | |
confirmations | int | 8 |
Get NFT withdrawals
需要验证身份。
Supports pagination
请求
GET /nft/withdrawals
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复
{
"success": true,
"result": [
{
"id": 12345,
"nft": {
See /nfts,
},
"address": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"method": "erc20",
"txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1",
"fee": "20.0",
"status": "sent",
"time": "2021-06-11T07:23:24.106062+00:00",
"notes": null
}, {
"id": 45678,
.....
},
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 12345 | |
nft | array | See List NFTs for details | |
address | string | 0x014Dc156cA770baC5475186834ecd2f624C990K | |
method | string | erc20 | erc20 or sol |
txid | string | 0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1 | |
fee | number | 20.0 | |
status | string | confirmed | one of: requested, processing, sent, completed, cancelled |
time | string | 2021-06-11T07:23:24.106062+00:00 | |
notes | string | null |
Get NFT fills
需要验证身份。
Supports pagination
请求
GET /nft/fills
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
start_time | number | 1559881511 | optional |
end_time | number | 1559881711 | optional |
回复
{
"success": true,
"result": [
{
"id": 12345,
"nft": {
See /nfts,
},
"side": "buy",
"price": 150.0,
"fee": 7.5,
"time": "2021-06-11T07:23:24.106062+00:00"
}, {
"id": 45678,
.....
},
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 12345 | |
nft | array | See List NFTs for details | |
side | string | buy | trade price of NFT |
price | number | 150.0 | |
fee | number | 7.5 | |
time | string | 2021-06-09T15:39:15.364317+00:00 |
Redeem NFT
需要验证身份。
请求
POST /nft/redeem
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
nftId | number | 12345 | |
address | string | ||
notes | string |
回复
{
"success": true,
"result": {
"id": 12345,
"nft": {
See /nfts,
},
"time": "2021-06-11T07:23:24.106062+00:00",
"notes": null
"address": "0x014Dc156cA770baC5475186834ecd2f624C990K",
"status": "redeemed",
"supportTicketId": 1014
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 12345 | |
nft | array | See List NFTs for details | |
time | string | 2021-06-09T15:39:15.364317+00:00 | |
notes | string | null | |
address | string | 0x014Dc156cA770baC5475186834ecd2f624C990K | |
status | string | confirmed | one of: requested, pending_review, processing, sent, complete, cancelled, failed |
supportTicketId | int | 1014 | id of associated support ticket |
Get NFT gallery
需要验证身份。
请求
GET /nft/gallery/{gallery_id}
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
gallery_id | number | 12345 | NFT gallery id |
回复
{
"success": true
"result": {
"name": "My-Awesome-NFTs",
"nfts": [
See /nfts
]
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
name | string | My-Awesome-NFTs | name of NFT gallery |
nfts | array | See List NFTs |
Get gallery settings
需要验证身份。
请求
GET /nft/gallery_settings
回复
{
"success": true
"result": {
"id": 888789,
"public": true
}
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 888789 | NFT gallery id |
public | boolean | true | true if NFT gallery is public |
Edit gallery settings
需要验证身份。
请求
POST /nft/gallery_settings
请求参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
public | boolean | true | set NFT gallery public or private |
Latency statistics
See latency statistics for a period of time and for one or all subaccounts.
days
specifies the time period, from days
days ago up to now - defaults to 1.
You can specify a subaccount by passing its nickname to subaccount_nickname
, or specify the main account by using subaccount_nickname='_main'
. Leaving this field blank will return results aggregated across all subaccounts.
请求
GET /stats/latency_stats?days={days}&subaccount_nickname={subaccount_nickname}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
days | int | 5 | Optional. Number of days in the past to check. |
subaccount_nickname | str | '_main' | Optional. Subaccount name to get stats for specific subaccount (or main). |
回复格式
回复
{
"success": true,
"result": [
{
"bursty": true,
"p50": 0.059,
"requestCount": 43,
},
{
"bursty": false,
"p50": 0.047,
"requestCount": 27
},
]
}
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
bursty | boolean | true | Whether the orders are "bursty" (two or more orders sent from the same account simultaneously) |
p50 | number | 0.059 | 50th-percentile latency experienced by your account in the last 24 hours |
requestCount | number | 43 | Number of orders placed by your account in the last 24 hours |
Support tickets
Get all support tickets
Get all your support tickets (limit 100).
需要验证身份。
请求
GET /support/tickets
回复
{
"success": true,
"result": [
{
"id": 42,
"title": "Support ticket for your GBP deposit",
"time": "2021-07-14T22:27:11.041873+00:00",
"category": "fiat deposit",
"status": "open",
"error": None,
"fiatDeposit": {
"id": 37,
"coin": "GBP",
"size": 12.34,
"status": "complete",
"time": "2021-07-13T22:27:11.041873+00:00",
"confirmedTime": "2021-07-13T22:27:12.041873+00:00",
"uploadedFile": None,
"uploadedFileName": None,
"cancelReason": None,
"fiat": True,
"ach": False,
"type": "bank"
},
"depositHelpRequest": None,
"autoExpireAt": None
},
{
"id": 43,
"title": "BUSD not arriving.",
"time": "2021-07-15T22:27:11.041873+00:00",
"category": "crypto deposit",
"status": "open",
"error": None,
"fiatDeposit": None,
"depositHelpRequest": {
"id": 73,
"coin": "BUSD",
"wallet": "bsc",
"txid": "0xd232f8a398c8ed84a4344ab0076a0af0735a30fab7698541bee96230274de13e",
"size": None,
"transactionTime": "2021-07-14T21:27:11.041873+00:00",
"creditedSize": None
},
"autoExpireAt": None
},
{
"id": 44,
"title": "Help",
"time": "2021-07-16T22:27:11.041873+00:00",
"category": "other",
"status": "closed",
"error": None,
"fiatDeposit": None,
"depositHelpRequest": None,
"autoExpireAt": None
}
]
}
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 42 | Support ticket ID |
title | string | "Support ticket for your GBP deposit" | Support ticket title |
time | string | "2021-07-14T22:27:11.041873+00:00" | Support ticket creation time |
category | string | "fiat deposit" | Support ticket category |
status | string | "open" | Support ticket status |
error | string | None | Support ticket error; null if no error |
fiatDeposit | dict | None | Fiat deposit this support ticket relates to; null if not a fiat deposit ticket |
depositHelpRequest | dict | None | Deposit help request this support ticket relates to; null if not a crypto deposit ticket |
autoExpireAt | strong | None | Time at which the ticket expires; null by default |
Get support ticket messages
View all messages for one support ticket. You can only view messages for support tickets for your account.
需要验证身份。
请求
GET /support/tickets/<int:ticket_id>/messages
回复
{
"ticket": {
"id": 44,
"title": "Help",
"time": "2021-07-16T22:27:11.041873+00:00",
"category": "other",
"status": "closed",
"error": None,
"fiatDeposit": None,
"depositHelpRequest": None,
"autoExpireAt": None
},
"messages": [
{
"id": 164,
"message": "I need help.",
"uploadedFileName": None,
"authorIsCustomer": True,
"time": "2021-07-16T22:27:11.041873+00:00"
},
{
"id": 173,
"message": "Can you elaborate?",
"uploadedFileName": None,
"authorIsCustomer": False,
"time": "2021-07-16T22:47:11.041873+00:00"
},
{
"id": 189,
"message": "I don't know where to find the FTX API documentation.",
"authorIsCustomer": True,
"time": "2021-07-16T23:27:11.041873+00:00"
},
{
"id": 191,
"message": "You can find it at https://docs.ftx.com/.",
"authorIsCustomer": False,
"time": "2021-07-16T23:29:11.041873+00:00"
},
{
"id": 201,
"message": "Great, thank you!",
"authorIsCustomer": True,
"time": "2021-07-16T23:30:11.041873+00:00"
}
]
}
参数
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ticket_id | int | 42 | ID of the support ticket you want to view |
回复格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ticket | dict | Ticket object (see above) | |
messages | list | List of message objects (see below) |
Message object format
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
id | number | 164 | Message ID |
message | string | "I need help." | Content of the message |
uploadedFileName | string | None | File attached to the message; null if no such file |
authorIsCustomer | bool | True | True if the author of the message is the customer, false if the author is one of our support team members |
time | string | "2021-07-16T23:30:11.041873+00:00" | The time at which the message was sent |
Send a support message
Send a new message to one of your support tickets. Note that there is a limit of 100 messages per ticket.
需要验证身份。
请求
POST /support/tickets
Content-Type: multipart/form-data
回复
{
"success": true,
"result": null
}
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
title | string | "Help" | Title of your new support ticket. |
category | string | "other" | Category for your new support ticket. |
message | string | "I need help." | Initial message for your new support ticket. |
fiatDepositId | int | None | Optional. ID of the fiat deposit relating to your new support ticket. |
supportFile | file | None | Optional. Supported file formats (.png .jpg .pdf .doc .docx) |
Send a support message
Send a new message to one of your support tickets. Note that there is a limit of 100 messages per ticket.
需要验证身份。
请求
POST /support/tickets/<int:ticket_id>/messages
Content-Type: multipart/form-data
回复
{
"success": true,
"result": null
}
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ticket_id | int | 44 | The ID of the ticket you want to send to. |
message | string | "Thank you." | The message you want to send. |
supportFile | file | None | Optional. Supported file formats (.png .jpg .pdf .doc .docx) |
Update the status of your support ticket
需要验证身份。
请求
POST /support/tickets/<int:ticket_id>/status
{
"status": "closed"
}
回复
{
"success": true,
"result": null
}
净荷格式
姓名 | 类型 | 价值 | 描述 |
---|---|---|---|
ticket_id | int | 44 | The ID of the ticket you want to update. |
status | string | "closed" | "closed" to close an open support ticket and "open" to reopen a closed one. |
Count total number of unread support messages
Returns the total number of unread messages across all your support tickets.
需要验证身份。
请求
GET /support/tickets/count_unread
回复
{
"success": true,
"result": 42
}
Mark support messages read
Marks all support messages for the given ticket as read.
需要验证身份。
请求
POST /support/tickets/<int:ticket_id>/mark_as_read
回复
{
"success": true,
"result": null
}
Websocket API
Streaming API,包含最新的市场和账户挂单数据。 使用此 API,您可以将消息发送到服务器并收到以事件为基础的回复,无需轮询服务器获得回复。
Websocket 端点网址:wss://ftx.com/ws/
使用 JSON 发起请求和回复。
您可以在此找到示例代码:https://github.com/ftexchange/ftx
请求流程
Websocket connections go through the following lifecycle:
- Establish a websocket connection with
wss://ftx.com/ws/
- (Optional) Authenticate with
{'op': 'login', 'args': {'key': <api_key>, 'sign': <signature>, 'time': <ts>}}
- Send pings at regular intervals (every 15 seconds):
{'op': 'ping'}
. You will see an{'type': 'pong'}
response. - Subscribe to a channel with
{'op': 'subscribe', 'channel': 'trades', 'market': 'BTC-PERP'}
- Receive subscription response
{'type': 'subscribed', 'channel': 'trades', 'market': 'BTC-PERP'}
- Receive data
{'type': 'update', 'channel': 'trades', 'market': 'BTC-PERP', 'data': {'id': 15884651, 'price': 5231.0, 'size': 0.07, 'side': 'sell', 'liquidation': false, 'time': '2021-08-12T03:03:31.656050+00:00'}}
- Unsubscribe
{'op': 'unsubscribe', 'channel': 'trades', 'market': 'BTC-PERP'}
- Receive unsubscription response
{'type': 'unsubscribed', 'channel': 'trades', 'market': 'BTC-PERP'}
请求格式
发送到服务器的消息应包含以下字典项:
-“频道”:您希望获取数据的频道。 应该是下列之一 -“委托簿”为委托簿的市场数据 -“交易”为交易的市场数据 -“滚动信息区”为最佳报价和市场数据 -“市场”:您希望获取数据的市场。 例如:“BTC-PERP” -“操作”:您想要执行的操作。 应该是下列之一 -“订阅”用于订阅频道 -“取消订阅”用于取消频道订阅
回复格式
-“频道” -“市场” -“类型”:消息的类型 -“错误”:发生错误时显示。 当“类型”为“错误”时,还会有“代码”和“消息”字段。 “代码”采用标准 HTTP 错误代码值。 -“已订阅”:表示成功订阅了频道和市场。 -“已取消订阅”:表示成功取消频道和市场订阅。 -“信息”:用于向用户传达信息。 附带“代码”和“消息”字段。 - 服务器重新启动时,您可能会看到一条代码为“20001”的“信息”消息。 如果您看到此消息,请重新连接。 -“部分”:包含当前市场数据的快照。 数据快照可以在随附的“数据”字段中找到。 -“更新”:包含有关当前市场数据的更新。 更新可在随附的“数据”字段中找到。 -“代码”(可选) -“消息”(可选) -“数据”(可选)
公有市场行情接口
代号
The ticker
channel provides the latest best bid and offer market data. All messages are updates (update
), and the data
field contains:
- bid
: Best bid price if a bid exists, else null
- ask
: Best ask price if an ask exists, else null
- last
: Last trade price if it exists, else null
- time
: Timestamp
市场
The markets
channel provides information on the full set of tradable markets and their specifications. After subscription and whenever any market lists, delsists, or changes, you will receive a partial
message with information on all markets. The data
field both types of messages will contain a list of market information dictionaries, each of which contains:
name
: name of the marketenabled
: if the market is enabledpriceIncrement
: price tick sizesizeIncrement
: min size steptype
: 'future' or 'spot'baseCurrency
: base currency if spot, elsenull
quoteCurrency
: quote currency if spot, elsenull
underlying
: underlying if future, elsenull
restricted
: if the market has nonstandard restrictions on which jurisdictions can trade itfuture
:null
if the market has no future, otherwise a dictionary containing the following (see the REST /futures documentation for explanations of each field):name
,underlying
,description
,type
,expiry
,perpetual
,expired
,enbaled
,postOnly
,imfFactor
,underlyingDescription
,expiryDescription
,moveStart
,positionLimitWeight
,group
.
交易
The trades
channel provides data on all trades in the market. All messages are updates of new trades (update
) and the data
field contains:
- price
: Price of the trade
- size
: Size of the trade
- side
: Side of the taker in the trade
- liquidation
: true
if the trade involved a liquidation order, else false
- time
: Timestamp
委托簿
“盘口”查询提供盘口双边最优的100报价的数据。
初始快照
订阅后,您将收到委托簿(“部分”)的快照,其中包含“数据”字段,其中包含:
-“操作”:“部分“ -“买入” -“卖出” -“校验和”:见下方 -“时间”:时间戳
“买入”和“卖出”的格式如下:“[[最佳价格,该价格数额大小],[下一个最佳价格,该价格数额大小],...]”
更新
收到您的快照后,将会向您流式传输更新(消息“类型”为“更新”),“数据”字段带有:
-“操作”:“更新” -“买入” -“卖出” -“校验和”:见下方 -“时间”:时间戳
“买入”和“卖出”字段包含对委托簿的更新。
- 如果在价格为“5220.5”时的买入量变为“20.2”,则“买入”字段将变为“[[5220.5, 20.2]]”
- 如果在价格为“5223.5”时的卖出全部取消,则“卖出”字段将包含:“[[5233.5, 0]]”
校验和
Every message contains an unsigned 32-bit integer checksum
of the orderbook. You can run the same checksum
on your client orderbook state and compare it to checksum
field. If they are the same, your client's state is correct. If not, you have likely lost or mishandled a packet and should re-subscribe to receive the initial snapshot.
The checksum operates on a string that represents the first 100 orders on the orderbook on either side. The format of the string is:
<best_bid_price>:<best_bid_size>:<best_ask_price>:<best_ask_size>:<second_best_bid_price>:<second_best_bid_size>:...
For example, if the orderbook was comprised of the following two bids and asks, the string would be '5000.5:10:5001.0:6:4995.0:5:5002.0:7'
:
- bids:
[[5000.5, 10], [4995.0, 5]]
- asks:
[[5001.0, 6], [5002.0, 7]]
If there are more orders on one side of the book than the other, then simply omit the information about orders that don't exist: '5000.5:10.0:5001.0:7.5e-07:4995.0:5
.0'
:
- bids:
[[5000.5, 10.0], [4995.0, 5.0]]
- asks:
[[5001.0, 7.5e-5]]
Rules for float formatting for the checksum:
- Values smaller than 1e-04 (0.0001) should be formatted using scientific notation, and should contain zeroes before the exponent. For example, a message containing
7.5e-5
or0.000075
should be formatted like so for computing the checksum:'7.5e-05'
. - Values larger than 1e-04 should always contain a decimal and at least one digit after the decimal. For instance, a value of
1.0
must be formatted as'1.0'
, not'1'
.
The final checksum is the crc32
value of this string.
Grouped Orderbooks
The grouped orderbooks channel supplies orderbook data with grouped (collapsed) prices.
Disclaimer
Please note that we do NOT recommend using the grouped orderbooks channel in general: it should only be used for retrieving lower-granularity, possibly higher-depth information about the orderbook.
Subscribing
To subscribe, send a message specifying market and price grouping: {'channel': 'orderbookGrouped', 'market': 'BTC-PERP', 'grouping': 500}
. grouping
controls the granularity of price levels reported by the channel.
Messages
All messages from the orderbookGrouped
channel contain two fields: bids
and asks
. Each are formatted like so: [[best (grouped) price, size at price], [next next best price, size at price], ...]
.
The first message you are sent will contain a snapshot of the whole orderbook.
Subsequent messages only contain updates. For instance if you received the message: {'bids': [[9000, 1780.0]], 'asks': []}
, you should interpret that as meaning that since the last update you received, the only thing that has changed is that the total bid size at the 9000 level is now 1780.0.
Note that the price groupings are conservative: with a price grouping of 100, the size for a bid at 9395.5 would be attributed to the 9300 level, and the size for an ask at the same price would be attributed to the 9400 level.
私有接口
身份验证
您可以通过发送类似 %{code} 的消息登录
{
"args": {
"key": "<api_key>",
"sign": "<signature>",
"time": <ts>
},
"op": "login"
}
key
: 您的 API 密钥time
: 取整当前时间戳(以毫秒为单位)sign
: 以下字符串的 SHA256 HMAC,使用您的 API 密钥:<time>websocket_login
subaccount
: (可选)子账户名称
As an example, if:
time
:1557246346499
secret
:'Y2QTHI23f23f23jfjas23f23To0RfUwX3H42fvN-'
sign
would be d10b5a67a1a941ae9463a60b285ae845cdeac1b11edc7da9977bef0228b96de9
一个 websocket 连接最多可登录一名用户。 如果连接已通过身份验证,再次尝试登录会导致 400 错误。
执行
You will receive messages like so:
{
"channel": "fills",
"data": {
"fee": 78.05799225,
"feeRate": 0.0014,
"future": "BTC-PERP",
"id": 7828307,
"liquidity": "taker",
"market": "BTC-PERP",
"orderId": 38065410,
"tradeId": 19129310,
"price": 3723.75,
"side": "buy",
"size": 14.973,
"time": "2019-05-07T16:40:58.358438+00:00",
"type": "order"
},
"type": "update"
}
该频道将向所有市场流式传输您的执行价 您可以在经过身份验证的连接上发送 {'op': 'subscribe', 'channel': 'fills'}
进行订阅。
买卖盘
You will receive messages like so:
{
"channel": "orders",
"data": {
"id": 24852229,
"clientId": null,
"market": "XRP-PERP",
"type": "limit",
"side": "buy",
"size": 42353.0,
"price": 0.2977,
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"status": "closed",
"filledSize": 42353.0,
"remainingSize": 0.0,
"avgFillPrice": 0.2978,
"createdAt": "2021-05-02T22:40:07.217963+00:00"
},
"type": "update"
}
此频道可为您在所有市场中的挂单流式传输更新。 您可以在经过身份验证的连接上发送 {'op': 'subscribe', 'channel': 'orders'}
进行订阅。
FTX Pay
You will receive messages like so:
{
"channel": "ftxpay",
"data": {
"app": app object,
"payment": payment object,
"status": "paid"
},
"type": "update"
}
This channel streams updates for each completed payment and each returned payment. You can subscribe to it on an authenticated connection by sending {'op': 'subscribe', 'channel': 'ftxpay'}
.
The app and payment object formats can be seen here.
FIX API
FIX ( 金融信息交换协议)是一个标准的电子信息协议,可用于下单,获取订单状态更新及执行,或者取消订单。 我们的FIX api是基于FIX 4.2规格,借鉴其他主流数字货币交易平台的FIX应用,做出了优化和调整。 您可以在用户代码处查看示例: https://github.com/ftexchange/ftx FIX 终端 URL:tcp+ssl://fix.ftx.com:4363 用户需要使用SSL连接终端。 每次连接数字序列都会重置。暂不支持重发请求及序列重置信息。
消息
8=FIX.4.2|9=162|35=A|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX
所有信息都应该包含以下header: 这个文档使用“|”表示FIX的修改字段分隔符(byte 0x01)。真实的信息中,它可以被 0x01替换。
标签 | 姓名 | 示例 | 描述 |
---|---|---|---|
8 | BeginString | FIX.4.2 | Must be set to "FIX.4.2" |
9 | BodyLength | 162 | Length of the message body in bytes |
35 | MsgType | 8 | Message type |
49 | SenderCompID | zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx | Client API key (for messages from the client) |
56 | TargetCompID | FTX | Must be set to "FTX" (for messages from the client) |
34=1|52=20190525-07:17:48
消息还应包括序列号 MsgSeqNum (34) 和时间戳 SendingTime (52)。 序列号从 1 开始,必须随每条消息递增。 序列号重复或 不正确的邮件将被拒收。 序列号会在新连接重置。
Logon (A)
由客户端发送用于发起 FIX 会话。 必须在连接 建立后首先发送该消息。 每个连接只能建立一个会话;其他登录消息会 被拒收。
请求
8=FIX.4.2|9=162|35=A|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=1|52=20190525-07:51:51|98=0|108=30|96=8f7e7d37f8033ad249c1833687c230b6f4663f0dd72752899776bab9aa064783|10=237|
标签 | 姓名 | 示例 | 描述 |
---|---|---|---|
35 | MsgType | A | |
98 | EncryptMethod | 0 | Must be set to "0" (None) |
108 | HeartBInt | 30 | Must be set to "30" |
96 | RawData | 8f7e...4783 | Signature (see below) |
8013 | CancelOrdersOnDisconnect | Y | "Y": all account orders will be cancelled at the end of the session. "S": all orders placed during the session will be cancelled at the end of the session. Default: no orders will be cancelled. |
1 | Account | "my_subaccount" | Optional subaccount name; can be omitted if authenticating for main account |
签名
from datetime import datetime
import hmac
api_key = 'YOUR_API_KEY'
api_secret = 'YOUR_API_SECRET'
sending_time = datetime.now().strftime('%Y%m%d-%H:%M:%S')
sign_target = '\x01'.join([
sending_time, # SendingTime
'A', # MsgType
'1', # MsgSeqNum
api_key, # SenderCompID
'FTX', # TargetCompID
])
signature = hmac.new(api_secret.encode(), sign_target.encode(), 'sha256').hexdigest()
let crypto = require('crypto');
let apiKey = 'YOUR_API_KEY';
let apiSecret = 'YOUR_API_SECRET';
let sendingTime = '20190525-07:51:51';
let signTarget = [
sendingTime, // SendingTime
'A', // MsgType
'1', // MsgSeqNum
apiKey, // SenderCompID
'FTX', // TargetCompID
].join('\x01');
let hmac = crypto.createHmac('sha256', apiSecret);
let signature = hmac.update(signTarget).digest('hex');
为了安全起见,登录消息必须由客户端签名。 要计算签名,请连接 以下字段,由 FIX 字段分隔符(字节 0x01)连接,并计算 SHA256 HMAC 使用 API 密钥:
- SendingTime (52)
- MsgType (35)
- MsgSeqNum (34)
- SenderCompID (49)
- TargetCompID (56)
生成的哈希应该为十六进制编码。
回复
8=FIX.4.2|9=98|35=A|49=FTX|56=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|34=1|98=0|108=30|52=20190525-07:51:51.838|10=099
Tag | Name | Value |
---|---|---|
35 | MsgType | A |
98 | EncryptMethod | 0 |
108 | HeartBInt | 30 |
Heartbeat (0)
如果过去 30 秒内未收到消息,则由任一方发送。 也应发送 用于回复 TestRequest (1)(测试请求)。
8=FIX.4.2|9=86|35=1|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=2|52=20190525-07:52:24.029|10=049|
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | 0 | |
112 | TestReqID | 123 | If this heartbeat is in response to a TestRequest, copied from the TestRequest. |
测试请求 (1)
可由任何一方随时发送。
8=FIX.4.2|9=112|35=1|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=3|112=20190525-08:26:38.989|52=20190525-08:26:38.989|10=140|
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | 1 | |
112 | TestReqID | 123 | Arbitrary string, to be echoed back by a Heartbeat. |
Logout (5)
由任何一方发送用于终止会话。 另一方应再发送一条“退出” 消息以确认会话终止。 连接将随后关闭。
Tag | Name | Value |
---|---|---|
35 | MsgType | 5 |
New Order Single (D)
客户发送以提交新订单。 FIX API当前仅支持限价单。
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | D | |
21 | HandlInst | 1 | Must be set to "1" (AutomatedExecutionNoIntervention) |
11 | ClOrdID | order123 | Arbitrary client-selected string to identify the order; must be unique |
55 | Symbol | BTC-PERP | Symbol name |
40 | OrdType | 2 | Must be set to "2" (Limit) |
38 | OrderQty | 1.1 | Order size in base units |
44 | Price | 8000 | Limit price |
54 | Side | 1 | "1": buy; "2": sell |
59 | TimeInForce | 1 | Must be set to "1" (Good Till Cancel) or "3" (Immediate or Cancel) |
18 | ExecInst | E | This parameter is optional. "E": reduce only, "6": post only, not supplied: standard |
1368 | RejectOnPriceBand | 'Y' | This parameter is optional. 'Y' for rejecting the order if its price would instead be adjusted due to price bands. 'N' (or omitted) otherwise. |
1369 | RejectAfterTs | 1640080635 | This parameter is optional. If the order would be put into the placement queue after this timestamp, instead reject it. If it would be placed on the orderbook after the timestamp, then immediately close it instead (as if it were, for instance, a post-only order that would have taken) |
If the order is accepted, an ExecutionReport (8) with ExecType=A
(Pending New) will be returned.
Otherwise, an ExecutionReport with ExecType=8
(Rejected) will be returned.
Order Cancel Request (F)
由客户发送用于请求撤单。
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | F | |
37 | OrderID | 123456 | System-assigned order ID of the order |
41 | OrigClOrdID | order123 | Client-assigned order ID of the order |
Only one of OrderID (37) and OrigClOrdID (41) should be provided.
If the order is successfully cancelled, an ExecutionReport (8) with ExecType=6
(Pending Cancel) will be
returned. Otherwise, an OrderCancelReject (9) will be returned.
Order Cancel Reject (9)
服务器向客户端通知 OrderCancelRequest (F),即撤单请求失败。
8=FIX.4.2 9=124 35=9 49=FTX 56=**** 34=1294846 52=20210908-07:18:48.023 434=1 102=0 41=cancel123 10=191
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | 9 | |
11 | ClOrdID | cancel123 | Copied from OrderCancelRequest |
37 | OrderID | 123456 | Copied from OrderCancelRequest |
41 | OrigClOrdID | order123 | Copied from OrderCancelRequest |
39 | OrdStatus | 4 | "4" (Canceled) if the order was already cancelled |
102 | CxlRejReason | 1 | "0": order already cancelled, "1": unknown order |
434 | CxlRejResponseTo | 1 | Always set to "1" |
Mass Order Cancel Request (q)
Sent by the server in response to a Mass Order Cancel Request (q)
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | q | |
530 | MassCancelRequestType | 7 | 7 for cancelling all orders on all markets, 1 for cancelling all orders on a specific market |
11 | ClOrdID | order123 | optional; client-assigned ID for mass order cancellation request |
55 | Symbol | BTC-PERP | optional; symbol name. This field is is required if MassCancelRequestType is set to 1, and ignored otherwise |
A Mass Order Cancel Report (r) will be returned to the client.
Mass Order Cancel Report (r)
Sent by the server in response to a Mass Order Cancel Request (q)
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | r | |
530 | MassCancelRequestType | 7 | the MassCancelRequestType of the corresponding Mass Order Cancel Request |
11 | ClOrdID | order123 | optional; the ClOrdID of the corresponding Mass Order Cancel Request. Omitted if no ClOrdID was supplied. |
531 | MassCancelResponse | 0 if the request was rejected, otherwise set to the MassCancelRequestType of the corresponding Mass Order Cancel Request | |
532 | MssCancelRejectReason | optional; 0 if the market specified in the Mass Order Cancel Request was unknown |
Order Status Request (H)
由客户发送用于请求挂单状态。
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | H | |
37 | OrderID | 123456 | OrderID of the order to request, or "*" to request all pending orders |
41 | OrigClOrdID | order123 | Client-assigned order ID of the order |
20000 | IncludeFillInfo | N | If Y, server will include fill info |
The server will respond with an ExecutionReport (8) with ExecType=I
(OrderStatus) with the
requested order or orders. Only one of OrderID (37) and OrigClOrdID (41) should be provided.
When there are no open orders, the server will include Text (58) of "No open orders".
IncludeFillInfo包含的其他字段(20000 = Y):
Tag | Name | Value | Description |
---|---|---|---|
1362 | NoFills | 1 | Number of fills for this order |
以下字段包含零次或多次,每次填充一次:
Tag | Name | Value | Description |
---|---|---|---|
1363 | FillExecID | 23436 | Fill ID |
1364 | FillPx | 10.1 | Fill price |
1365 | FillQty | 6.32 | Fill quantity |
1366 | FillTradeID | 101293 | Fill trade ID. This will be shared by the fill corresponding to the other side of the trade. |
1367 | FillTime | 20200219-08:33:26.513 | Fill time |
1443 | FillLiquidityInd | 2 | 1 for maker, 2 for taker |
20100 | FeeRate | 0.0007 | Fees paid on the fill, in percent |
20101 | Fee | 0.0446824 | Fees paid on the fill, in USD |
Execution Report (8)
由服务器在下列情况发送:挂单已执行、挂单变更或 回复来自客户端的 NewOrderSingle (D)(新下单)、OrderCancelRequest (F)(撤单请求)、或 OrderStatusRequest (H)(挂单状态请求) 消息。
pending order (order ack):
8=FIX.4.2 9=251 35=8 49=FTX 56=**** 34=1039761 52=20210520-15:23:31.323 150=A 17=0e71c26d-9b3d-42f1-9760-c74a9459a841 37=501249457 11=order123 55=BTC-PERP 38=0.98 44=35593.0 54=2 39=A 14=0 151=0.98000000 6=0 10=026
new order:
8=FIX.4.2 9=261 35=8 49=FTX 56=**** 34=1063736 52=20210520-12:41:43.416 150=0 17=bbf0ac39-91e4-47bd-aacf-f2ff356c6891 60=20210520-16:46:47.411 37=501249457 11=order123 55=BTC-PERP 38=0.98 44=35593.0 54=1 39=0 14=0.0 151=0.98 6=0 10=081
fill for order:
8=FIX.4.2 9=272 35=8 49=FTX 56=**** 34=403622 52=20210520-12:41:46.134 150=1 17=370905178 60=20210520-12:41:46.104 37=501249457 11=order123 55=BTC-PERP 38=.7270 44=35593.0 54=2 39=1 14=0.08 151=0.9 6=35591.0 31=35591.0 32=0.08 1366=184114783 1057=N 12=-1.0016660525 13=3 10=233
fully filled/done:
8=FIX.4.2 9=261 35=8 49=FTX 56=**** 34=20 52=20210520-12:41:47.123 150=3 17=c9c8a56e-2159-445e-bb9d-acfeede977b2 60=20210520-12:41:47.112 37=501249457 11=order123 55=BTC-PERP 38=0.98 44=35593.0 54=2 39=3 14=0.98 151=0.0 6=35593.0 10=125
pending cancel:
8=FIX.4.2 9=251 35=8 49=FTX 56=**** 34=1063738 52=20210520-12:41:43.434 150=6 17=5f18f089-a9bc-414a-b0c2-452642e670c7 37=5012978452 11=order456 55=BTC-PERP 38=0.94000000 44=34933.0 54=1 39=6 14=0 151=0.94000000 6=0 10=055
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | 8 | |
11 | ClOrdID | order123 | Client-selected order ID. |
37 | OrderID | 123456 | Server-assigned order ID |
17 | ExecID | d840c87b-ad98-47b1-95d3-4d41950fa776 | unique execution ID. Equal to Fill ID if this message was the result of a fill |
55 | Symbol | BTC-PERP | Symbol name |
54 | Side | 1 | "1": buy; "2": sell |
38 | OrderQty | 1.2 | Original order quantity |
44 | Price | 8000 | Original order price |
150 | ExecType | 1 | Reason for this message (see below) |
39 | OrdStatus | 0 | Order status (see below) |
14 | CumQty | 0.4 | Quantity of order that has already been filled |
151 | LeavesQty | 0.8 | Quantity of order that is still open |
84 | CxlQty | 0.0 | Quantity cancelled by self-trade prevention. Only present if the cancelled quantity is greater than zero |
60 | TransactTime | 20190525-08:26:38.989 | Time of the order update. Only present on order updates |
31 | LastPx | 7999.25 | Fill price. Only present if this message was the result of a fill |
32 | LastQty | 0.4 | Fill quantity. Only present if this message was the result of a fill |
1057 | AggressorIndicator | Y | "Y": taker fill; "N": maker fill. Only present if this message was the result of a fill |
1366 | FillTradeID | 101293 | Fill trade ID. Only present if this message was the result of a fill |
6 | AvgPx | 7999.25 | Average fill price for all fills in order. Only present if this message was the result of a fill |
12 | Commission | 0.0067307233000000 | Fee for trade, reported in USD. Only present if this message was the result of a fill |
13 | CommType | 3 | Always 3 (absolute) |
103 | OrdRejReason | 3 | Reason the order was rejected (see below). Only present on rejected NewOrderSingle (D) requests |
58 | Text | 58 | Description of the reason the order was rejected (e.g., Too many requests). Only present on rejected NewOrderSingle (D) requests |
5000 | Liquidation | 58 | "Y": messages corresponds to an on-market liquidation order. "N" or absent: it does not. |
ExecType values
ExecType (150)(执行类型)字段表明发送此 ExecutionReport(执行报告)的原因。
ExecType | Description |
---|---|
0 | New order |
1 | New fill for order |
3 | Order done (fully filled) |
4 | Order cancelled |
5 | Order resized (possible for reduce-only orders) |
A | Response to a successful NewOrderSingle (D) request |
8 | Response to a rejected NewOrderSingle (D) request |
6 | Response to a successful OrderCancelRequest (F) request |
I | Response to a OrderStatusRequest (H) request |
Note that every fill will generate a new ExecType=1
message. If a fill causes an order to be fully
filled, both a ExecType=1
message and a ExecType=3
message will be generated.
Similarly, a newly placed order that is immediately matched against an opposing order will generate
both a ExecType=0
message and a ExecType=1
message.
OrdStatus values
OrdStatus | Description |
---|---|
A | Pending order |
0 | New order |
1 | Partially filled order |
3 | Fully filled order |
4 | Cancelled order |
5 | Resized order |
6 | Pending cancel |
OrdRejReason values
OrdRejReason | Description |
---|---|
3 | Risk limits exceeded |
99 | Too many requests |
0 | Other errors |
Reject (3)
由服务器发送用于回复无效消息。
Tag | Name | Value | Description |
---|---|---|---|
35 | MsgType | 3 | |
45 | RefSeqNum | 2 | Sequence number of the rejected message |
371 | RefTagID | 38 | Tag number of the rejected field |
372 | RefMsgType | D | Message type of the rejected message |
58 | Text | Missing quantity | Human-readable description of the reason for the rejection |
373 | SessionRejectReason | 1 | Code to identify the rejection reason (see below) |
Rejection reason codes
SessionRejectReason | Description |
---|---|
1 | Required tag missing |
5 | Value incorrect for this tag |
6 | Incorrect data format for value |
11 | Invalid MsgType |