Overview
Welcome to the Coincall API! You can use our API to access Coincall Open API endpoints.
General Information
- Some endpoints will require an API Key to access. Please refer to this page to setup API Key.
- Base endpoint for REST: https://api.coincall.com
- While setting API Key, it is recommended to set IP access whitelist for security.
- Never share your API Key/Secret with anyone.
- The default permission of newly created API is read-only.
- Endpoint returns a JSON object.
- All time and timestamp related fields are in milliseconds.
Working with Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
endpoint, the parameters must be sent in therequest body
with content typeapplication/json
. - Parameters may be sent in any order.
- Because the API system is asynchronous, it is normal and expected that there will be a delay in the returned data.
Rate Limits
Endpoint | Rate Limit | Rule |
---|---|---|
Get Public Configuration | 10 / 2s | per IP address and product |
Get Funding Rate | 10 / 2s | per IP address |
Get Position / Open Orders | 5 / 1s | per User ID |
Get Historical Order / Transactions | 4 / 1s | per User ID |
Get Account Information | 2 / 1s | per User ID |
Get Orderbook | 30 / 2s | per User ID |
Place Order | 30 / 2s | per User ID |
Cancel Order | 30 / 2s | per User ID |
Authentication
API Resources
If you have any API related issues, please contact api@coincall.com
.
Generating API Keys
Create an API Key on the website before signing any requests. After creating an APIKey, keep the following information safe:
- APIKey
- APISecret
The system returns randomly-generated APIKeys and APISecrets. We cannot recover the APISecrets if you have lost it. You will need to create a new set of APIKey.
ApiKeys and apiSecret are case sensitive.
There are two permissions below that can be associated with an API key. One or more permission can be assigned to any key.
Read-Only - Can request and view public info such as public configurations.
Trade - Can place and cancel orders, and request and view account info such as bills and history.
Endpoint Security Type
- Each endpoint has a security type that determines how you will interact with it.
- Security type is stated next to the NAME of the endpoint. If no security type is stated, assume the security type is
NONE
.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
SIGNED | Requires valid API-Key and Signed. |
Making Requests
All private REST requests must contain the following headers:
X-CC-APIKEY
The API Key as a String.sign
The Hex-encoded signature (see Signing Messages subsection for details).ts
The timestamp of your request .e.g : 1688436087184X-REQ-TS-DIFF
sent to specify the number of milliseconds afterts
the request is valid for. IfX-REQ-TS-DIFF
is not sent, it defaults to 5000.
Request bodies should have content type application/json
and be in valid JSON format.
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= X-REQ-TS-DIFF) {
// process request
} else {
// reject request
}
Serious trading is about timing.
Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With X-REQ-TS-DIFF
, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server.
Signature
Sign Procedures:
- Add
?
after request uri path, separate each parameter with a&
which represents Parameters concatenation, sort them alphabetically. (If no prameter here, can only add?
after request uri path) - Create a prehash string of
method + uri + &uuid=your_api_key&ts=your_timestamp&x-req-ts-diff=your_ts_diff
(where+
represents String concatenation, if no prameter here, please usemethod + uri + uuid=your_api_key&ts=your_timestamp&x-req-ts-diff=your_ts_diff
instead). - Sign the prehash string with the apiSecret using the HMAC SHA256.
- Encode the signature in the Hex format.
- The
sign
should be UPPER.
Example:
your_prehash_string=POST/open/futures/leverage/set/v1?leverage=1&symbol=BTCUSD&uuid=xdtHWn32rsuDQConutzl9JDZB+Y1leitFl356YHrmts=&ts=1688436087184&x-req-ts-diff=3000
sign=hmac.new(your_api_secret.encode('utf-8'), your_prehash_string.encode('utf-8'), hashlib.sha256).hexdigest()
The timestamp value is the same as the ts
header with UNIX millisecond timestamp of when the request was created and sent, e.g. 1688436087184
The request method
should be in UPPERCASE: e.g. GET
and POST
.
The uri
is the path of requesting an endpoint, separate each parameter with a &
, ?
represents Parameters concatenation.
Example: /open/futures/leverage/set/v1?leverage=1&symbol=BTCUSD
Your API Secret is generated when you create an APIKey.
Field Type Enumeration
Name | Product | Note |
---|---|---|
type | options | Option order type: 1 CALL, 2 PUT |
tradeSide | options/futures/websocket | Trade side: 1 BUY, 2 SELL |
tradeType | options/futures/websocket | Trade type: 1 LIMIT, 2 MARKET, 3 POST_ONLY, 4 STOP_LIMIT, 5 STOP_MARKET |
reduceOnly | options/futures/websocket | Reduce only: 0 FALSE, 1 TRUE |
state | options/websocket | Order status: -10 ILLEGAL, -1 PRE, 0 NEW, 1 FILLED, 2 PARTIALLY_FILLED, 3 CANCELED, 4 PRE_CANCEL, 5 CANCELING, 6 INVALID, 10 CANCEL_BY_EXERCISE |
state | futures/websocket | Order status: -2 WAITING_EFFECT, -1 PRE, 0 NEW, 1 FILLED, 2 PARTIALLY_FILLED, 3 CANCELED, 4 PRE_CANCEL, 5 CANCELING, 6 INVALID |
isTaker | options/futures/websocket | Filled by taker side: 0 FALSE 1 TRUE |
period | websocket | granularity of K-line: m1 1minute, m5 5minutes, m15 15minutes, m30 30minutes, h1 1hour, h4 4hours, d1 1day, w1 1week, mn1 1month, quarter 3months |
stp | options | stp type: 1 CM, 2 CT, 3 CB |
Error Information
{
"code": -40004,
"msg": "Invalid symbol."
}
All endpoints return error payload:
Specific error codes and messages defined in Error Codes
Market Maker Program
High-caliber trading teams are welcomed to work with Coincall as market makers in providing a liquid, fair, and orderly platform to all users. Coincall market makers could enjoy favourable fees in return for meeting the market making obligations.
Prerequisites (Satisfy any condition):
- Monthly trading volume ≥5,000,000 USD on major exchanges
- Qualified Market Maker on other exchange
Interested parties could drop us an email at mm@coincall.com
with the below details:
- Your account email
- Contact details (additional to your account email)
- A screenshot of your maker trading volume (such as 30 days trading volume or VIP status)
- Specify the product line you would like to provide liquidity for (you may choose more than one)
- Futures
- Options
Remarks:
Market making obligations and trading fees will be shared to successful parties only.
Public Endpoints
Check Server Time
Test connectivity to the Rest API and get the current server time.
Response:
{
"code":0,
"msg":null,
"i18nArgs":null,
"data":{
"serverTime":1687250525704 // Server time
}
}
HTTP Request
GET https://api.coincall.com/time
Parameter
Null
Get Public Configurations
Get trading-related configuration
Response:
{
"code":0,
"msg":"Success",
"i18nArgs":null,
"data":{
// Options configuration
"optionConfig":{
"BTCUSD":{
"symbol":"BTCUSD", // Symbol
"takerFee":0.0004, // Taker fee
"maxOrderNumber":200, // Maximum number of open orders
"multiplier":0.01, // Multiplier
"settle":"USD", // Settlement currency
"priceDecimal":2, // Decimal of price
"limitMaxQty":1000, // Maximum value of quantity for limit order
"tickDecimal":1, // Decimal of tick
"tickSize":0.1, // Tick size
"greeksDecimal":5, // Decimal of greeks
"makerFee":0.0003, // Maker fee
"marketMaxQty":100, // Maximum value of quantity for market order
"qtyDecimal":2, // Decimal of quantity
"maxPositionQty":1000, // Maximum quantity of position
"base":"BTC" // Base token
}
},
"futuresConfig":{
"BTCUSD":{
"symbol":"BTCUSD", // Symbol
"positionQty":100000000, // Maximum quantity of position
"takerFee":0.0006, // Taker fee
"maxOrderNumber":200, // Maximum number of open orders
"settle":"USD", // Settlement currency
"priceDecimal":1, // price of Decimal
"limitMaxQty":1000, // Maximum value of quantity for limit order
"tickDecimal":1, // Decimal of tick
"tickSize":0.1, // Tick size
"makerFee":0.0002, // Maker fee
"triggerLimit":20,
"marketMaxQty":120,// Maximum value of quantity for market order
"qtyDecimal":3, // Decimal of quantity
"base":"BTC", // Base token
"minQty":0.001 // Minimum value of quantity
}
}
}
}
HTTP Request
GET https://api.coincall.com/open/public/config/v1
Parameter
Null
Get Funding Rate
Get real-time funding rate
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": [
{
"symbol": "BTCUSD",// Symbol
"rate": "-0.00500000",// Funding rate
"contractId": "1",// Contract ID
"ts": 1687250525704 // Timestamp
}
]
}
HTTP Request
GET https://api.coincall.com/open/public/fundingRate/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD,ETHUSD | false | Contract name (if not passed, all will be taken. Multiple can be taken separated by commas) |
Set Countdown
Set countdown time, only opened for MM.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": true
}
HTTP Request
POST https://api.coincall.com/open/futures/countdown/cancel/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Contract name |
type | integer | 1 | true | Type of trade, 1:options, 2:futures, 3:spot |
countdownTime | integer | 120000 | true | countdown time(ms) |
Get Countdown Settings
Get Countdown Settings, only opened for MM.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": [
{
//"status": 1, // Status: 0:Disconnected, 1:effect. Only return status=1
"type": 1,
"symbol": "BTCUSD",
"countdownTime": 120000
},
{
//"status": 0,
"type": 2,
"symbol": "BTCUSD",
"countdownTime": 100000
},
{
//"status": 0,
"type": 3,
"symbol": "TRXUSDT",
"countdownTime": 30000
},
]
}
HTTP Request
GET https://api.coincall.com/open/futures/countdown/cancel/get/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
type | integer | 1 | true | Type of trade, 1:options, 2:futures, 3:spot |
Reset Countdown Settings
Reset Countdown Settings, only opened for MM.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": ["BTCUSD","ETHUSD"] // Symbol which was set successfully
}
HTTP Request
POST https://api.coincall.com/open/futures/countdown/cancel/heartbeat/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD,ETHUSD | true | Contract name |
type | integer | 1 | true | Type of trade, 1:options, 2:futures, 3:spot |
User Account Related
Get User Info(SIGNED)
Get user information
Response:
{
"code":0,
"msg":"Success",
"i18nArgs":null,
"data":{
"name":"xxxx",
"email":"xxxx",
"userId":123456
}
}
HTTP Request
GET https://api.coincall.com/open/user/info/v1
Parameter
Null
Get Account Summary(SIGNED)
Get account summary
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": {
"totalBtcValue": 1450291.99007375, // Balance in BTC
"totalDollarValue": 50014750313.273344637523471200000000, // Balance in USD
"totalUsdtValue": 50000314222.5510097100000000, // Balance in USDT
"accounts": [{
"accountId": null, // Account ID
"coin": "ETH", // Coin name
"coinIconUrl": "https://file.coincall.com/statics/symbol/GETH.png",
"coinDesc": "Ethereum",
"coinView": "ETH",
"equityAmount": "0", // Total assets value in account
"availableBalance": "0", // Available balance
"canWithdrawAmount": "0", // Maximum amount can be withdrawn
"marginMode": 1, // Margin mode (1 SM 2 PM)
"marginBalance": "0", // Margin balance
"unrealizedAmount": "0", // Total unrealized P/L of the account
"imAmount": "0", // Total initial margin of account
"mmAmount": "0", // Total maintenance margin of the account
"delta": null,
"chainType": null,
"btcValue": 0,
"dollarValue": 0,
"usdtValue": 0,
"decimal": 18
}, {
"accountId": 698897965,
"coin": "USDT",
"coinIconUrl": "https://file.coincall.com/statics/symbol/USDT.png",
"coinDesc": "Tether USD",
"coinView": "USDT",
"equityAmount": "49999934983.83391905",
"availableBalance": "49999781762.68412424",
"canWithdrawAmount": "49999781762.68412424",
"marginMode": 1,
"marginBalance": "49999783525.20670462",
"unrealizedAmount": "49154.89968042",
"imAmount": "1762.52258038",
"mmAmount": "3.18161452",
"delta": null,
"chainType": null,
"btcValue": 1450280.99000541,
"dollarValue": 50014370965.0624515791081160,
"usdtValue": 49999934983.83391905,
"decimal": 6
}}]
}
}
HTTP Request
GET https://api.coincall.com/open/account/summary/v1
Parameter
Null
Options Endpoint
Get Option Instruments(SIGNED)
Get all option instruments information.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"baseCurrency": "BTC",
"expirationTimestamp": 1694678400000,
"strike": 22500.0,
"symbolName": "BTCUSD-14SEP23-22500-C",
"isActive": true,
"minQty": 0.01,
"tickSize": 0.1
}, {
"baseCurrency": "BTC",
"expirationTimestamp": 1694678400000,
"strike": 22500.0,
"symbolName": "BTCUSD-14SEP23-22500-P",
"isActive": true,
"minQty": 0.01,
"tickSize": 0.1
}, {
"baseCurrency": "BTC",
"expirationTimestamp": 1694678400000,
"strike": 23000.0,
"symbolName": "BTCUSD-14SEP23-23000-C",
"isActive": true,
"minQty": 0.01,
"tickSize": 0.1
}, {
"baseCurrency": "BTC",
"expirationTimestamp": 1694678400000,
"strike": 23000.0,
"symbolName": "BTCUSD-14SEP23-23000-P",
"isActive": true,
"minQty": 0.01,
"tickSize": 0.1
}]
}
HTTP Request
GET https://api.coincall.com/open/option/getInstruments/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
baseCurrency | string | BTC | true | option base currency |
Get Option Chain(SIGNED)
Get option chain
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": [{
"strike": 22000.00000000,// Strike price
"callOption": {
"optionId": 1584505132356345856,// Option ID
"index": "BTCUSD",// Underlying symbol
"symbol": "BTCUSD-26OCT22-22000-C",// Option symbol name
"baseToken":"BTC",// Base token
"displayName":"BTC-31MAY23-30000-C",// display name
"endTime": 1666771200000,// Time of expiration
"strike": 22000.00000000,// Strike price
"lastPrice": 0,// Last price
"markPrice": 0.0,// Mark price
"volume": 0,// Trade volume
"openInterest": 0,// Open interest
"ask": 0,// Best ask price
"askIv": 0.0,// Best ask IV
"askSize": 0,// Best ask size
"bid": 0,// Best bid price
"bidIv": 0.0,// Best bid IV
"bidSize": 0,// Best bid size
"markIv": 0.0,// Mark price IV
"type": 1,// Option type
"lastPriceIv": 1.7976931348623157E308,// Last price IV
"underlyingPrice": 20278.25,// Price of the underlying
"breakeven": 30000,// Break-even Point
"changeRate": -1.0000,// Price change in percentage
"changePrice": -6.10000000,// Price change in value
"userPosition":0,// User Holdings in position
"delta": 0.0,// greeks delta
"gamma": 0.0,// greeks gamma
"vega": 0.0,// greeks vega
"theta": 0.0,// greeks theta
"rho":0 // greeks rho
},
"putOption": {
"optionId": 1668166500983382054,
"underlying": "BTCUSD",
"symbol": "BTCUSD-15JUN23-26000-P",
"baseToken": "BTC",
"displayName": "BTC-15JUN23-26000-P",
"endTime": 1686816000000,
"strike": 26000.00000000,
"lastPrice": 989.9,
"markPrice": 1138.22770000,
"volume": 8.95000000,
"openInterest": 7.38000000,
"ask": 0,
"askIv": 0.01,
"askSize": 0,
"bid": 658.6,
"bidIv": 0.01,
"bidSize": 10.35,
"markIv": 0.6292,
"type": 2,
"lastPriceIv": 1.0E-4,
"underlyingPrice": 24861.7723,
"breakeven": 24861.77230000,
"changeRate": 0.2271,
"changePrice": 199.53688859,
"userPosition": 0,
"delta": -1.0,
"gamma": 0.0,
"vega": 0.0,
"theta": 0.0,
"rho": -0.02421
}
}]
}
HTTP Request
GET https://api.coincall.com/open/option/get/v1/{index}?endTime={endTime}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
endTime | long | 1666771200000 | true | Expiration time(timestamp) |
index | string | BTCUSD | true | Underlying symbol |
Get Option Details(SIGNED)
Get option details
Response:
{
"code": 0,// Status code
"msg": "Success",
"i18nArgs": null,
"data": {
"optionId": 1584505132293431296,// Option ID
"symbol": "BTCUSD-26OCT22-20000-P",// Option name
"index":"BTCUSD",// Underlying Asset Name
"displayName":"BTC-31MAY23-24000-C",// display name
"endTime": 1666771200000,// Time of expiration
"remainTime": 13565073,// Time remain until expiration
"strike": 20000.00000000,// Strike price
"markPrice": 10.231632230252217,// Mark price
"underlyingPrice":27181.6936,// Underlying price
"volume": 1.00000000,// Trade volume
"volumeUsd": 1.00000000,// Trade value
"openInterest": 0,// Open interest
"lastPrice": 10.231632230252217,// Last price
"premium": 0,// Premium
"changeRate": 2.87,// Price change in percentage
"changePrice":null,// Price change in value
"iv": 0.58,// Implied volatility
"multiplier":0.01,// Contract Multiplier
"type": 2,// Option type
"indexPrice": 20239.96000000,// Index price
"price24hHigh": 0,// Highest price in 24hrs
"price24hLow": 0,// Lowest price in 24hrs
"volumeUsd24h": 0,// USD volume in 24hrs
"price24hOpen": 18215.964000000,// Open price on UTC 00:00:00
"volume24h": 0,// Trade volume in 24hrs
"breakeven":27171.65,// Break-even Point
"delta": -0.10808987585883545,// greeks delta
"gamma": 0.0009475995953294489,// greeks gamma
"vega": 0.7794498985827641,// greeks vega
"theta": 0.0,// greeks theta
"rho": -0.009454405809863273// greeks rho
}
}
HTTP Request
GET https://api.coincall.com/open/option/detail/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD-24MAY22-48000-P | true | option symbol name |
Get OrderBook(SIGNED)
Get option order book for 100 depth
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": {
"optionName": "BTCUSD-26OCT22-15000-C",// Option name
"displayName": null,
"strike": 15000,// Strike price
"bids": [{
"size": "0.5",// Size
"price": "5251"// Price
}],
"asks": [{
"size": "1",// Size
"price": "8888"// Price
}]
}
}
HTTP Request
GET https://api.coincall.com/open/option/order/orderbook/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD-26OCT22-15000-C | true | Option Name |
Get Last Trade(SIGNED)
Get option last trade
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": [
{
"symbol": "BTCUSD-26OCT22-20000-P",// Option symbol name
"displayName":"BTC-26OCT22-20000-P",// Option display name
"price": "10.3",// Trade price
"qty": "1",// Trade Quantity
"time": 1666757622819,// Trade time
"tradeSide": 2// Trade side
}
]
}
HTTP Request
GET https://api.coincall.com/open/option/trade/lasttrade/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD-6JUN23-24000-C | true | Option Name |
Get Positions(SIGNED)
Get All option positions
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": [{
"id": 1584736851047620608,// ID
"positionId": 1584736851047620609,// Position ID
"updateTime": 1666665682934,// Update time
"orderId": 1584736036348895232,// Order ID
"userId": 1536933707941347382,// User ID
"value": 11294.2000000000000000,// Position Value
"qty": 1.00000000,// Position Quantity
"initMargin": 0,// Initial Margin
"maintMargin": 0,// Maintnance Margin
"avgPrice": 11294.20000000,// Average Price
"markPrice": 12260.310000000001,// Mark price
"upnl": 966.11000000000100000000,// unRealized PnL
"roi": 8.55403659,// Return on investment
"rspl": 0E-8, // Realized PnL
"symbol": "BTCUSD-25NOV22-8000-C",// Option symbol name
"displayName": "BTC-25NOV22-8000-C",// Display name
"tradeSide": 1,// Trade Side 1 BUY 2 SELL
"lockQty": 0,// Lock Quantity
"indexPrice": 12.22, // Index price
"delta": 1.0,// greeks delta
"gamma": 0.0,// greeks gamma
"vega": 0.0,// greeks vega
"theta": 0.0,// greeks theta
"rho": 6.610892947742262,// greeks rho
"baseToken": "BTC",// Base token
"quoteToken": "USD" // Quote token
}]
}
HTTP Request
GET https://api.coincall.com/open/option/position/get/v1
Parameter
Null
Place Order(SIGNED)
Place an option order
Response:
{
"code":0,
"msg":"Success",
"i18nArgs":null,
"data":1663820914095300608 // Order id
}
HTTP Request
POST https://api.coincall.com/open/option/order/create/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
clientOrderId | long | 123123123 | false | client order id |
tradeSide | number | 1 | true | Trade Side, 1 BUY 2 SELL |
tradeType | number | 1 | true | Trade Type, 1 LIMIT 3 POST_ONLY |
symbol | string | BTCUSD-26OCT22-15000-C | true | Option name |
qty | number | 0.5 | true | Quantity |
price | number | 19000.01 | false | Price, required for limit orders |
stp | integer | 1 | false | Value: [1,2,3] |
Value | Name | Note |
---|---|---|
1 | CM | Cancel Maker |
2 | CT | Cancel Taker |
3 | CB | Cancel Both |
Amend Order(SIGNED)
Modify unfilled or partially filled orders
Request:
curl -X POST
-H "sign:3260D3D58F2982B9E3982D2BD51B0CF18E153B6F35686DE30ACA1A267925C832"
-H "X-REQ-TS-DIFF:3000"
-H "x-cc-apikey:mtQ/qQcbFnccSV061nGvWC1Ni9lXf4sBw36NAaDsKMs="
-H "ts:1730337237761"
-H "Content-Type:application/json; charset=utf-8"
-H "Content-Length:79"
-H "Host:api.coincall.com"
-H "Connection:Keep-Alive"
-d '{"symbol":"BTCUSD-8NOV24-40000-P","orderId":"1851808894377136128","price":10,"qty":1.5}
' "https://api.coincall.com/open/option/order/modify/v1"
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": 1851808894377136128 // order id
}
HTTP Request
POST https://api.coincall.com/open/option/order/modify/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
clientOrderId | long | 123123123 | false | client order id. Either orderId or clientOrderId is required |
orderId | number | 1663820914095300000 | false | order id. Either orderId or clientOrderId is required |
symbol | string | BTCUSD-26OCT22-15000-C | true | Option symbol |
qty | number | 0.5 | false | Order quantity after modification. Do not pass it if not modify the qty |
price | number | 19000.01 | false | Order price after modification. Do not pass it if not modify the price |
Notice:
- The ack of amend order request indicates that the request is successfully accepted. Please use websocket order stream to confirm the order status
- You can only modify unfilled or partially filled orders.
- Do not support modify the
clientOrderId
. - When the
qty
orprice
of a new order does not match order validation requirements, the modification will be rejected, and the original order will remain unchanged. - If the original order is partially filled and the new order quantity is less than or equal to the executed quantity, the original order will be fully filled.
Cancel Order(SIGNED)
Cancel an option order
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data":"success"
}
HTTP Request
POST https://api.coincall.com/open/option/order/cancel/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | number | 1663820914095300608 | false | order id |
clientOrderId | number | 123123123 | false | client order id |
Notice:
orderId and clientOrderId, one of the two parameters must be entered.
Cancel Orders(SIGNED)
Cancel option orders by index
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": null
}
Batch Cancel Order(SIGNED)
Cancel batch Orders by ids
Request:
curl -X POST
-H "sign:3260D3D58F2982B9E3982D2BD51B0CF18E153B6F35686DE30ACA1A267925C832"
-H "X-REQ-TS-DIFF:12"
-H "x-cc-apikey:mtQ/qQcbFnccSV061nGvWC1Ni9lXf4sBw36NAaDsKMs="
-H "ts:1730337237761"
-H "Content-Type:application/json; charset=utf-8"
-H "Content-Length:79"
-H "Host:api.coincall.com"
-H "Connection:Keep-Alive"
-d '{"clientOrderIdList":[2215534552962207610],"orderIdList":[2215534552962207611]}' "https://api.coincall.com/open/option/order/batchCancel/v1"
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"clOrdId": 2215534552962207610, // client order id
"ordId": 2215534552962207611, // order id
"ts": 1730337238487,
"scode": 0, // 0 success, 1 failed
"smsg": null
}]
}
HTTP Request
POST https://api.coincall.com/open/option/order/batchCancel/v1
Parameter
Name | Type | Required | Note |
---|---|---|---|
orderIdList | list | false | orderId list |
clientOrderIdList | list | false | clientOrderId list |
Notice:
- Either
orderIdList
orclientOrderIdList
is required. If both are provided, priority will be given to theorderIdList
. - You can cancel unfilled or partially filled orders.
- The ack of cancel order request indicates that the request is successfully accepted. Please use websocket order stream to confirm the order status
HTTP Request
GET https://api.coincall.com/open/option/order/cancelOpenOrders/{version}/{index}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
version | string | v1 | true | version, only v1 for now |
index | string | BTCUSD | true | coin index symbol name |
Cancel Orders by symbol(SIGNED)
Cancel option orders by symbol
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": null
}
HTTP Request
GET https://api.coincall.com/open/option/order/batchCancelByOption/v1/{symbol}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | KASUSD-31MAY24-0.1250-C | true | Options symbol name |
Get Open Orders(SIGNED)
Get option open orders
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": {
"list":[
{
"id": 1665910350698258432,// ID
"orderId": 1665910350698258432,// Order ID
"clientOrderId": 123123123,// Client order id
"symbol": "BTCUSD-6JUN23-24000-C",// Option symbol name
"displayName":"BTC-6JUN23-24000-C",// Option display name
"qty": 0.5,// Order Quantity
"remainQty":0.5,// Unfilled Quantity
"fillQty": 0,// Filled Quantity
"price": 2095.6,// Price
"avgPrice": null,// Average price
"initMargin": 1047.8,// Initial Margin
"tradeSide": 1,// Trade side
"tradeType": 1,// Trade type
"createTime": 1666667584739,// Time of the order created
"reduceOnly": 0, // Reduce only
"indexPrice": 25782.815 // Index Price
}
],
"pageTotal":1,// Total Page Count
"total":1 // Total Data Count
}
}
HTTP Request
GET https://api.coincall.com/open/option/order/pending/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
page | number | 1 | false | Page number, default is 1 |
pageSize | number | 20 | false | Number of items per page, default is 20, maximum value is 500 |
currency | string | BTC | false | Filter data for a specific currency |
Get Order Info(SIGNED)
Get an order information by orderId or clientOrderId
Response:
{
"code": 0, // Status code
"msg": "success", //Message
"i18nArgs": null,
"data":{
{
"orderId": 1665910350698258432,// Order ID
"clientOrderId": 123123123,// Client order id
"symbol": "BTCUSD-6JUN23-24000-C",// Option symbol name
"displayName":"BTC-6JUN23-24000-C",// Option display name
"qty": 0.5,// Order Quantity
"remainQty":0.5,// Unfilled Quantity
"fillQty": 0,// Filled Quantity
"price": 2095.6,// Price
"avgPrice": null,// Average price
"tradeSide": 1,// Trade side
"tradeType": 1,// Trade type
"createTime": 1666667584739,// Time of the order created
"reduceOnly": 0, // Reduce only
"fee": 0, // transaction fee(accumulated)
"updateTime": 1685326195118,
"state": 0 // order status
}
}
}
HTTP Request
GET https://api.coincall.com/open/option/order/singleQuery/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | number | 111 | false | query string |
clientOrderId | number | 123123123 | false | client order id |
Notice:
orderId and clientOrderId, one of the two parameters must be entered.
Get Order Details(SIGNED)
Get Option Order History
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs":null,
"data":{
"list":[
{
"orderId": 1665650442392174592, // Order ID
"clientOrderId": 1665650442392174592,// Client order id
"symbol": "BTCUSD-25NOV22-8000-C", // Option symbol name
"displayName": "BTC-25NOV22-8000-C", // Display name
"qty": 1.00000000, // Order Quantity
"fillQty": 1.00000000, // Filled Quantity
"price": 0.49110000, // Order Price
"avgPrice": 0.49110000, // Average price
"fee":0.22, // fee
"rpnl":0.22, // Realized PnL
"tradeSide": 1, // Trade side
"tradeType": 1, // Trade type
"createTime": 1666667584739,// Time of the order created
"state": 1, // Order status
"reduceOnly": 0 // Reduce only
}
],
"hasNext": false, // Whether there is a next page
"hasPre": false // Whether there is a previous page
}
}
HTTP Request
GET https://api.coincall.com/open/option/order/history/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
pageSize | number | 20 | true | Number of items per page, default is 20, maximum value is 500 |
fromId | number | 123123123 | false | Minimum orderId, can be obtained from the result field of the previous page when paging |
startTime | number | 1686308840388 | false | Start time of the history, default is the current time pushed forward by 24 hours |
endTime | number | 1686308840388 | false | End time of the history |
Get Transaction Details(SIGNED)
Get option transaction history
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": {
"list": [
{
"id": 1584745240079241216,// ID
"optionId": null,// Option ID
"symbol":"BTCUSD-2JUN23-18000-C",// Option symbol name
"displayName":"BTC-2JUN23-18000-C",// Option display name
"tradeSide": 1,// Trade side
"tradeType": 1,// Trade type
"price": 951.00000000,// Price
"qty": 2.00000000,// Quantity
"iv": 0.5606,// Implied Volatility
"markPrice": 1419.5139928388217,// Mark price
"indexPrice": 20247.0,// Index price
"orderId": 1584744827800133632,// Order ID
"tradeId": 1584745239911469056,// Trade ID
"fee": 0.00190200,// Fees
"time": 1666667683034,// Transaction time
"reduceOnly":0, // Reduce only
"isTaker":0 // Filled by taker side
}
],
"hasNext": true, // Whether there is a next page
"hasPre": false // Whether there is a previous page
}
}
HTTP Request
GET https://api.coincall.com/open/option/trade/history/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
pageSize | number | 20 | false | Number of items per page, default is 20, maximum value is 500 |
fromId | number | 123123123 | false | Minimum tradeId, can be obtained from the result field of the previous page when paging |
startTime | number | 1686308840388 | false | Start time of the history |
endTime | number | 1686308840388 | false | End time of the history |
Get Exercise Details(SIGNED)
Get option exercise history
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": {
"list": [
{
"symbol": "ETHUSD-13SEP24-2200-C",
"time": 1726248852785,
"qty": 2.00000000,
"tradeSide": 2,
"strike": 2200.00000000,
"exercisePrice": 2409.38569142,
"openCashFlow": 367.60000000,
"settlementCashFlow": -418.77138284,
"netCashFlow": -51.17138284,
"fees": 0.72317826
}
],
"hasNext": true,
"hasPrev": false
}
}
HTTP Request
GET https://api.coincall.com/open/settle/exercise/history/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD-24MAY22-48000-P | false | options symbol name |
startTime | number | 1686308840388 | false | Start time of the history |
endTime | number | 1686308840388 | false | End time of the history |
pageSize | number | 20 | false | Number of items per page, default is 20, maximum value is 50 |
page | number | 1 | false | default is 1 |
RFQ
Board list(SIGNED)
Get board list
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": {
"requestList": [
{
"legList": [ // per request list
{
"type": 1, // trade type, 1 options, 2 futures, 3 spot
"tradeSide": 1, // trade side, 1 buy, 2 sell
"symbol": "BTCUSD-11OCT24-65000-C",
"amount": 0.5 // trade size
}
],
"requestId": 1840600952218980352, // this request ID
"expireTime": 1727670238401
},
{
"legList": [
{
"type": 1,
"tradeSide": 1,
"symbol": "BTCUSD-13SEP24-56000-C",
"amount": 0.1
},
{
"type": 1,
"tradeSide": 1,
"symbol": "BTCUSD-20SEP24-56000-P",
"amount": 0.1
}
],
"requestId": 1831961206433386496,
"expireTime": 1725610362477
}
],
"currentPage": 1,
"pageTotal": 1,
"total": 2
}
}
HTTP Request
GET https://api.coincall.com/open/option/blockTrade/seek/list/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
currentPage | integer | 1 | true | No default. |
pageSize | integer | 10 | true | No default, max size is 1500 |
Create quote(SIGNED)
Creates quote for RFQ
Response:
{
"code": 0,
"msg": null,
"i18nArgs": null,
"data": 1840685647012708354 // Quote ID
}
HTTP Request
POST https://api.coincall.com/open/option/blockTrade/quote/create/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
requestId | integer | 1840685647012708354 | true | request RFQ ID. |
orderOpenApiDetailReqs | string | true | Json Map | |
-> price | string | 10.1 | true | quote price |
-> symbol | string | BTCUSD-13SEP24-56000-C | true | quote symbol |
-> type | string | 1 | true | 1 Options, 2 Futures, 3 Spot |
Parameter Example
body = { {'orderOpenApiDetailReqs': '[{"price":"2000","symbol":"BTCUSD-11OCT24-65000-C","type":"1"},{"price":"1000","symbol":"BTCUSD-11OCT24-60000-C","type":"1"}]', 'requestId': 1840600952218980352} }
Cancel quote(SIGNED)
Cancel quote for RFQ
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": 1840685647012708354
}
HTTP Request
GET https://api.coincall.com/open/option/blockTrade/quote/cancel/v1/{quoteId}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
quoteId | integer | 1840685647012708354 | true | Quote ID |
Futures Endpoint
Get instruments
Get futures instruments
Response:
{
"code":0,
"msg":"Success",
"i18nArgs":null,
"data":[
{
"ticker_id":"BTC-USD", // symbol id
"base_currency":"BTC",
"quote_currency":"USD",
"last_price":"42782.00000000",
"base_volume":"2485.862", // 24 hour trading volume in BASE currency
"usd_volume":"106351139.55450000", // 24 hour trading volume in USD
"quote_volume":"106351139.55450000", // 24 hour trading volume in QUOTE currency
"bid":"42777.9", // Current highest bid price
"ask":"42779.6", // Current lowest ask price
"high":"43849.6", // Rolling 24-hour highest transaction price
"low":"42549.2", // Rolling 24-hour lowest transaction price
"product_type":"Perpetual",
"open_interest":"9.35800000",
"open_interest_usd":"400346.61622638",
"index_price":"42751.48738636", // Last calculated index price for underlying of contract
"funding_rate":"0.00016736", // Current funding rate
"next_funding_rate":"0.00016736", // Upcoming predicted funding rate
"next_funding_rate_timestamp":1703606400000, // Timestamp of the next funding rate change
"contract_type":"Vanilla",
"contract_price":"42782.00000000",
"contract_price_currency":"USD"
},
{...}]
}
HTTP Request
GET https://api.coincall.com/open/futures/market/instruments/v1
Parameter
Null
Get OrderBook
Get futures order book
Response:
{
"code":0,
"msg":"Success",
"i18nArgs":null,
"data":{
"symbol":"BTC-USD", // symbol id
"bids":[ // // Bid, buyer. Sort by price desc
[
"42759.1", // price
"0.568" // size
]
],
"asks":[ // Ask, seller. Order by price asc
[
"42761.2",
"2.94"
]
],
"timestamp":1703579842559 // // The timestamp (ms) that the system generates the data
}
}
HTTP Request
GET https://api.coincall.com/open/futures/market/orderbook
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTC-USD | true | Symbol name |
depth | Integer | 1 | false | Limit size for each bid and ask, [ 1, 10, 20, 50, 100] Default: 1. |
Get Symbol Information(SIGNED)
Get futures symbol
Response:
{
"code": 0,// Status code
"msg": "success",// Message
"i18nArgs": null,
"data": [{
"contractId": 1,// Contract ID
"symbol": "BTCUSD",// Symbol
"symbolName":"BTC/USD",// Symbol name
"displayName":"BTC-PERP",// Symbol display name
"baseToken":"BTC",// Base Token
"quoteToken":"USD",// Quote Token
"price": 25614.7,// Price
"changeRate": -0.003,// Price change in percentage
"changePrice":-78.2,// Price change in value
"markPrice": 25661.25861712,// Mark price
"indexPrice": 25754.025,// Index Price
"price24hHigh": 27065.7,// Highest price in 24hrs
"price24hLow": 18000,// Lowest price in 24hrs
"volumeUsd24h": 3846213875.0958,// USD volume in 24hrs
"volume24h": 147370.135,// Volume in 24hrs
"ts": 20201116024818,// Timestamp
"price24hOpen":25692.9,// Open price on UTC 00:00:00
"hasOption":true,// Whether there are options
"sortIdx":null // Sort Field
}]
}
HTTP Request
GET https://api.coincall.com/open/futures/market/symbol/v1
Parameter
Null
Get OrderBook(SIGNED)
Get futures order book for 100 depth
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": {
"symbol": "BTCUSD",// Symbol
"bids": [{
"size": "0.001",// Size
"price": "18801"// Price
}],
"asks": [{
"size": "0.992",// Size
"price": "18898"// Price
}]
}
}
HTTP Request
GET https://api.coincall.com/open/futures/order/orderbook/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Symbol name |
Kline(SIGNED)
Query for historical klines (also known as candles/candlesticks)
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"open": 27437.30000000, // Open price
"close": 27435.10000000, // Close price
"low": 27435.10000000, // Lowest price
"high": 27437.30000000, // Highest price
"volume": 14.24300000, // Trade volume
"time": 1693526400000, // Start time of this line (ms)
"period": "D1" // period
},
{
"open": 27435.10000000,
"close": 27434.90000000,
"low": 27434.90000000,
"high": 27435.10000000,
"volume": 0.00300000,
"time": 1693612800000,
"period": "D1"
}
]
}
HTTP Request
GET https://api.coincall.com/open/futures/market/kline/history/v2/{symbol}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Symbol name |
period | string | D1 | true | granularity of K-line |
start | integer | 1697760509000 | true | Start time(ms) |
end | integer | 1697771549000 | true | End time(ms) |
limit | integer | 1 | true | Please make sure limit=1. |
Get Last Trade(SIGNED)
Get futures last trade
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": [{
"symbol": "BTCUSD",// Symbol
"price": "18898",// Price
"qty": "0.001",// Quantity
"time": 1666754916559,// Time of the transaction
"tradeSide": 1 // Trade side
}]
}
HTTP Request
GET https://api.coincall.com/open/futures/trade/lasttrade/v1/{}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Symbol name |
Get leverage(SIGNED)
Get current futrues leverage
Response:
{
"code": 0,// Status code
"msg": "success",
"i18nArgs": null,
"data": {
"userId": 123,// User ID
"symbol": "BTCUSD",// Symbol
"currentLeverage": 5 // Current leverage
}
}
HTTP Request
GET https://api.coincall.com/open/futures/leverage/current/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Symbol name |
Set Leverage(SIGNED)
Set futures leverage
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": null
}
HTTP Request
POST https://api.coincall.com/open/futures/leverage/set/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | true | Symbol name |
leverage | number | 10 | true | leverage for this symbol |
Get Positions(SIGNED)
Get futures positions
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": [
{
"id": 1584467417583730700,// ID
"positionId": 1584467417583730700,// Position ID
"updateTime": 1666602220413,// Update time
"userId": 1536933707941347300,// User ID
"value": 176.7825,// Value of Position
"qty": 0.009,// Quantity
"initMargin": 35.3565,// Initial margin
"maintMargin": 1.767825,// Maintnance margin
"avgPrice": 19642.5,// Average price
"markPrice": 18900.38311437,// Mark price
"elp": null,// Estimated liquidation price
"roi": -0.03778118,// ROI
"upnl": -6.67905197067,// Unrealized Pnl
"symbol": "BTCUSD",//symbol
"displayName": "BTC-PERP",// Display name
"tradeSide": 1,// Trade side
"leverage": 5,// Leverage
"delta": 0.009,// Position delta
"baseToken": "BTC", // Base token
"quoteToken": "USD" // Quote token
}]
}
HTTP Request
GET https://api.coincall.com/open/futures/position/get/v1
Parameter
Null
Place Order(SIGNED)
Place a futures order
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": 1673571411341475840 // Order id
}
HTTP Request
POST https://api.coincall.com/open/futures/order/create/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
clientOrderId | long | 123123123 | false | client order id |
symbol | string | BTCUSD | true | Futures Symbol |
price | number | 19000.01 | false | Price, required for limit orders |
qty | number | 0.5 | true | Quantity |
tradeSide | number | 1 | true | Trade Side, 1 BUY 2 SELL |
tradeType | number | 1 | true | Trade Type, 1 LIMIT 2 MARKET 3 POST_ONLY |
timeInForce | string | GTC | false | IOC, FOK. default: GTC |
reduceOnly | number | 1 | false | Reduce the position quantity only, 1 reduce only true, 0 reduce only false |
Time in force (timeInForce):
Name | Note |
---|---|
GTC | Good Till Cancel |
IOC | Immediate or Cancel |
FOK | Fill or Kill |
Cancel Order(SIGNED)
Cancel a futures order
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": null
}
HTTP Request
POST https://api.coincall.com/open/futures/order/cancel/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | number | 111 | true | query string |
clientOrderId | number | 123123123 | false | client order id |
Notice:
orderId and clientOrderId, one of the two parameters must be entered.
Cancel Orders(SIGNED)
Cancel futures orders by symbol
Response:
{
"code": 0,// Status code
"msg": "Success",// Message
"i18nArgs": null,
"data": null
}
HTTP Request
GET https://api.coincall.com/open/futures/order/cancelOpenOrders/{version}/{symbol}
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
version | string | v1 | true | version, only v1 for now |
symbol | string | BTCUSD | true | Futures symbol name |
Batch Cancel Order(SIGNED)
Cancel batch Orders by ids
Request:
curl -X POST
-H "sign:3260D3D58F2982B9E3982D2BD51B0CF18E153B6F35686DE30ACA1A267925C832"
-H "X-REQ-TS-DIFF:12"
-H "x-cc-apikey:mtQ/qQcbFnccSV061nGvWC1Ni9lXf4sBw36NAaDsKMs="
-H "ts:1730337237761"
-H "Content-Type:application/json; charset=utf-8"
-H "Content-Length:79"
-H "Host:api.coincall.com"
-H "Connection:Keep-Alive"
-d '{"clientOrderIdList":[2215534552962207610],"orderIdList":[2215534552962207611]}' "https://api.coincall.com/open/futures/order/batchCancel/v1"
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"clOrdId": 2215534552962207610, // client order id
"ordId": 2215534552962207611, // order id
"ts": 1730337238487,
"scode": 0, // 0 success, 1 failed
"smsg": null
}]
}
HTTP Request
POST https://api.coincall.com/open/futures/order/batchCancel/v1
Parameter
Name | Type | Required | Note |
---|---|---|---|
orderIdList | list | false | orderId list |
clientOrderIdList | list | false | clientOrderId list |
Notice:
- Either
orderIdList
orclientOrderIdList
is required. If both are provided, priority will be given to theorderIdList
. - You can cancel unfilled or partially filled orders.
- The ack of cancel order request indicates that the request is successfully accepted. Please use websocket order stream to confirm the order status
Get Open Orders(SIGNED)
Get open orders
Response:
{
"code": 0, // Status code
"msg": "success", //Message
"i18nArgs": null,
"data":{
"list":[
{
"id": 1663004711982333952,// ID
"clientOrderId":1000200000, // Client order id
"orderId": 1663004711982333952, // Order id
"symbol": "BTCUSD",// Futures symbol name
"displayName": "BTC-PERP", // Futures display name
"qty": 1.00000000, // Order Quantity
"remainQty": 1.00000000, // Unfilled Quantity
"fillQty": 0E-8, // Filled Quantity
"price": 500.00000000, // Price
"avgPrice": 0E-8, // Average price
"initMargin": 166.66666667, // Initial Margin
"tradeSide": 1, // Trade side
"tradeType": 1, // Trade type
"createTime": 1685326195118,// Time of the order created
"reduceOnly": 0, //Reduce only
"leverage": 3, // Leverage
"expression": null, // Conditional Expression (GE -- Greater than or equal to, LE -- Less than or equal to)
"triggerPrice": null, // Trigger Price
"timeInForce": "IOC"
}
],
"pageTotal":1,// Total Page Count
"total":1 // Total Data Count
}
}
HTTP Request
GET https://api.coincall.com/open/futures/order/pending/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
page | number | 1 | false | Page number, default is 1 |
pageSize | number | 20 | false | Number of items per page, default is 20 |
symbol | string | BTCUSD | false | Filter data for a specific symbol |
Get Order Info(SIGNED)
Get an order information by orderId or clientOrderId
Response:
{
"code": 0, // Status code
"msg": "success", //Message
"i18nArgs": null,
"data":{
{
"clientOrderId":1000200000, // Client order id
"orderId": 1663004711982333952, // Order id
"symbol": "BTCUSD",// Futures symbol name
"displayName": "BTC-PERP", // Futures display name
"qty": 1.00000000, // Order Quantity
"remainQty": 1.00000000, // Unfilled Quantity
"fillQty": 0E-8, // Filled Quantity
"price": 500.00000000, // Price
"avgPrice": 0E-8, // Average price
"tradeSide": 1, // Trade side
"tradeType": 1, // Trade type
"createTime": 1685326195118,// Time of the order created
"reduceOnly": 0, //Reduce only
"leverage": 3, // Leverage
"fee": 0, // transaction fee(accumulated)
"updateTime": 1685326195118,
"state": 0, // order status
"timeInForce": "IOC"
}
}
}
HTTP Request
GET https://api.coincall.com/open/futures/order/singleQuery/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | number | 111 | false | query string |
clientOrderId | number | 123123123 | false | client order id |
Notice:
orderId and clientOrderId, one of the two parameters must be entered.
Get Order Details(SIGNED)
Get futures order history
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": {
"list": [{
"clientOrderId":1000200000, // Client order id
"orderId": 1665650442392174592, // Order id
"symbol": "XRPUSD",// Futures symbol name
"displayName": "XRP-PERP",// Futures display name
"qty": 1.00000000, // Order Quantity
"fillQty": 1.00000000, // Filled Quantity
"price": 0.49110000, // Price
"avgPrice": 0.49110000, // Average price
"fee": 0.00039288, // Order transaction fee
"rpnl": 0E-8, // Realized Pnl
"tradeSide": 2, // Trade side
"tradeType": 1, // Trade type
"createTime": 1685956986404,// Time of the order created
"state": 1, //Order Status
"reduceOnly": 0, // Reduce only
"leverage": 3, //Lleverage
"expression": null, // Conditional Expression (GE -- Greater than or equal to, LE -- Less than or equal to)
"triggerPrice": null // Trigger Price
}],
"hasNext": false, // Whether there is a next page
"hasPre": false // Whether there is a previous page
}
}
HTTP Request
GET https://api.coincall.com/open/futures/order/history/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
pageSize | number | 10 | true | Number of items per page |
fromId | number | 123123123 | false | Minimum orderId, can be obtained from the result field of the previous page when paging |
startTime | number | 1686308840388 | false | Start time of the history, default is the current time pushed forward by 24 hours |
endTime | number | 1686308840388 | false | End time of the history |
Get Transaction details(SIGNED)
Get futrues transaction history
Response:
{
"code": 0,// Status code
"msg": "success",//Message
"i18nArgs": null,
"data": {
"list": [{
"id": 1574775822713806849,// ID
"contractId": null,// Contract ID
"symbol": "ETHUSD",// Symbol
"displayName": "ETH-PERP",// Display name
"tradeSide": 1,// Trade side
"tradeType": 1,// Trade type
"price": 1389.00000000,// Price
"qty": 1.00000000,// Quantity
"markPrice": null,// Mark price
"indexPrice": 1389.26000000,// Index Price
"orderId": 1574775820017352705,// Order ID
"tradeId": 1574775820805869568,// Trade ID
"fee": 0.13890000,// Fees
"time": 1664290788701,// Time of the transaction
"leverage": 5, // Leverage
"isTaker": 1 // Filled by taker side, 1 Taker 0 FALSE
}],
"hasNext": true, // Whether there is a next page
"hasPre": false // Whether there is a previous page
}
}
HTTP Request
GET https://api.coincall.com/open/futures/trade/history/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
pageSize | number | 10 | false | Quantity per page |
fromId | number | 123123123 | false | Minimum orderId, can be obtained from the result field of the previous page when paging |
startTime | number | 1686308840388 | false | Start time of the history |
endTime | number | 1686308840388 | false | End time of the history |
Get Funding Rate Details(SIGNED)
Get Funding Rate History
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": {
"list": [
{
"id": 379372,
"symbol": "TONUSD",
"displayName": "TONUSDT Perp",
"tradeSide": 1,
"qty": 2.00000000,
"fundFee": -0.00114441,
"fundRate": 0.00010000,
"ctime": 1730160005432
},
{
"id": 379361,
"symbol": "TRXUSD",
"displayName": "TRXUSDT Perp",
"tradeSide": 2,
"qty": 2.00000000,
"fundFee": 0.00002432,
"fundRate": 0.00010000,
"ctime": 1730160004652
},
{
"id": 379270,
"symbol": "TONUSD",
"displayName": "TONUSDT Perp",
"tradeSide": 1,
"qty": 2.00000000,
"fundFee": -0.00114441,
"fundRate": 0.00010000,
"ctime": 1730131205546
},
{
"id": 379259,
"symbol": "TRXUSD",
"displayName": "TRXUSDT Perp",
"tradeSide": 2,
"qty": 2.00000000,
"fundFee": 0.00002432,
"fundRate": 0.00010000,
"ctime": 1730131204634
}
],
"pageTotal": 1,
"total": 4
}
}
HTTP Request
GET https://api.coincall.com/open/settle/future/record/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | BTCUSD | false | futures symbol name |
startTime | number | 1686308840388 | false | Start time of the history |
endTime | number | 1686308840388 | false | End time of the history |
pageSize | number | 20 | false | Number of items per page, default is 20, maximum value is 50 |
page | number | 1 | false | default is 1 |
Spot Endpoint
Get Instruments(SIGNED)
Query for the instrument specification of online trading pairs.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": {
"symbol": "TRXUSDT", // Symbol name
"baseCoin": "TRX", // Base coin
"quoteCoin": "USDT", // Quote coin
"enableTrading": 1, // Enable trade, 1 TRUE 0 FALSE
"lotSizeFilter": {
"basePrecision": "0", // The precision of base coin
"quotePrecision": "2", // The precision of quote coin
"maxOrderSize": 10, // Maximum order size
"minQty": "1", // Minimum order quantity
"maxQty": "10000000", // Maximum order quantity
"maxMarketQty": "5000000" // Maximum market order quantity
},
"priceFilter": {
"tickSize": "0.00001" // The step to increase/reduce order price
}
}
}
HTTP Request
GET https://api.coincall.com/open/spot/market/instruments
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | false | Symbol name |
limit | integer | 1 | false | Limit for data size per page. [1, 1000]. Default: 500 |
Kline(SIGNED)
Query for historical klines (also known as candles/candlesticks)
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": [{
"endTime": 1697087280000, // Close Time
"open": 0.4684, // Open price
"close": 0.0, // Close price
"low": 0.4684, // Lowest price
"high": 0.4684, // Highest price
"volume": 0.0, // Trade volume
"volumeUsd": 0.0 // Trade volume in USD
}]
}
HTTP Request
GET https://api.coincall.com/open/spot/market/klines
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | true | Symbol name |
interval | string | 1min | true | Kline interval. |
start | integer | 1698202825192 | false | The start timestamp (ms) |
end | integer | 1698202825192 | false | The end timestamp (ms) |
limit | integer | 1 | false | Limit for data size per page. [1, 1000]. Default: 200 |
Get Orderbook(SIGNED)
Query for orderbook depth data.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": {
"s": "XRPUSDT", // Symbol name
"b": [ // Bid, buyer. Sort by price desc
[0.5459, 22.0] // price, size
],
"a": [ // Ask, seller. Order by price asc
[0.5479, 132.0]
],
"ts": 1698202825192, // The timestamp (ms) that the system generates the data
"u": 7144136 // Update ID, is always in sequence
}
}
HTTP Request
GET https://api.coincall.com/open/spot/market/orderbook
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | true | Symbol name |
depth | integer | 1 | false | Limit size for each bid and ask, [ 1, 10, 20, 50, 100,200] Default: 1. |
Get Public Trading History(SIGNED)
Query recent public trading data.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": [{
"tradeId": "714412239621107665563948", // trade ID
"symbol": "XRPUSDT", // Symbol name
"price": 0.5479, // Trade price
"qty": 1.0, // Trade quantity
"side": 1, // Side of taker `Buy` 1, `Sell` 2
"ts": 1698148006763 // Trade time (ms)
}]
}
HTTP Request
GET https://api.coincall.com/open/spot/market/histories
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | true | Symbol name |
limit | integer | 1 | false | Limit for data size per page.spot: [ 1, 100], default: 1 |
Get Tickers 24hr(SIGNED)
Query for the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.
Response:
{
"code": 0,
"msg": "success",
"i18nArgs": null,
"data": {
"s": "XRPUSDT", // Symbol name
"base": "XRP", // Base coin
"quote": "USDT", // Quote coin
"o": 0.53, // Open price
"h": 0.5605, // The highest price in the last 24 hours
"l": 0.53, // The lowest price in the last 24 hours
"c": 0.5479, // Close price
"a": 82023.0, // Volume in base coin for 24h
"v": 44828.4405, // Volume for 24h
"i": 0.55363524, // indexprice
"cp": 0.017900000000000027, // Price change in value
"r": 0.033773584905660424, // Price change in percentage
"hasOption": false // Whether there are options
}
}
HTTP Request
GET https://api.coincall.com/open/spot/market/overviewV2
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | false | Symbol name |
Place Order(SIGNED)
Create a new order.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": 42953967928017000 // Order ID
}
HTTP Request
POST https://api.coincall.com/open/spot/trade/order/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | true | Symbol name |
clientOrderId | string | abc123 | false | Client order id |
tradeSide | string | 1 | true | 1 BUY 2 SELL |
tradeType | string | 1 | true | 1 LIMIT,2 MARKET,3 POST_ONLY |
qty | string | 1 | false | Order quantity. |
price | string | 0.53 | false | Order price. |
Type | Additional mandatory parameters |
---|---|
LIMIT, POST_ONLY | qty, price |
MARKET | qty |
Cancel Order(SIGNED)
Cancel an open order.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": true
}
HTTP Request
POST https://api.coincall.com/open/spot/trade/cancel/v1
Rate Limit: 60/s
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | string | 1321003749386327552 | false | Order ID. Either orderId or clientOrderId is required |
clientOrderId | string | abc123 | false | User customized order ID. Either orderId or clientOrderId is required |
Cancel Orders(SIGNED)
Cancels all active orders on one symbol.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": true
}
HTTP Request
POST https://api.coincall.com/open/spot/trade/cancelAll/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | true | Symbol name |
Query Order(SIGNED)
Check an order's status.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": {
"id": 320295,
"clientOrderId": "42953967928017000", // User customised order ID
"orderId": 42953967928017000, // Order ID
"userId": 8098448373, // User ID
"symbol": "XRPUSDT", // Symbol name
"displaySymbol": "XRP/USDT", // Symbol Display name
"price": "0.566", // Order price
"avgPrice": "0.5479", // Average trade price
"qty": "1", // Order quantity
"fillQty": "1", // Trade quantity
"remainQty": "0", // Remain quantity
"status": 1, // Order status
"tradeSide": 1, // Trade side
"tradeType": 2, // Trade Type
"fee": "0.0001", // Transaction fee(accumulated)
"feeCurrency": "XRP", // Fee charged in
"ts": 1698208992286, // Order created timestamp (ms)
"updateTime": 1698208992345 // Order updated timestamp (ms)
}
}
HTTP Request
GET https://api.coincall.com/open/spot/trade/order/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
orderId | string | 1321003749386327552 | false | Order ID. Either orderId or clientOrderId is required |
clientOrderId | string | abc123 | false | User customized order ID. Either orderId or clientOrderId is required |
Query Open Orders(SIGNED)
Get all open orders.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"id": 320307,
"clientOrderId": "42953967928017012", // User customised order ID
"orderId": 42953967928017012, // Order ID
"userId": 8098448373, // User ID
"symbol": "XRPUSDT", // Symbol name
"displaySymbol": "XRP/USDT", // Symbol display name
"price": "0.5446", // Trade price
"avgPrice": "0", // Average trade price
"qty": "1", // Order quantity
"fillQty": "0", // Trade quantity
"remainQty": "1", // Remain quantity
"status": 0, // Order status
"tradeSide": 1, // Trade side
"tradeType": 1, // Trade Type
"fee": "0", // Transaction fee(accumulated)
"feeCurrency": null, // Fee charged in
"ts": 1698215274894, // Order created timestamp (ms)
"updateTime": 1698215274950 // Order updated timestamp (ms)
}]
}
HTTP Request
GET https://api.coincall.com/open/spot/trade/orders/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | false | Symbol name |
Query All Orders(SIGNED)
Get all orders; active, canceled, or filled.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"id": 320307,
"clientOrderId": "42953967928017012", // User customised order ID
"orderId": 42953967928017012, // Order ID
"userId": 8098448373, // User ID
"symbol": "XRPUSDT", // Symbol name
"displaySymbol": "XRP/USDT", // Symbol display name
"price": "0.5446", // Trade price
"avgPrice": "0", // Average trade price
"qty": "1", // Order quantity
"fillQty": "0", // Trade quantity
"remainQty": "1", // Remain quantity
"status": 0, // Order status
"tradeSide": 1, // Trade side
"tradeType": 1, // Trade Type
"fee": "0", // Transaction fee(accumulated)
"feeCurrency": null, // Fee charged in
"ts": 1698215274894, // Order created timestamp (ms)
"updateTime": 1698215274950 // Order updated timestamp (ms)
}]
}
HTTP Request
GET https://api.coincall.com/open/spot/trade/allorders/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | false | Symbol name |
limit | integer | 1 | false | Limit for data size per page. [1, 1000]. Default: 500 |
startTime | integer | 1698202825192 | false | The start timestamp (ms) |
endTime | integer | 1698202825192 | false | The end timestamp (ms) |
Query Fill List(SIGNED)
Get fills trade list.
Response:
{
"code": 0,
"msg": "Success",
"i18nArgs": null,
"data": [{
"id": 20598,
"clientOrderId": "42953967928017002", // User customised order ID
"orderId": 42953967928017002, // Order ID
"tradeId": "714414039621107665563948", // Trade ID
"userId": 8098448373, // User ID
"symbol": "XRPUSDT", // Symbol name
"displaySymbol": "XRP/USDT", // Symbol display name
"tradeSide": 1, // Trade side
"price": "0.5479", // Order price
"qty": "1", // Order quantity
"isTaker": 1, // Filled by taker side, `1` Taker `0` FALSE
"fee": "0.0001", // Transaction fee(accumulated)
"feeCurrency": "XRP", // Fee charged in
"ts": 1698209660112, // Order created timestamp (ms)
"updateTime": 1698209660112 // Order updated timestamp (ms)
}]
}
HTTP Request
GET https://api.coincall.com/open/spot/trade/fills/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
symbol | string | TRXUSDT | false | Symbol name |
orderId | number | 42953967928017012 | false | Order ID |
limit | integer | 1 | false | Limit for data size per page. [1, 1000]. Default: 500 |
startTime | integer | 1698202825192 | false | The start timestamp (ms) |
endTime | integer | 1698202825192 | false | The end timestamp (ms) |
Options WebSocket
# Sample code
import hashlib
import hmac
import time
import websocket
import json
import threading
# API INFO
api_key = "YOUR_API_KEY"
api_sec = "YOUR_API_SECRET"
def on_open(ws):
print("WebSocket connection opened.")
# Send a subscribe message after the connection opened.
ws.send(json.dumps({ "action":"subscribe", "dataType":"orderBook", "payload":{ "symbol":"BTCUSD-27DEC24-65000-C" } }))
def on_close(ws, status, message):
print(f'WebSocket connection closed. status: {status}, message: {message}')
def on_error(ws, error):
print(f'WebSocket error: {error}')
def on_message(ws, message):
data = json.loads(message)
print(data)
def get_signed_header(ts):
verb='GET'
uri = '/users/self/verify'
auth = verb + uri + '?uuid=' + api_key + '&ts=' + str(ts)
signature = hmac.new(api_sec.encode('utf-8'), auth.encode('utf-8'), hashlib.sha256).hexdigest()
signature = signature.upper()
return signature
ts = int(time.time()*1000)
sign = get_signed_header(ts)
socket = 'wss://ws.coincall.com/options?code=10&uuid=' + api_key +'&ts='+ str(ts) +'&sign=' + sign + '&apiKey=' + api_key
ws = websocket.WebSocketApp(socket, on_open=on_open, on_close=on_close, on_error=on_error, on_message=on_message)
def run():
ws.run_forever()
ws_thread = threading.Thread(target=run)
ws_thread.start()
while True:
# Wait for the WebSocket connection to be established
if ws.sock and ws.sock.connected:
# Send heartbeat
msg = {"action":"heartbeat"}
ws.send(json.dumps(msg))
time.sleep(3)
else:
# If the WebSocket connection is not established, wait 3 seconds
time.sleep(3)
WSS interface for options:
wss://ws.coincall.com/options
- Connection example:
wss://ws.coincall.com/options?code=10&uuid=65905c2be07f49e79ac26aca4b0b3988&ts=1687326076897&sign=CF58E8C7BE6C10EF7D8A65F3D0538F7D6C73182C6AFCA26D2CBE2318E085E494&apiKey=7PvIEreC1g5Kd17S7Ei1mEd3ppyuoixhqlzqM0Rqfhw=
- Connection example:
Value of Connection Parameters
Name | Required | Note |
---|---|---|
code | true | 10, build connection |
uuid | false | Custom id by user |
ts | true | Timestamp, 1687326076897 |
sign | true | Signature |
apiKey | true | your api key |
sign: signature string, the signature algorithm is as follows:
First concatenate method + uri + ?uuid=your_api_key&ts=your_timestamp
(where +
represents String concatenation), then use HMAC SHA256 method to encrypt the concatenated string with apiSecret
, and then perform Base64 encoding.
method
: always GET
.
uri
: always /users/self/verify
Data Abbreviations
Please refer to the following field abbreviations for data fields in the futures request/response:
Name | Note |
---|---|
c | code, Operations for Request Protocol Execution |
rc | responseCode, Status of the Response Protocol |
d | data, Request/Response payload |
p | position, Subscription Data Page Location |
s | symbol |
high | high, The highest price |
low | low, The lowest price |
pe | period, granularity of K-line |
v | volume |
close | close price |
open | open price |
ts | timestamp |
uv | tradeValue |
rt | rt, remian timestamp |
mp | markPrice |
lp | lastPrice |
ip | indexPrice |
delta | delta |
iv | Implied Volatility |
theta | theta |
cp | changePrice, Price change in value |
pr0 | price24hOpen, Open price on UTC 00:00:00 |
cr | changeRate, Price change in percentage |
uv24 | volumeUsd24h, USD volume in 24hrs |
v24 | volume24h, Volume in 24hrs |
oi | openInterest |
up | underlyingPrice |
gamma | gamma |
vega | vega |
biv | bidIv, Best bid IV |
aiv | askIv, Best ask IV |
bs | bidSize, Best bid size |
as | askSize, Best ask size |
ask | ask, Best ask price |
bid | bid, Best bid price |
pr | price, last price |
sz | size |
sd | tradeSide |
q | qty, quantity |
fq | fill qty |
mm | pmMmAmount, maintenanceMargin in PM |
ab | available balance |
e | equityAmount |
mb | marginBalance |
btcv | btc value |
wb | canWithdrawPmAmount |
upnl | Unrealized Pnl |
ap | average proce |
coid | clientOrderId |
os | order status |
im | initialMargin in PM |
dv | Value in dollar |
oid | orderId |
si | trade side |
ty | trade type |
uid | userId |
ct | createTime |
ro | reduceOnly |
tid | trade ID |
rq | remainQty, Unfilled Quantity |
mpr | match price |
mq | match quantity |
le | leverage |
it | isTaker |
cq | canceled quantity |
HeartBeat
{ "action":"heartbeat" }
Payload:
{
"c":11,
"rc":1 // 1 Success
}
RFQ list
{ "action":"subscribe", "dataType":"blockTrade" }
Payload:
// New Order msgType:1
{
"dt": 20,
"c": 20,
"d": {
"msg": "{"msgType":1,"content":{"seekVOList":[{"symbol":"BTCUSD-11OCT24-64000-C","amount":0.1,"role":1,"tradeSide":1,"displayName":"BTC-11OCT24-64000-C","seekId":1840692011045359616,"uid":8098448373,"price":1986.02321251,"ctime":1727690148510,"id":1840692011118247938,"state":0,"underSymbol":"BTC","tradeType":1}],"endTime":1727691948510,"seekId":1840692011045359616}}"
},
"ts": 1727690148550
}
// Cancel Order msgType:2
{
"dt": 20,
"c": 20,
"d": {
"msg": "{"msgType":2,"content":[1840692011045359616]}"
},
"ts": 1727690155297
}
K-line Data
{ "action":"subscribe", "dataType":"kline", "payload":{ "symbol":"BTCUSD-27MAY23-24000-P", "period":"h1" } }
Payload:
{
"dt": 2,
"c": 20,
"d": {
"high": 4056.40850000, // The highest price
"s": "BTCUSD-4JUL23-27000-C", // symbol
"low": 4056.40850000, // The lowest price
"pe": "m1", // period
"v": 0, // volume
"close": 4056.40850000, // close price
"open": 4056.40850000, // open price
"ts": 1688449080000 // timestamp
}
}
Pricing Information
{ "action":"subscribe", "dataType":"bsInfo", "payload":{ "symbol":"BTCUSD-27MAY23-23500-C" } }
Payload:
{
"dt": 3,
"c": 20,
"d": {
"uv": 30783000.00000000, // tradeValue
"rt": 2081914160, // remian timestamp
"mp": 834.28262809, // markPrice
"lp": 834.29106136, // last price
"ip": 31059.68000000, // indexprice
"delta": 0.34898, // delta
"h": 783.67149194, // price24hHigh, Highest price in 24hrs
"l": 665.61113639, // price24hLow, Lowest price in 24hrs
"iv": 0.4728, // Implied Volatility
"theta": -29.14546, // theta
"cp": -64.84120504, // changePrice, Price change in value
"pr0": 899.13226640, // price24hOpen, Open price on UTC 00:00:00
"cr": -0.0721, // changeRate, Price change in percentage
"s": "BTCUSD-28JUL23-33000-C", // symbol
"uv24": 30783000.00000000, // volumeUsd24h, USD volume in 24hrs
"v": 1000.00000000, // volume
"v24": 1000.00000000, // volume24h, Volume in 24hrs
"oi": 1000.00000000, // openInterest
"up": 31248.97, // underlyingPrice
"gamma": 0.00010, // gamma
"vega": 29.70793, // vega
"ts": 1688449285840 // timestamp
}
}
Option Chain Data
{ "action":"subscribe", "dataType":"tOption", "payload":{ "symbol":"BTCUSD", "end":1685174400000 } }
Payload:
{
"dt": 4,
"c": 20,
"d": [{
"mp": 4038.58550000, // markPrice
"lp": 4038.58550000, // last price
"delta": 1.00000, // delta
"theta": 0.00000, // theta
"cp": -124.21240000, // changePrice, Price change in value
"biv": 0.01, // bidIv, Best bid IV
"aiv": 0.01, // askIv, Best ask IV
"cr": -0.0298, // changeRate, Price change in percentage
"bs": 0.2, // bidSize, Best bid size
"as": 0, // askSize, Best ask size
"s": "BTCUSD-4JUL23-27000-C", // symbol
"v": 1.00000000, // volume
"ask": 0, // ask, Best ask price
"v24": 1.00000000, // volume24h, Volume in 24hrs
"oi": 1.00000000, // openInterest
"upv": 0,
"up": 31038.5855, // underlyingPrice
"bid": 1, // bid, Best bid price
"gamma": 0.00000, // gamma
"vega": 0.00000, // vega
"ts": 1688452774463 // timestamp
}]
}
OrderBook
{ "action":"subscribe", "dataType":"orderBook", "payload":{ "symbol":"BTCUSD-27MAY23-26000-C" } }
Update Speed: 100ms
Message channel for the 100 best ask/bid full data.
Payload:
{
"dt": 5,
"c": 20,
"d": {
"s": "BTCUSD-4JUL23-27000-C", // symbol
"asks": [{
"pr": "4038.58", // price
"sz": "1" // size
}],
"bids": [{
"pr": "1",
"sz": "0.2"
}],
"ts": 1688453641701 // timestamp
}
}
Last Trades
{ "action":"subscribe", "dataType":"lastTrade", "payload":{ "symbol":"BTCUSD-27MAY23-26000-C" } }
Payload:
{
"dt": 6,
"c": 20,
"d": [{
"q": "1", // qty, quantity
"sd": 1, // tradeSide
"pr": "2757.03", // price
"s": "BTCUSD-4JUL23-27000-C", // symbol
"ts": 1688454356810 // timestamp
}]
}
Real-Time Account Margin
{ "action":"subscribe", "dataType":"accountBalance" }
Payload:
{
"dt": 7,
"c": 20,
"d": {
"mm": 3.18161452, // pmMmAmount maintenanceMargin in PM
"uid": 8095151726, // UID
"ab": 49999781762.68412425, // available balance
"dv": 49999935154.66088082, // Value in dollar
"assets": [{
"availableBalance": 138.00000000,
"coin": "XRP"
}, {
"availableBalance": 3999989.00000000,
"coin": "TRX"
}, {
"availableBalance": 49999781762.68412425,
"coin": "USDT"
}],
"im": 1762.52258038, // pmImAmount initialMargin in PM
"e": 49999935154.66088082, // equityAmount
"mb": 49999783525.20670463, // marginBalance
"delta": "0",
"btcv": 1448491.54875762, // btc value
"wb": 49999781762.68412425, // canWithdrawPmAmount
"upnl": 49325.72664219 // unrealizedAmount
}
}
Orders
{ "action":"subscribe", "dataType":"order" }
Payload:
Status: 0 NEW
{
"dt": 11,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"pr": "500", // Price
"si": 1, // Trade side > si
"ty": 1, // Trade type > ty
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, //Reduce only
"le": 3, // Leverage
"os": 0 //Status NEW
}
}
Status: 1 FILLED
{
"dt": 11,
"c": 20,
"d": {
"oid": 1665910350698258432,// Order ID
"coid": 123123123,// Client order id
"uid": "8095151726", // User id
"s": "BTCUSD-6JUN23-24000-C",// Option symbol name
"rq":"0.5",// Unfilled Quantity
"fq": "0",// Filled Quantity
"q": "0.5",// Order Quantity
"pr": "2095.6",// Price
"mpr": "499", // filled price in this trade
"mq": "0.5", // filled quantity in this trade
"ap": "2095.6",// Average price
"si": 1,// Trade side
"ty": 1,// Trade type
"ct": 1666667584739,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"it": 0, // Taker or Maker, 1 TRUE 0 FALSE
"os": 1 // FILLED
}
}
Status: 2 PARTIALLY_FILLED
{
"dt": 11,
"c": 20,
"d": {
"oid": 1665910350698258432,// Order ID
"coid": 123123123,// Client order id
"uid": "8095151726", // User id
"s": "BTCUSD-6JUN23-24000-C",// Option symbol name
"rq":"0.5",// Unfilled Quantity
"fq": "0",// Filled Quantity(accumulated)
"q": "0.5",// Order Quantity
"pr": "2095.6",// Price
"mpr": "499", // filled price in this trade
"mq": "0.5", // filled quantity in this trade
"ap": "2095.6",// Average filled price(accumulated)
"si": 1,// Trade side
"ty": 1,// Trade type
"ct": 1666667584739,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"it": 0, // Taker or Maker, 1 TRUE 0 FALSE
"os": 2 // PARTIALLY_FILLED
}
}
Status: 3 CANCELED, 10 CANCEL_BY_EXERCISE
{
"dt": 11,
"c": 20,
"d": {
"oid": 1665910350698258432,// Order ID
"coid": 123123123,// Client order id
"uid": "8095151726", // User id
"s": "BTCUSD-6JUN23-24000-C",// Option symbol name
"cq": "0.5", // Canceled Quantity
"fq": "0",// Filled Quantity(accumulated)
"q": "0.5",// Order Quantity
"pr": "2095.6",// Price
"ap": "2095.6",// Average filled price(accumulated)
"si": 1,// Trade side
"ty": 1,// Trade type
"ct": 1666667584739,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"os": 3 // 3 CANCELED, 10 CANCEL_BY_EXERCISE
}
}
Status: 6 INVALID
{
"dt": 11,
"c": 20,
"d": {
"oid": 1665910350698258432,// Order ID
"coid": 123123123,// Client order id
"uid": "8095151726", // User id
"s": "BTCUSD-6JUN23-24000-C",// Option symbol name
"rq":0.5,// Unfilled Quantity
"q": 0.5,// Order Quantity
"fq": 0,// Filled Quantity(accumulated)
"pr": 2095.6,// Price
"ap": 2095.6,// Average filled price(accumulated)
"si": 1,// Trade side
"ty": 1,// Trade type
"ct": 1666667584739,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"os": 6 // INVALID
}
}
Trade
{ "action":"subscribe", "dataType":"trade" }
Payload:
{
"dt": 15,
"c": 20,
"d": {
"clientOrderId": "1734123406279839744",
"feeRate": "-0.0006",
"isTaker": "0",
"matchPrice": "22180",
"matchQty": "2",
"matchValue": "44360",
"orderId": "1734123406279839744",
"orderSide": "1",
"remainQty": "0",
"symbol": "BTCUSD-22DEC23-20000-C",
"tradeId": "1734129035131924480",
"tradeTime": "1702282213169"
}
}
Position
{ "action":"subscribe", "dataType":"position", "payload":{ "symbol":"BTCUSD-4JUL23-27000-C" } }
Payload:
{
"dt": 12,
"c": 20,
"d": {
"q": "1", // quantity
"ap": "4274.79", // average price
"im": "0", // Im initMargin
"mm": "0", // Mm maintMargin
"s": "BTCUSD-4JUL23-27000-C", // symbol
"si": "1", // order side
"uid": "8095151726", // user id
"upnl": "-42.79" // Unrealized Pnl
}
}
Positions
{"action":"subscribe", "dataType":"position"}
Payload:
{
"dt": 19,
"c": 20,
"d": {
"q": "1", // quantity
"ap": "4274.79", // average price
"im": "0", // Im initMargin
"mm": "0", // Mm maintMargin
"s": "BTCUSD-4JUL23-27000-C", // symbol
"si": "1", // order side
"uid": "8095151726", // user id
"upnl": "-42.79" // Unrealized Pnl
}
}
Futures WebSocket
# Sample code
import hashlib
import hmac
import time
import websocket
import json
import threading
# API INFO
api_key = "YOUR_API_KEY"
api_sec = "YOUR_API_SECRET"
def on_open(ws):
print("WebSocket connection opened.")
# Send a subscribe message after the connection opened.
ws.send(json.dumps({ "action":"subscribe", "dataType":"spotPrice", "payload":{ "symbol":"BTCUSD" } }))
def on_close(ws, status, message):
print(f'WebSocket connection closed. status: {status}, message: {message}')
def on_error(ws, error):
print(f'WebSocket error: {error}')
def on_message(ws, message):
data = json.loads(message)
print(data)
def get_signed_header(ts):
verb='GET'
uri = '/users/self/verify'
auth = verb + uri + '?uuid=' + api_key + '&ts=' + str(ts)
signature = hmac.new(api_sec.encode('utf-8'), auth.encode('utf-8'), hashlib.sha256).hexdigest()
signature = signature.upper()
return signature
ts = int(time.time()*1000)
sign = get_signed_header(ts)
socket = 'wss://ws.coincall.com/futures?code=10&uuid=' + api_key +'&ts='+ str(ts) +'&sign=' + sign + '&apiKey=' + api_key
ws = websocket.WebSocketApp(socket, on_open=on_open, on_close=on_close, on_error=on_error, on_message=on_message)
def run():
ws.run_forever()
ws_thread = threading.Thread(target=run)
ws_thread.start()
while True:
# Wait for the WebSocket connection to be established
if ws.sock and ws.sock.connected:
# Send heartbeat
msg = {"action":"heartbeat"}
ws.send(json.dumps(msg))
time.sleep(3)
else:
# If the WebSocket connection is not established, wait 3 seconds
time.sleep(3)
WSS interface for futures:
wss://ws.coincall.com/futures
- Connection example:
wss://ws.coincall.com/futures?code=10&uuid=65905c2be07f49e79ac26aca4b0b3988&ts=1687326076897&sign=CF58E8C7BE6C10EF7D8A65F3D0538F7D6C73182C6AFCA26D2CBE2318E085E494&apiKey=7PvIEreC1g5Kd17S7Ei1mEd3ppyuoixhqlzqM0Rqfhw=
- Connection example:
Value of Connection Parameters
Name | Required | Note |
---|---|---|
code | true | 10, build connection |
uuid | false | Custom id by user |
ts | true | Timestamp, 1687326076897 |
sign | true | Signature |
apiKey | true | your api key |
sign: signature string, the signature algorithm is as follows:
First concatenate method + uri + ?uuid=your_api_key&ts=your_timestamp
(where +
represents String concatenation), then use HMAC SHA256 method to encrypt the concatenated string with apiSecret
, and then perform Base64 encoding.
method
: always GET
.
uri
: always /users/self/verify
Data Abbreviations
Please refer to the following field abbreviations for data fields in the futures request/response:
Name | Note |
---|---|
c | code, Operations for Request Protocol Execution |
rc | response code, Status of the Response Protocol |
d | data, Request/Response payload |
p | position, Subscription Data Page Location |
s | symbol |
pr | price |
mp | mark Price |
ip | index Price |
h | price24hHigh, Highest price in 24hrs |
l | price24hLow, Lowest price in 24hrs |
cp | changePrice, Price change in value |
cr | changeRate, Price change in percentage |
pr0 | price24hOpen, Open price on UTC 00:00:00 |
uv24 | volumeUsd24h, USD volume in 24hrs |
v24 | volume24h, Volume in 24hrs |
high | high, The highest price |
low | low, The lowest price |
pe | period, granularity of K-line |
v | volume |
close | close price |
open | open price |
ts | timestamp |
sz | size |
sd | tradeSide, buy or sell |
q | qty, quantity |
fq | filled quantity |
ap | avgPrice, average price |
coid | clientOrderId |
os | order status |
im | initial Margin |
oid | orderId |
si | trade side |
ty | trade type |
uid | userId |
elp | estimated Liquidation Price |
mm | maintenance Margin |
upnl | Unrealized Pnl |
dt | dataType, websocket channels |
ct | createTime |
ro | reduceOnly |
tid | trade ID |
rq | remainQty, Unfilled Quantity |
mpr | match price |
mq | match quantity |
le | leverage |
it | isTaker |
cq | canceled quantity |
HeartBeat
{ "action":"heartbeat" }
Payload:
{
"c":11,
"rc":1 // 1 Success
}
Index Price
{ "action":"subscribe", "dataType":"spotPrice", "payload":{ "symbol":"BTCUSD" } }
Payload:
{
"dt": 30,
"c": 20,
"d": {
"pr": 1.1752, // last price
"mp": 1.17521086, // mark Price
"ip": 1.17550000, // index Price
"h": 1.18070000, // price24hHigh, Highest price in 24hrs
"l": 1.12120000, // price24hLow, Lowest price in 24hrs
"cp": 0.02410000, // changePrice, Price change in value
"cr": 0.0209, // Price change in percentage
"pr0": 1.05768, // price24hOpen, Open price on UTC 00:00:00
"s": "ARBUSD", // symbol
"uv24": 320076.05815000, // volumeUsd24h, USD volume in 24hrs
"v24": 278226.50000000 // volume24h, Volume in 24hrs
}
}
K-line Data
{ "action":"subscribe", "dataType":"kline", "payload":{ "symbol":"BTCUSD", "period":"h1" } }
Value of period
Key | Note |
---|---|
m1 | 1 minute |
m5 | 5 minutes |
m15 | 15 minutes |
m30 | 30 minutes |
h1 | 1 hour |
h4 | 4 hours |
d1 | 1 day |
w1 | 1 week |
mn1 | 1 month |
quarter | 3 months |
Payload:
{
"dt": 31,
"c": 20,
"d": {
"high": 30831.73000000, // The highest price
"s": "BTCUSD", // symbol
"low": 30831.73000000, // The lowest price
"pe": "m1", // period, granularity of K-line
"v": 1.00000000, // volume
"close": 30831.73000000, // close price
"open": 30831.73000000, // open price
"ts": 1688383680000 // timestamp
}
}
OrderBook
{ "action":"subscribe", "dataType":"orderBook", "payload":{ "symbol":"BTCUSD" } }
Update Speed: 200ms
Message channel for the 100 best ask/bid full data.
Payload:
{
"dt": 32,
"c": 20,
"d": {
"s": "BTCUSD", // symbol
"asks": [{
"pr": "30831.73", // price
"sz": "180.30200000" // size
}, {
"pr": "40000",
"sz": "0.40000000 "
}],
"bids": [{
"pr": "1",
"sz": "1 "
}],
"ts": 1688384138863 // timestamp
}
}
Last Trades
{ "action":"subscribe", "dataType":"lastTrade", "payload":{ "symbol":"BTCUSD" } }
Payload:
{
"dt": 33,
"c": 20,
"d": [{
"q": "1", // qty quantity
"sd": 1, // tradeSide
"pr": "30831.73000000", // price
"s": "BTCUSD", // symbol
"ts": 1688436545891 // timestamp
}, {
"q": "83.11100000",
"sd": 1,
"pr": "30139.37000000",
"s": "BTCUSD",
"ts": 1688370059868
}]
}
Orders
{ "action":"subscribe", "dataType":"order" }
Payload:
Status: 0 NEW
{
"dt": 35,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"pr": "500", // Price
"si": 1, // Trade side > si
"ty": 1, // Trade type > ty
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, //Reduce only
"le": 3, // Leverage
"os": 0 //Status NEW
}
}
Status: 1 FILLED
{
"dt": 35,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"fq": "1", // Filled Quantity(accumulated)
"rq": "0", // Unfilled Quantity
"pr": "500", // Order Price
"mpr": "499", // filled price in this trade
"mq": "0.5", // filled quantity in this trade
"ap": "0", // Average filled price(accumulated)
"si": 1, // Trade side
"ty": 1, // Trade type
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, //Reduce only
"le": 3, // Leverage
"it": 0, // Taker or Maker, 1 TRUE 0 FALSE
"os": 1 // FILLED
}
}
Status: 2 PARTIALLY_FILLED
{
"dt": 35,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"fq": "0.5", // Filled Quantity(accumulated)
"rq": "0.5", // Unfilled Quantity
"pr": "500", // Price
"mpr": "499", // filled price in this trade
"mq": "0.5", // filled quantity in this trade
"ap": "0", // Average filled price(accumulated)
"si": 1, // Trade side
"ty": 1, // Trade type
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, //Reduce only
"le": 3, // Leverage
"it": 0, // Taker or Maker, 1 TRUE 0 FALSE
"os": 2 // PARTIALLY_FILLED
}
}
Status: 3 CANCELED
{
"dt": 35,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"fq": "0.5", // Filled Quantity(accumulated)
"cq": "0.5", // Canceled Quantity
"pr": "500", // Price
"ap": "0", // Average filled price(accumulated)
"si": 1, // Trade side
"ty": 1, // Trade type
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"le": 3, // Leverage
"os": 3 // CANCELED
}
}
Status: 6 INVALID
{
"dt": 35,
"c": 20,
"d": {
"coid":1000200000, // Client order id
"oid": 1663004711982333952, // Order id
"uid": "8095151726", // User id
"s": "BTCUSD",// Futures symbol name
"q": "1", // Order Quantity
"fq": "0.5", // Filled Quantity(accumulated)
"rq": "0.5", // Unfilled Quantity
"pr": "500", // Price
"ap": "0", // Average filled price(accumulated)
"si": 1, // Trade side
"ty": 1, // Trade type
"ct": 1685326195118,// Time of the order created
"ts": 1685326195118,// Time of this event
"ro": 0, // Reduce only
"le": 3, // Leverage
"os": 6 // INVALID
}
}
Trade
{ "action":"subscribe", "dataType":"trade" }
Payload:
{
"dt": 38,
"c": 20,
"d": {
"coid": "1734123406279839744", // client order id
"fr": "0.0006", // feeRate
"tf":"-0.1234", // tradeFee
"it": "0", // isTaker
"mpr": "22180", // matchPrice
"mq": "2", // matchQty
"mv": "44360", // matchValue
"oid": "1734123406279839744", // order id
"si": "1", // trade side
"rq": "0", // remainQty
"s": "BTCUSD", // symbol
"tid": "1734129035131924480", // tradeId
"ts": "1702282213169" // trade time
}
}
Positions
{ "action":"subscribe", "dataType":"position" }
Payload:
{
"dt": 36,
"c": 20,
"d": {
"q": "4", // filled quantity
"ap": "0.3435", // average price
"elp": "-20963.68918261", // Elp estimated Liquidation Price
"im": "0.458", // initMargin
"mm": "0.04122", // maintMargin
"mp": "0.3435", // mark price
"s": "FTMUSD", // symbol
"si": "1", // order side
"uid": "8095151726", // user id
"upnl": "0" // Unrealized Pnl
}
}
Spot WebSocket
# Sample code
import hashlib
import hmac
import time
import websocket
import json
import threading
# API INFO
api_key = "YOUR_API_KEY"
api_sec = "YOUR_API_SECRET"
def on_open(ws):
print("WebSocket connection opened.")
# Send a subscribe message after the connection opened.
# public topic
ws.send(json.dumps({ "sub":"market.XRPUSDT.kline.1min", "id":"1698208992286"}))
# private topic
ws.send(json.dumps({ "sub":"order", "id":"1698208992286"}))
def on_close(ws):
print("WebSocket connection closed.")
def on_error(ws, error):
print(f'WebSocket error: {error}')
def on_message(ws, message):
data = json.loads(message)
print(data)
def get_signed_header(ts):
verb='GET'
uri = '/users/self/verify'
auth = verb + uri + '?uuid=' + api_key + '&ts=' + str(ts)
signature = hmac.new(api_sec.encode('utf-8'), auth.encode('utf-8'), hashlib.sha256).hexdigest()
signature = signature.upper()
return signature
ts = int(time.time()*1000)
sign = get_signed_header(ts)
# public spot
# socket = 'wss://ws.coincall.com/spot/ws'
# private spot
socket = 'wss://ws.coincall.com/spot/ws/private?ts='+ str(ts) +'&sign=' + sign + '&apiKey=' + api_key
ws = websocket.WebSocketApp(socket, on_open=on_open, on_close=on_close, on_error=on_error, on_message=on_message)
def run():
ws.run_forever()
ws_thread = threading.Thread(target=run)
ws_thread.start()
while True:
# Wait for the WebSocket connection to be established
if ws.sock and ws.sock.connected:
# Send heartbeat
msg = {"action":"heartbeat"}
ws.send(json.dumps(msg))
time.sleep(3)
else:
# If the WebSocket connection is not established, wait 3 seconds
time.sleep(3)
WSS interface for futures:
wss://ws.coincall.com/spot
- Public connection example:
wss://ws.coincall.com/spot/ws
- Private connection example:
wss://ws.coincall.com/spot/ws/private?ts=1687326076897&sign=CF58E8C7BE6C10EF7D8A65F3D0538F7D6C73182C6AFCA26D2CBE2318E085E494&apiKey=7PvIEreC1g5Kd17S7Ei1mEd3ppyuoixhqlzqM0Rqfhw=
- Public connection example:
Value of Private Connection Parameters
Name | Required | Note |
---|---|---|
ts | true | Timestamp, 1687326076897 |
sign | true | Signature |
apiKey | true | your api key |
sign: signature string, the signature algorithm is as follows:
First concatenate method + uri + ?uuid=your_api_key&ts=your_timestamp
(where +
represents String concatenation), then use HMAC SHA256 method to encrypt the concatenated string with apiSecret
, and then perform Base64 encoding.
method
: always GET
.
uri
: always /users/self/verify
HeartBeat
{ "action":"heartbeat" }
Payload:
{
"c":11,
"rc":1 // 1 Success
}
Public Orderbook
- Once you have subscribed successfully, you will receive a snapshot.
- The WebSocket will keep pushing delta messages every time the orderbook changes. If you receive a new snapshot message, you will have to reset your local orderbook.
{ "sub": "market.$symbol.mbp.$step", "id": "$timestamp" }
$step value: 1, 50, 100, 200
Update Speed:
Level 1 data, push frequency:10ms
Level 50 data, push frequency:20ms
Level 100 data, push frequency:100ms
Level 200 data, push frequency:100ms
Payload:
// snapshot
{
"ch": "market.XRPUSDT.mbp.50",
"ts": 1698824389345,
"status": "ok",
"tick": {
"s": "XRPUSDT",
"b": [
[0.5958, 6198.0], // Price, Size
[0.5956, 15113.0],
[0.5954, 30156.0],
[0.5952, 23570.0],
[0.595, 24491.0],
[0.5948, 14661.0],
[0.5946, 26620.0],
[0.5942, 22317.0],
[0.5939, 23840.0],
[0.5936, 767.0],
[0.5935, 24077.0],
[0.5933, 31702.0],
[0.5915, 2371.0],
[0.5905, 12671.0],
[0.5897, 901.0],
[0.5891, 2566.0],
[0.5885, 11754.0]
],
"a": [
[0.5967, 19808.0], // Price, Size
[0.597, 2614.0],
[0.5972, 55037.0],
[0.5974, 84102.0],
[0.5976, 957.0],
[0.5978, 64141.0],
[0.598, 2134.0],
[0.5982, 79251.0],
[0.5984, 10784.0],
[0.599, 32038.0],
[0.5996, 1757.0],
[0.6002, 964.0],
[0.6008, 23247.0],
[0.6014, 11966.0],
[0.6022, 2562.0],
[0.6028, 25037.0],
[0.6036, 1229.0],
[0.6042, 31042.0]
],
"type": "snapshot", // Data type
"u": 93639 // Update ID
}
}
// delta
{
"ch": "market.XRPUSDT.mbp.50",
"ts": 1698824394244,
"status": "ok",
"tick": {
"s": "XRPUSDT",
"b": [ // Bids to be updated
[0.5958, 0.0] // Price, Size
],
"a": [], // // Asks to be updated
"type": "delta", // Data type
"prevU": 93640, // Last update ID
"u": 93641 // Update ID
}
}
Public Trade Streams
{ "sub": "market.$symbol.trade.detail", "id": "$timestamp" }
Payload:
{
"ch": "market.XRPUSDT.trade.detail",
"ts": 1698825567210,
"status": "ok",
"tick": [{
"tradeId": "64171106369742529", // Trade ID
"symbol": "XRPUSDT", // Symbol name
"price": 0.5981, // Trade price
"qty": 814.0, // Trade quantity
"side": 2, // Trade side
"ts": 1698825550425 // Trade time
}]
}
Public Kline/Candlestick Streams
{ "sub": "market.$symbol.kline.$interval", "id": "$timestamp" }
Value of period
Key | Note |
---|---|
1min | 1 minute |
5min | 5 minutes |
15min | 15 minutes |
30min | 30 minutes |
60min | 1 hour |
4hour | 4 hours |
1day | 1 day |
1week | 1 week |
1mon | 1 month |
1year | 1 year |
Payload:
{
"ch": "market.XRPUSDT.kline.1min",
"ts": 1698825870620,
"status": "ok",
"tick": {
"endTime": 1698825840000, // The end timestamp (ms)
"open": 0.5985, // Open price
"close": 0.5983, // Close price
"low": 0.5974, // Lowest price
"high": 0.5985, // Highest price
"volume": 1498.0, // Trade volume
"volumeUsd": 895.7453 // Trade volume in USD
}
}
Public Symbol Ticker Streams
Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.
{ "sub": "market.$symbol.bbo", "id": "$timestamp" }
Payload:
{
"ch": "market.XRPUSDT.bbo",
"ts": 1698826509820,
"status": "ok",
"tick": {
"symbol": "XRPUSDT",
"bidPrice": 0.6009,
"bidSize": 14131.0,
"askPrice": 0.6026,
"askSize": 51025.0
}
}
Public Symbol 24Ticker Streams
{ "sub": "market.overviewv2", "id": "$timestamp" }
Payload:
{
"ch": "market.overviewv2",
"status": "ok",
"ts": 1698826877951,
"tick": {
"TRXUSDT": {
"s": "TRXUSDT", // Symbol name
"base": "TRX", // Base coin
"quote": "USDT", // Quote coin
"o": 0.09609, // Open price
"h": 0.0982, // Highest price
"l": 0.09506, // Lowest price
"c": 0.09773, // Close price
"a": 1502146.0, // Volume in base coin
"v": 145298.5662, // Volume in quote coin
"r": 0.01706733270891875, // Price change in value
"cp": 0.0016400000000000026, // // Price change in percentage
"i": 0.09783096 // Index price.
}
}
}
Public Symbol 24Ticker Streams by a symbol
{ "sub": "market.$symbol.overviewv2", "id": "$timestamp" }
Payload:
{
"ch": "market.TRXUSDT.overviewv2",
"status": "ok",
"ts": 1698826877951,
"tick": {
"TRXUSDT": {
"s": "TRXUSDT", // Symbol name
"base": "TRX", // Base coin
"quote": "USDT", // Quote coin
"o": 0.09609, // Open price
"h": 0.0982, // Highest price
"l": 0.09506, // Lowest price
"c": 0.09773, // Close price
"a": 1502146.0, // Volume in base coin
"v": 145298.5662, // Volume in quote coin
"r": 0.01706733270891875, // Price change in value
"cp": 0.0016400000000000026, // // Price change in percentage
"i": 0.09783096 // Index price.
}
}
}
Private Orders
{ "sub": "order", "id": "$timestamp" }
Payload:
Status: 0 NEW
{
"ch": "order",
"ts": 1698893249297,
"status": "ok",
"tick": {
"orderId": 66362398685069333,
"clientOrderId": "66362398685069333",
"symbol": "XRPUSDT",
"price": "0.594",
"qty": "1",
"tradeSide": "buy",
"tradeType": 1,
"status": 0,
"createTime": 1698893249252
}
}
Status: 1 FILLED
{
"ch": "order",
"ts": 1698895342017,
"status": "ok",
"tick": {
"orderId": 66362398685069357,
"clientOrderId": "66362398685069357",
"symbol": "XRPUSDT",
"price": "0.6243",
"qty": "100",
"tradeSide": "buy",
"status": 1,
"avgPrice": "0.60920100",
"remainQty": "0",
"filledQty": "100",
"createTime": 1698895341979,
"matchTime": 1698895342004,
"tradeId": "726474966362398685069357",
"isTaker": 1,
"matchPrice": "0.60920100",
"matchQty": "100",
"tradeType": 2
}
}
Status: 2 PARTIALLY_FILLED
{
"ch": "order",
"ts": 1698899289854,
"status": "ok",
"tick": {
"orderId": 66362398685069360,
"clientOrderId": "66362398685069360",
"symbol": "XRPUSDT",
"price": "0.6",
"qty": "10",
"tradeSide": "buy",
"status": 2,
"avgPrice": "0.60000000",
"remainQty": "9",
"filledQty": "1",
"createTime": 1698899237116,
"matchTime": 1698899289843,
"tradeId": "726475366362398685069360",
"isTaker": 0,
"matchPrice": "0.6",
"matchQty": "1",
"tradeType": 1
}
}
Status: 3 CANCELED
{
"ch": "order",
"ts": 1698893719826,
"status": "ok",
"tick": {
"orderId": 66362398685069333,
"clientOrderId": "66362398685069333",
"symbol": "XRPUSDT",
"price": "0.594",
"qty": "1",
"tradeSide": "buy",
"status": 3,
"avgPrice": "0",
"filledQty": "0",
"createTime": 1698893249252,
"canceledQty": "1",
"tradeType": 1
}
}
Referrals
Referrals Record(SIGNED)
Get referrals record
Response:
{
"code": 0,
"msg": null,
"data": {
"list": [
{
"inviteeUserId": 9804700, // User ID of invitee
"level": 0, // 0 user, 1 sub-agent
"commissions": 0, // Commission earned from this user himself and his invitees
"verification": 0, // 0 false, 1 true
"deposit": 0, // 0 false, 1 true
"futures": 1, // 0 false, 1 true
"options": 0, // 0 false, 1 true
"regTime": 1675845379145 // Time of registration (ms)
}
],
"pageTotal": 2,
"total": 14
}
}
HTTP Request
GET https://api.coincall.com/open/referral/sub/v1
Parameter
Name | Type | Value | Required | Note |
---|---|---|---|---|
subAgentId | integer | 9905700 | false | |
page | integer | 1,2,3 | false |
Notice
subAgentId
UID of the sub-agent; if it is not passed, it will return all invitees, and if it is passed, it will return the invitees of the user and the user itself.
This parameter only used for sub agent, please make sure your account type is a sub agent for coincall, or you will get an error code:10004.
Error Codes
The Coincall API uses the following error codes:
Codes | Description |
---|---|
0 | Success |
500 | Internal servererror |
2015 | User does not exist. |
2016 | Public key not exist |
2017 | Private key not exist |
4002 | Token expired. |
4003 | Token auth fail. |
4004 | Token kicke out. |
4005 | Duplicate request. |
4006 | This country or region is not supported |
7001 | No Permission. |
10000 | Try again later |
10001 | This operation is not allowed |
10002 | Result api system error |
10003 | Result api resquest illegal |
10004 | Parameter illegal |
10005 | Parameter error |
10006 | Sign illegal |
10007 | Token is error |
10008 | IP illegal |
10009 | Request method not support |
10010 | Param illegal |
10101 | Result header build error |
10102 | Query exception |
10103 | System inner error |
10104 | Params is null |
10105 | Params is blank |
10106 | Param long is blank |
10107 | Param integer is blank |
10108 | Params type error |
10500 | Incorrect or expired email verification code. |
10501 | Incorrect 2FA code. |
10502 | Please enter email verification code. |
10503 | Please enter 2FA code. |
10504 | You are not able to withdraw funds because of the abnormal status of this account. |
10505 | Invalid email address. |
10506 | Please enter your password |
10507 | Must be at least 8 characters . |
10508 | Invalid email address. |
10509 | Please enter your password |
10510 | Must be at least 8 characters . |
10511 | Must not exceed 32 characters. |
10512 | Must contain at least one number (0-9). |
10513 | Must contain at least one special character (!@#$%^&*). |
10514 | The passwords do not match. |
10515 | Please enter correct referral code. |
10516 | Please select a country or region. |
10517 | Please agree to the Terms of Service . |
10518 | Incorrect or expired email verification code. |
10519 | Account blocked |
10520 | Invalid account or password, 5-n attempts remaining. |
10521 | Your account has been restricted to log in. |
10522 | Please enter the email verification code |
10523 | Please enter the 2FA code |
10524 | Incorrect 2FA code. |
10525 | Position the piece in its slot |
10526 | Please enter 2FA code |
10527 | Incorrect the 2FA code. |
10528 | Incorrect password. |
10529 | Insufficient available balance. |
10530 | Please enter price |
10531 | Order price is higher than the maximum limit {0}. |
10532 | Order price is lower than the minimum limit {0}. |
10533 | Please enter amount |
10534 | Order size exceeds the maximum limit per order. |
10535 | The number of orders exceeds the maximum limit. |
10536 | Insufficient open positions. |
10537 | Order cancellation failed. |
10538 | Order IV is higher than the maximum limit 500%. |
10539 | Order IV is lower than the minimum limit 50%. |
10540 | Order has expired. |
10541 | The number of stop orders exceeds the maximum limit. |
10542 | Please enter stop price |
10543 | Please enable the 2FA code . |
10544 | Only 10 APIKeys can be created per account. |
10545 | Must not exceed 128 characters. |
10546 | Please enter a name. |
10547 | This name is already used. |
10548 | Each APIKey can bind up to 20 IP addresses. |
10549 | Invalid IP address. |
10550 | Please enter email verification code. |
10551 | The IP address is not in whitelist. |
10552 | Operation failed. |
10553 | The server is under maintenance, please try again later. |
10554 | You are not authorized to execute this request. |
10555 | API frozen |
10556 | APIKey does not match current environment. |
10557 | Timestamp request expired. |
10560 | Invalid CC-ACCESS-KEY. |
10561 | Invalid CC-ACCESS-TIMESTAMP. |
10562 | Invalid signature. |
10563 | Invalid authorization. |
10564 | Invalid request method. |
10565 | Endpoint request timeout |
10566 | API is offline or unavailable. |
10567 | Invalid content_type. |
10568 | Account does not exist. |
10569 | User ID cannot be empty. |
10570 | Parameter {0} cannot be empty. |
10571 | Parameter {0} does not match parameter {1}. |
10572 | Parameter {0} count exceeds the limit |
10573 | Parameter {0} error. |
10574 | Instrument ID does not exist. |
10575 | Either client order ID or order ID is required. |
10576 | Duplicated order ID. |
10577 | Duplicated client order ID. |
10578 | Token does not exist. |
10579 | Index does not exist. |
10580 | Instrument ID does not match instrument type. |
10581 | Position does not exist. |
10582 | Order timed out, please try again later. |
10583 | Cancellation timed out, please try again later. |
10584 | Order does not exist. |
10585 | Either order status or order ID is required. |
10586 | Channel subscription failed. |
10587 | Login failed. |
10588 | Please log in. |
10589 | Invalid request. |
10590 | Invalid args. |
10591 | Invalid url path. |
10592 | The {0} does not exist. |
10593 | Invalid op {0} |
10594 | Wrong passphrase |
10595 | Token subscription amount exceeds the limit |
10596 | Internal system error. |
10597 | Maximum receive of friends is XX%. |
10598 | The number of referral links exceeds the maximum limit. |
10599 | Please enter your name/date of birth/address |
10600 | Name contains numbers or symbols. |
10601 | Please select the type of address proof. |
10602 | Please upload the file |
10603 | File is too large, upload failed. |
10604 | The format of this file is not supported. |
10605 | Operation is too frequent. |
10606 | The number of exports this month exceeds the maximum limit. |
10607 | File not exists |
10608 | File expired |
10609 | You are not able to trade temporarily because the contract is abnormal. |
20000 | Coin not exist |
20001 | Account not found |
20002 | Coin not support |
20003 | User not found |
20004 | Please enable the 2FA code. |
20005 | Please select withdrawal coin. |
20006 | Please select withdrawal network. |
20007 | Please enter withdrawal address. |
20008 | Withdrawal network does not match the withdrawal address. |
20009 | Please enter an amount. |
20010 | Insufficient withdrawable balance. |
20011 | Exceed the 24 hours limit of withdrawal. |
20012 | Minimum withdrawal amount is 20 USDC. |
20013 | You are not able to withdraw funds within 24 hours after changing the password. |
20014 | Send code fail |
20015 | User not exist |
20016 | Sub user not allowed withdraw |
20018 | User withdraw restricted |
20020 | Not found withdraw record |
20021 | Not your withdraw record |
20022 | Not supported cancel, now is processing or completed |
20023 | not supported cancel, now is processing |
20024 | Account create fail |
20025 | Account update fail |
20027 | Target mode equals origin mode |
20028 | Option pending order exsist |
20029 | Option hold position exsist |
20030 | Future pending order exsist |
20031 | Future hold position exsist |
20032 | You need to transfer remainning funds to main account or other sub accounts |
20033 | Send code fail |
20034 | Start time and end time range exceeds three months |
30000 | User illegal |
30001 | Token illegal |
30002 | Check fail |
30003 | Google verification code is wrong |
30004 | Verification code is wrong |
40001 | User is freezed |
40002 | User over login max times |
40003 | Operate code timeout |
40004 | Token error |
40005 | Too many failed attempts, and your account has been locked |
40006 | Error fund transfer type, transfer sub account's parent user wrong |
40007 | Error fund transfer type, transfer to user must be sub account |
40008 | Transfer trade type is invalid |
40009 | Transfer amount exceeds can withdraw balance amount |
40010 | Error fund transfer type, transfer from user must be sub account |
40011 | Sub account size limit |
40012 | User name already used |
40013 | Email already used |
40014 | Sub account id error |
40015 | Referral not found |
40016 | Invite commission rate add invitee commission rate not equals referral total commission rate |
40017 | Company info is exist |
40018 | Age less than 18 |
40019 | Company info not exist |
40020 | Jumio workflow not exist error |
40021 | Age format is error |
40022 | Kyc user status error |
40023 | Kyc user check error |
40024 | Upgrade error |
40025 | Check rate error |
40026 | Get temp url error |
40027 | Two grade auth error |
40028 | One grade step1 save error |
40029 | One grade save error |
40030 | Jumio user reference change |
40031 | Kyc processing |
40032 | Jumio status not exist |
40033 | Jumio status enum is not exist |
40034 | Option not exist |
40035 | Price illegal |
40036 | Volume illegal |
40037 | IM more than 100% |
40038 | You are not able to adjust leverage due to existing open positions or pending orders in the account. |
40039 | The price exceeds the maximum limit {0} |
40040 | File size limit |
40041 | Upload file frequently |
40042 | File type is unknow |
40043 | File type is error |