-
Notifications
You must be signed in to change notification settings - Fork 0
rest_api_v2_reference
- All API response data should be in JSON format
- response data includes code & data field
- code field is status code, 0 means ok, data field is data
Example:
{
"code": 0,
"data": ...
}
Example:
{
"code": 1001, // status code
"data": "pair" // missed param
}
Example:
{
"code": 1002, // status code
"data": "pair" // invalid param
}
Example:
{
"code": 1003, // status code
"data": "pair" // Type mismatch param
}
Example:
{
"code":1004, // status code
"data":"1111" // non-exist trade pair
}
Query market period data of specified period
URI: /v2/market/histories
Method: GET
Parameter:
Name | Type | Description | Required |
---|---|---|---|
period | string | market period | yes |
Period:
Parameter | Definition | Parameter | Definition | Parameter | Definition |
---|---|---|---|---|---|
1m | 1 minute | 1h | 1 hour | 1d | 1 day |
5m | 5 minutes | 2h | 2 hours | 1w | 1 week |
15m | 15 minutes | 4h | 4 hours | 1M | 1 month |
30m | 30 minutes | 6h | 6 hours | ||
12h | 12 hours |
Request example:
curl https://api.thinkbit.com/v2/market/histories?period=1d
Response example:
{
"code": 0,
"data": [
{
"time": 1529798400000, // time, in millisecond
"pair": "ETH_BTC", // name of trade pair
"values": [
"0.076973", // open price of period
"0.076838", // close price of period
"0.07606", // lowest price of period
"0.077378", // highest price of period
"27.3411", // trading volume
"2.1000977805", // turnover
"0.076973", // close price of last period
"121", // number of trades
"0.205" // trading volume of close price
]
},
{
"time": 1529798400000,
"pair": "EOS_ETH",
"values": [
"0.017866",
"0.017433",
"0.017178",
"0.018546",
"2013.0353",
"35.5771107184",
"0.017866",
"123",
"18.4377"
]
},
{
"time": 1529798400000,
"pair": "EOS_BTC",
"values": [
"0.001372",
"0.00135",
"0.001346",
"0.001386",
"2446.2574",
"3.3256018155",
"0.001372",
"128",
"20.1341"
]
},
{
"time": 1529798400000,
"pair": "EOS_USDT",
"values": [
"8.4371",
"8.2357",
"8.1938",
"8.5026",
"2681.5773",
"22255.92854128",
"8.4371",
"126",
"18.2521"
]
},
{
"time": 1529798400000,
"pair": "BTC_USDT",
"values": [
"6136.14",
"6072.41",
"5937.46",
"6210.94",
"3.7433",
"22847.165608",
"6136.14",
"134",
"0.0267"
]
},
{
"time": 1529798400000,
"pair": "ETH_USDT",
"values": [
"473.25",
"465.78",
"463.37",
"475.6",
"55.9782",
"26252.350092",
"473.25",
"128",
"0.4091"
]
}
]
}
Query market ticker data
URI: /v2/market/tickers
Method: GET
Request example:
curl https://api.thinkbit.com/v2/market/tickers
Response example:
{
"code": 0,
"data": [
{
"time": 1530862375429, // time, in millisecond
"pair": "ETH_BTC", // name of trade pair
"current": "0.070269", // current price
"volume_current": "0.2399", // trading volume of current price
"increment_24h": "-0.001124", // price change value in 24 hours
"highest_24h": "0.072012", // highest price in 24 hours
"lowest_24h": "0.070082", // lowest price in 24 hours
"volume_24h": "222.45380000000003", // trading volume in 24 hours
"highest_bid": "0.069891", // highest bid
"highest_bid_amount": "0.1", // highest bid amount
"lowest_ask": "0.070642", // lowest ask
"lowest_ask_amount": "0.1", // lowest ask amount
"change_24h": "-1.5744" // price change percentage in 24 hours
},
{
"time": 1530862374942,
"pair": "EOS_ETH",
"current": "0.018232",
"volume_current": "29.6759",
"increment_24h": "-0.000795",
"highest_24h": "0.019975",
"lowest_24h": "0.017696",
"volume_24h": "27341.4681",
"highest_bid": "0.017182",
"highest_bid_amount": "9.33",
"lowest_ask": "0.018661",
"lowest_ask_amount": "30.15",
"change_24h": "-4.1783"
},
{
"time": 1530862375218,
"pair": "EOS_BTC",
"current": "0.001289",
"volume_current": "17.0712",
"increment_24h": "-0.000074",
"highest_24h": "0.001379",
"lowest_24h": "0.001284",
"volume_24h": "20040.206399999995",
"highest_bid": "0.001277",
"highest_bid_amount": "4.85",
"lowest_ask": "0.001305",
"lowest_ask_amount": "4.89",
"change_24h": "-5.4292"
},
{
"time": 1530862375103,
"pair": "EOS_USDT",
"current": "8.3349",
"volume_current": "43.1394",
"increment_24h": "-0.633",
"highest_24h": "9.1656",
"lowest_24h": "8.3123",
"volume_24h": "46383.8888",
"highest_bid": "8.2472",
"highest_bid_amount": "7.66",
"lowest_ask": "8.4231",
"lowest_ask_amount": "7.76",
"change_24h": "-7.0585"
},
{
"time": 1530862375228,
"pair": "BTC_USDT",
"current": "6460.67",
"volume_current": "0.06",
"increment_24h": "-176.13",
"highest_24h": "6812.95",
"lowest_24h": "5922.07",
"volume_24h": "59.355399999999996",
"highest_bid": "6425.71",
"highest_bid_amount": "0.0985",
"lowest_ask": "6492.45",
"lowest_ask_amount": "0.0971",
"change_24h": "-2.6538"
},
{
"time": 1530862374902,
"pair": "ETH_USDT",
"current": "453.87",
"volume_current": "0.9173",
"increment_24h": "-16.49",
"highest_24h": "478.88",
"lowest_24h": "452",
"volume_24h": "494.0506",
"highest_bid": "451.62",
"highest_bid_amount": "0.098",
"lowest_ask": "456.42",
"lowest_ask_amount": "0.097",
"change_24h": "-3.5058"
}
]
}
Request example: Query market ticker data, use parameter filter result set
curl https://api.thinkbit.com/v2/market/tickers?pairs=ETH_BTC,EOS_BTC,UNKNOWN
Response example:
{
"code": 0,
"data": [
{
"time": 1530862375429, // time, in millisecond
"pair": "ETH_BTC", // name of trade pair
"current": "0.070269", // current price
"volume_current": "0.2399", // trading volume of current price
"increment_24h": "-0.001124", // price change value in 24 hours
"highest_24h": "0.072012", // highest price in 24 hours
"lowest_24h": "0.070082", // lowest price in 24 hours
"volume_24h": "222.45380000000003", // trading volume in 24 hours
"highest_bid": "0.069891", // highest bid
"highest_bid_amount": "0.1", // highest bid amount
"lowest_ask": "0.070642", // lowest ask
"lowest_ask_amount": "0.1", // lowest ask amount
"change_24h": "-1.5744" // price change percentage in 24 hours
},
{
"time": 1530862375218,
"pair": "EOS_BTC",
"current": "0.001289",
"volume_current": "17.0712",
"increment_24h": "-0.000074",
"highest_24h": "0.001379",
"lowest_24h": "0.001284",
"volume_24h": "20040.206399999995",
"highest_bid": "0.001277",
"highest_bid_amount": "4.85",
"lowest_ask": "0.001305",
"lowest_ask_amount": "4.89",
"change_24h": "-5.4292"
}
]
}
Query ticker data of specified trade pair
URI: /v2/ticker/{pair}
Method: GET
Parameter:
Parameter | Type | Description | Required |
---|---|---|---|
pair | string | name of trade pair | yes |
Request example:
curl https://api.thinkbit.com/v2/ticker/EOS_ETH
Response example:
{
"code": 0,
"data": {
"time": 1530862637941, // time, in millisecond
"pair": "EOS_ETH", // name of trade pair
"current": "0.018365", // current price
"volume_current": "0", // trading volume of current price
"increment_24h": "-0.00066", // price change value in 24 hours
"highest_24h": "0.019975", // highest price in 24 hours
"lowest_24h": "0.017568", // lowest price in 24 hours
"volume_24h": "27323.188299999998", // trading volume in 24 hours
"highest_bid": "0.018019", // highest bid
"highest_bid_amount": "68.55", // highest bid amount
"lowest_ask": "0.018715", // lowest ask
"lowest_ask_amount": "52.99", // lowest ask amount
"change_24h": "-3.4691" // price change percentage in 24 hours
}
}
Query history period data of specified trade pair
URI:/v2/history/{pair}?period={period}&size={size}
Method: GET
Parameter:
Parameter | Type | Description | Required |
---|---|---|---|
pair | string | name of trade pair | yes |
period | string | market period | yes |
size | int | length of data set | yes |
Period:
Parameter | Definition | Parameter | Definition | Parameter | Definition |
---|---|---|---|---|---|
1m | 1 minute | 1h | 1 hour | 1d | 1 day |
5m | 5 minutes | 2h | 2 hours | 1w | 1 week |
15m | 15 minutes | 4h | 4 hours | 1M | 1 month |
30m | 30 minutes | 6h | 6 hours | ||
12h | 12 hours |
Request example:
curl https://api.thinkbit.com/v2/history/EOS_ETH?period=1m&size=5
Response example:
{
"code": 0,
"data": [
{
"time": 1529808300000, // time, in millisecond
"pair": "EOS_ETH", // name of trade pair
"values": [
"0.017436", // open price of period
"0.017436", // close price of period
"0.017436", // lowest price of period
"0.017436", // highest price of period
"0", // trading volume
"0", // turnover
"0.017436", // close price of last period
"0", // number of trades
"17.5732" // trading volume of close price
]
},
{
"time": 1529808240000,
"pair": "EOS_ETH",
"values": [
"0.017398",
"0.017436",
"0.017398",
"0.017436",
"17.5732",
"0.3064063152",
"0.017398",
"1",
"17.5732"
]
},
{
"time": 1529808180000,
"pair": "EOS_ETH",
"values": [
"0.017398",
"0.017398",
"0.017398",
"0.017398",
"0",
"0",
"0.017398",
"0",
"18.3078"
]
},
{
"time": 1529808120000,
"pair": "EOS_ETH",
"values": [
"0.017435",
"0.017398",
"0.017398",
"0.017435",
"18.3078",
"0.3185191044",
"0.017435",
"1",
"18.3078"
]
},
{
"time": 1529808060000,
"pair": "EOS_ETH",
"values": [
"0.017433",
"0.017435",
"0.017433",
"0.017435",
"18.0892",
"0.315385202",
"0.017433",
"1",
"18.0892"
]
}
]
}
URI:/v2/history/millis/{pair}?period={period}&begin={begin}&end={end}
Method: GET
Parameter:
Parameter | Type | Type | Required |
---|---|---|---|
pair | string | name of trade pair | yes |
period | string | market period | yes |
begin | bigint | start time of query, in millisecond | yes |
end | bigint | end time of query, in millisecond | yes |
Period:
Parameter | Definition | Parameter | Definition | Parameter | Definition |
---|---|---|---|---|---|
1m | 1 minute | 1h | 1 hour | 1d | 1 day |
5m | 5 minutes | 2h | 2 hours | 1w | 1 week |
15m | 15 minutes | 4h | 4 hours | 1M | 1 month |
30m | 30 minutes | 6h | 6 hours | ||
12h | 12 hours |
Request example:
curl https://api.thinkbit.com/v2/history/millis/EOS_ETH?period=1d&begin=1528992000000&end=1529769600000
Response example:
{
"code": 0,
"data": [
{
"time": 1529020800000, // time, in millisecond
"pair": "EOS_ETH", // name of trade pair
"values": [
"0.02155", // open price of period
"0.021557", // close price of period
"0.020685", // lowest price of period
"0.022412", // highest price of period
"14539.3564", // trading volume
"312.6838363162", // turnover
"0.02155", // close price of last period
"1198", // number of trades
"11.6651" // trading volume of close price
]
},
{
"time": 1529107200000,
"pair": "EOS_ETH",
"values": [
"0.021557",
"0.020961",
"0.020674",
"0.021973",
"14742.0509",
"314.3198255734",
"0.021557",
"1181",
"14.784"
]
},
{
"time": 1529193600000,
"pair": "EOS_ETH",
"values": [
"0.020961",
"0.020567",
"0.020416",
"0.021659",
"14720.716",
"308.5273589862",
"0.020961",
"1190",
"11.603"
]
},
{
"time": 1529280000000,
"pair": "EOS_ETH",
"values": [
"0.020567",
"0.020578",
"0.020273",
"0.021596",
"14620.3619",
"301.8494736567",
"0.020567",
"1177",
"10.3294"
]
},
{
"time": 1529366400000,
"pair": "EOS_ETH",
"values": [
"0.020578",
"0.019895",
"0.018841",
"0.021071",
"16385.1548",
"329.4962570625",
"0.020578",
"1231",
"15.0954"
]
},
{
"time": 1529452800000,
"pair": "EOS_ETH",
"values": [
"0.019895",
"0.019338",
"0.018796",
"0.02092",
"19711.8645",
"387.6314292214",
"0.019895",
"1218",
"18.5154"
]
},
{
"time": 1529539200000,
"pair": "EOS_ETH",
"values": [
"0.019338",
"0.019766",
"0.018746",
"0.020606",
"16845.7214",
"331.1197508937",
"0.019338",
"1026",
"18.3724"
]
},
{
"time": 1529625600000,
"pair": "EOS_ETH",
"values": [
"0.019766",
"0.018565",
"0.017996",
"0.0199",
"17977.8579",
"341.2285284085",
"0.019766",
"1145",
"18.0097"
]
},
{
"time": 1529712000000,
"pair": "EOS_ETH",
"values": [
"0.017959",
"0.017866",
"0.01707",
"0.018747",
"14520.3109",
"257.2937207171",
"0.018565",
"895",
"15.2589"
]
}
]
}
Query transaction data of specified trade pair
URI: /v2/deal/{pair}
Method: GET
Parameter:
Parameter | Type | Description | Required |
---|---|---|---|
pair | string | name of trade pair | yes |
size | int | length of data set | yes |
Request example:
curl https://api.thinkbit.com/v2/deal/EOS_ETH?size=2
Response example:
{
"code": 0,
"data": [
{
"time": 1529811082258, // time, in millisecond
"side": "buy", // deal direction, sell or buy
"values": [
"0.017262", // deal price
"16.1633" // deal amount
]
},
{
"time": 1529811012254,
"side": "sell",
"values": [
"0.017277",
"15.1537"
]
}
]
}
Query order book data of specified trade pair
URI:/v2/orderbook/{pair}?offset={offset}&accuracy={accuracy}&size={size}
Method: GET
Parameter:
Parameter | Type | Description | Required |
---|---|---|---|
pair | string | name of trade pair | yes |
size | int | length of data set | yes |
offset | int | float point offset | yes |
accuracy | int | statistical accuracy | yes |
Used for order book data query and push, use half_even mode
Parameter | Definition |
---|---|
1 | precision is 1 |
2 | precision is 2.5 |
5 | precision is 5 |
Used for order book data, use half_even mode, range: 0~10
The max offset is 10. If trade pair precision < 10 then the max offset is the trade pair precision.
Response data format:
Parameter | Type | Description |
---|---|---|
asks | array | sell side order set |
bids | array | buy side order set |
Request example:
curl https://api.thinkbit.com/v2/orderbook/EOS_ETH?offset=0&accuracy=1&size=5
Response example:
{
"code": 0,
"data": {
"asks": [
{
"values": [
"0.017409", // ask price
"7.96" // ask amount
]
},
{
"values": [
"0.017481",
"40"
]
},
{
"values": [
"0.017535",
"23.39"
]
},
{
"values": [
"0.017562",
"9.84"
]
},
{
"values": [
"0.019102",
"17.74"
]
}
],
"bids": [
{
"values": [
"0.017021", // bid price
"6.81" // bid amount
]
},
{
"values": [
"0.0169",
"2.01"
]
},
{
"values": [
"0.016827",
"71.92"
]
},
{
"values": [
"0.01631",
"108.5"
]
},
{
"values": [
"0.015604",
"62.15"
]
}
]
}
}
retrieve server time
URI: /v2/time
Method: GET
Parameter: null
Request example:
curl https://api.thinkbit.com/v2/time
Response example:
{
"iso":"2018-06-19T16:28:22.755Z", // ISO8601 (yyyy-MM-ddTHH:mm:ss.SSSZZ) format timestamp
"mills":1529425702755, // timestamp, in millisecond
"epoch":1529425702 // Unix time
}