General
OptionDance is a decentralized option trading market, build on Mixin Network currently. We reinvented options trading for retail investors, maximize the efficiency of their assets.
We provide simple, developer-friendly APIs for 3rd-party developers. The APIs in our system are organized around RESTful style and served by HTTP/1.1 protocol for you.
Base URLs
Env | Host |
---|---|
Primary | https://api.option.dance |
Test | https://test-api.option.dance |
Response
Response Example
{
"code": 0,
"data": [
{
"instrument_name": "C-pUSD-BTC-31DEC21-54000-P",
"strike_price": 54000,
"expiration_date": "2021-12-31T16:00:00+08:00",
"expiration_date_str": "2021-12-31",
"expiration_timestamp": 1640937600,
"option_type": "PUT",
"delivery_type": "CASH",
"quote_currency": "pUSD",
"base_currency": "BTC",
"created_at": "2021-11-03T11:17:35.103218+08:00",
"updated_at": "2021-11-15T16:06:31.098912+08:00",
"status": 0,
"bids": [
{
"side": "BID",
"price": "190.87",
"amount": "0.1",
"funds": "19.087"
}
],
"asks": []
}
],
"msg": "success"
}
The response returned from our APIs are organized as the general JSON object described below. The developers should expand it manually.
Field | Type | Example | Description |
---|---|---|---|
code | int | 0 |
The status of API execution. When the API executes successfully, it always returns 0. If the execution fails, a concrete error code is returned. You can see more details about the error code on the Error Handling page. |
msg | string | success | The extra information that the API wants to tell you. It always returns success if the API executes successfully. If executed failed, it may return some error messages |
data | object | {} |
The API execution result. There are two forms, paged and unpaged. Developers can get more information from Pagination page |
Pagination
Pagination Example
{
"code": 0,
"data": {
"pages": 1,
"total": 1
"records": [
{
"position_id": "407c3095-3189-3f9b-8239-5e71f0843fd7",
"position_num": 1425021902673416192,
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"side": "ZERO",
"type": "PUT",
"size": 10.0,
"funds": 1000.0,
}
],
},
"msg": "success"
}
APIs that return list data would contain fields about pagination. Paging parameters in the request are uniform for those APIs that return an array, like /api/v1/positions
.
Those APIs accept two query parameters named current
and size
as paging control generally, and return the following structure.
Field | Type | Description |
---|---|---|
total | int | Total number of records. It is important to note that this is the total of all relevant data, not the total of current returned values. |
pages | int | Points to the current page. Note that it is count from 1. |
records | []object | List of object that you want to retrieve. |
Authorization
The OptionDance API uses JWT token to authenticate requests.
Actually, there are two kinds of APIs in our system, public and private.
For public APIs, like /api/v1/market
, which Authorization required
marked as false
, developers can invoke them directly without any authorizaiton information supplied.
But for private APIs, like /api/v1/user/me
, which Authorization required
marked as true
, developers must carry authorizaiton token in HTTP header, for verifing its identity.
Get Access Token
POST /api/v1/auth
Description
We used JWT token to authenticate all private APIs, so you must retrieve access token before invoking a private request
Authorization required
true
How to obtain a Mixin token?
Developers have to use Mixin token to exchange OptionDance token with us. Mixin token that we used to recognize user identification is obtained from Mixin network. Please refer to this document Mixin API Authorization
Request
Parameter | Type | Required | Description |
---|---|---|---|
token | string | true | Your access token of Mixin network. Note that this is not a token for OptionDance |
Response
Get Access Token Response Example
{
"code": 0,
"msg": "success",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVkQXQiOjE2Mzk4MDk5NzgsInVzZXJJZCI6IiJ9.0ztomZ79nNBAzR1DwSJGy2VO3RmLEHkERpGnhsaqOSE"
}
}
Field | Type | Description |
---|---|---|
token | string | The token used to access private APIs of OptionDance |
POST /api/v1/oauth
Description
send mixin oauth response code, return mixin access_token
Authorization required
false
Request
Parameter | Type | Required | Description |
---|---|---|---|
code | string | true | mixin oauth response code |
Response
Get Access Token Response Example
{
"code": 0,
"msg": "success",
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVkQXQiOjE2Mzk4MDk5NzgsInVzZXJJZCI6IiJ9.0ztomZ79nNBAzR1DwSJGy2VO3RmLEHkERpGnhsaqOSE",
"scope": 'FULL',
}
}
Field | Type | Description |
---|---|---|
access_token | string | The access_token used to access private APIs of mixin and option dance |
scope | string | mixin access_token scope https://developers.mixin.one/zh-CN/docs/api/oauth/scope |
Market
Market APIs used to obtain market information from OptionDance.
List Market
List Option Market
GET /api/v1/market
Description
Get market option list
Authorization required
false
Request
Parameter | Type | Required | Enum | Description |
---|---|---|---|---|
side | string | true | ASK /BID |
The side of option orderbook info you want to get. |
optionType | string | true | CALL /PUT |
The type of option instruments you wnat to get. |
deliveryType | string | true | CASH /PHYSICAL |
The deliverying mode of option instruments you want to get. put option is CASH , call option is PHYSICAL |
quoteCurrency | string | true | USDC /pUSD /USDT |
The quoted currency of option instruments you want to get. USDC is recommend |
baseCurrency | string | true | BTC /ETH |
The base currency The quoted currency of option instruments you want to get. |
orderBy | string | false | strikePrice /interest /expiryDate |
sort market options by strikePrice or interest or expiryDate , default strikePrice |
Response
Returns market option list
Get market option List Example Response
{
"code": 0,
"data": [
{
"instrument_name": "C-USDC-BTC-2JUN23-26000-P",
"strike_price": 26000,
"expiration_date": "2023-06-02T16:00:00+08:00",
"expiration_date_str": "2023-06-02",
"expiration_timestamp": 1685692800,
"option_type": "PUT",
"delivery_type": "CASH",
"quote_currency": "USDC",
"base_currency": "BTC",
"created_at": "2023-05-12T11:47:37.631914+08:00",
"updated_at": "2023-05-26T10:59:24.062659+08:00",
"status": 0,
"bids": [
{
"side": "BID",
"price": "277.28",
"amount": "31.50",
"funds": ""
}
],
"asks": [
{
"side": "ASK",
"price": "464.78",
"amount": "66.20",
"funds": ""
}
],
"ask_interest": 464.78,
"bid_interest": 277.28
}
],
"msg": "success"
}
Field | Type | Example | Description |
---|---|---|---|
instrument_name | string | C-USDC-BTC-2JUN23-26000-P | Name of this instrument. It is unique. |
strike_price | int | 26000 | Price to strike |
expiration_date | string | 2023-06-02T16:00:00+08:00 | Date of expiration with format of rfc3339 |
expiration_date_str | string | 2023-06-02 | Date of expiration with simple date info |
expiration_timestamp | int | 1685692800 | Timestamp of expiration |
option_type | string | PUT | Type of this option. CALL or PUT . |
delivery_type | string | CASH | Delivery mode of this option. CASH or PHYSICAL |
quote_currency | string | USDC | The quote currency is the second currency listed in a currency pair. Like BTC_pUSD, the pUSD is the quote currency. |
base_currency | string | BTC | The base currency is the first currency listed in a currency pair. Like BTC_pUSD, the BTC is the base currency. |
created_at | string | 2023-06-02T16:00:00+08:00 | The created time of this option |
updated_at | string | 2023-06-02T16:00:00+08:00 | The updated time of this option |
bids | []object | Bids for this option instrument | |
› side | string | BUY | Trade side of this liquidity entry. BUY or SELL |
› price | string | "0.1" | Price of this liquidity |
› amount | string | "0.1" | Amount of this liquidity |
› funds | string | "0.01" | Funds of this liquidity. funds = price * amount |
asks | []object | Asks for this option instrument | |
› side | string | BUY | Trade side of this liquidity entry. BUY or SELL . |
› price | string | "0.1" | Price of this liquidity |
› amount | string | "0.1" | Amount of this liquidity |
› funds | string | "0.01" | Funds of this liquidity. funds = price * amount |
ask_interest | float | 0.1 | ask side interest(premium) for 1 option |
bid_interest | float | 0.1 | bid side interest(premium) for 1 option |
User
Get User
POST /api/v1/user/me
Description
Get logined user infomation.
Authorization required
true
Request
Empty
Response
Get User Example Response
{
"code": 0,
"data": {
"mixin_uid": "154cdf75-c5ab-49d7-9efd-67f757425a81",
"mixin_id": "36495654",
"nickname": "Alvin",
"avatar": "https://mixin-images.zeromesh.net/jND7xqKK_OsypW4qxB3GTH5vzJebi5JGNWWm20gpXnj55uFFZI5ADJK1aAWq2UVfQlKQP9QnO4IrHCo3jHKemVlASTCAuP7GVS9K=s256",
"type": "MIXIN",
"email": "**@gmail.com",
"phone": "",
"app_mode": 0,
"delivery_type": 0,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00"
},
"msg": "success"
}
Field | Type | Description |
---|---|---|
mixin_uid | string | UID from Mixin network |
mixin_id | string | ID from Mixin network |
nickname | string | The nickname for this user |
avatar | string | The avatar url for this user |
type | string | The type of this user.It is a enum value.It always be MIXIN now |
string | The email address for this uer | |
phone | string | The phone number for this user |
app_mode | int | The app mode of this user |
delivery_type | int | The delivery type of this user. |
created_at | string | The created time of this user |
updated_at | string | The updated time of this user |
Order
Create Order
There are two APIs that need to be called to create an order. First, initiate a multiple request through our API. And second, use the returned information to launch a multisig transfer through Mixin Network.
We provide a wrapped function in SDK, you can use it directly.
Step 1: Generate Order Multisig Request
Ask our backend to generate a Multisig Request by your submitted information.
POST /api/v1/order-request/multisig
Authorization required
true
Request
Parameter | Type | Required | Description |
---|---|---|---|
side | string | true | The side of this order. ASK or BID . |
price | string | true | The price of this order, 4 decimal places for CALL option, 2 decimal places for PUT option |
amount | string | true | The amount of this order, for BTC option, min amount is 0.1, 1 decimal places expected, for ETH option, min amount is 1, 0 decimal places expected |
type | string | true | The type of this order. only support LIMIT (or L ) now |
instrument_name | string | true | The name of instrument that order referenced |
Response
Get Order Multisig Example Response
{
"code": 0,
"data": {
"type": "payment",
"trace_id": "a113f263-a1df-477c-9df2-d61c0734634f",
"asset_id": "bdec3118-656a-3ec7-a397-6e2637a1d7bf",
"amount": "7350",
"threshold": 2,
"receivers": [
"b4bb244f-f057-4212-a2bc-9465e689aa2b",
"5faa9be8-2645-4fe0-8121-70b74e5173f8",
"7da030dc-e6c0-4300-9e2e-0a5bfecdbce2"
],
"memo": "jqFBozIuMaJBQ6xDUkVBVEVfT1JERVKhVGgolFDpFVTREOhU6FBoVShTaJUQ9oAJGExMTNmMjYzLWExZGYtNDc3Yy05ZGYyLWQ2MWMwNzM0NjM0ZqFVoA==",
"created_at": "2023-05-26T03:23:54.180980869Z",
"status": "pending",
"code_id": "f725804c-abc5-4730-9240-24658c70ba52"
},
"msg": "success"
}
Field | Type | Description |
---|---|---|
type | string | The type of option in this multisig transfer request related |
asset_id | string | The id of asset in this multisig transfer request |
amount | string | The amount of this multisig transfer request |
trace_id | string | The trace of this multisig transfer request |
memo | string | The memo of this multisig transfer request |
opponent_multisig | object | The opponent info of this multisig transfer request |
› receivers | []string | The receivers of this multisig transfer |
› threshold | int | The threshold of this multisig transfer |
Step 2: Launch Multisig Transfer In Mixin Netwrok
Call Mixin API to initiate a transfer with the data from step 1, and finally complete the creation of the order.
Transfer to a Multi-signature Address
Cancel Order
POST /api/v1/order/:id/cancel
Description
Cancel order with order id
Authorization required
true
Request
Empty
Response
Cancel Order Example Response
{
"code": 0,
"data": {},
"msg": "success"
}
Returns an empty object wrapped in general response
Get Orders
GET /api/v1/orders
Description
Get order list with requested parameters
Authorization required
true
Request
Parameter | Type | Required | Enum | Description |
---|---|---|---|---|
status | string | true | open / closed |
The order status that you want to get. open or closed , open include orders that orderStatus = 10, closed include orders that orderStatus > 10 (Canceling:35 Cancelled:40, Filled: 50) |
order | string | false | ASC / DESC |
The sort order that you want to get. ASC or DESC . |
instrument | string | false | Filter orders by a specific instrument name | |
current | int | false | The current page number of order list | |
size | int | false | The size of per page |
Response
Get Orders Example Response
{
"code": 0,
"data": {
"pages": 0,
"records": [
{
"order_id": "a4677cb7-457d-41c5-b756-b7a4b717d81d",
"order_num": 1425064994763968512,
"user_id": "f9196699-923d-4b9e-b639-10b913bfd7b7",
"side": "BID",
"order_type": "LIMIT",
"price": "100.00",
"remaining_amount": "0",
"filled_amount": "10",
"remaining_funds": "40",
"filled_funds": "10",
"margin": "4000",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"option_type": "PUT",
"delivery_type": "PHYSICAL",
"strike_price": "40000",
"expiration_timestampe": 1628669700,
"expiration_date": "2021-11-12T16:00:08+08:00",
"quote_currency": "USDT",
"base_currency": "BTC",
"order_status": 50,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00",
"trade_list": [
{
"trade_id": "f0a40d84-e25a-30c9-8793-55a02fde3306",
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"liquidity": "TAKER",
"bid_order_id": "154ad904-8095-4f9f-89cb-529a223e5d49",
"ask_order_id": "18da50f2-1419-4689-8732-434a98ab2b41",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"side": "ASK",
"price": "100",
"amount": "0.1",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"fee_amount": "0",
"fee_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"underlying_price": "",
"status": 10,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00"
}
],
"order_num_string": "1425021902073630720"
}
],
"total": 1
},
"msg": "success"
}
Field | Type | Description |
---|---|---|
order_id | string | ID of this order. |
order_num | string | Unique identify for a single order object |
user_id | string | ID of user who owns this order. |
side | string | Side of this order. BUY or SELL |
order_type | string | Type of this order. Our system only support LIMIT order now. LIMIT |
price | string | Price of this order.It must not be empty if order type is LIMIT |
remaining_amount | string | The quantity remaining in the order. The value of 0 means that the order has been filled. |
filled_amount | string | The quantity of the order that has been completed. |
remaining_funds | string | The funds remaining in the order. The value of 0 means that order order has been filled. |
filled_funds | string | The funds of the order that has been completed. The value of funds from request means that the order has been fiiled completly |
margin | string | The margin of order |
quote_asset_id | string | The id of quote asset |
base_asset_id | string | The id of base asset |
instrument_name | string | The instrument_name refers to option |
option_type | string | The type of option related to this order. CALL or PUT |
delivery_type | string | The delivery type of option related to this order. CASH or PHYSICAL |
strike_price | string | The strike price of option related to this order |
expiration_timestamp | string | The expiration timestamp of option related to this order |
expiration_date | string | The expiration date of option related to this order |
quote_currency | string | The quote currency is the second currency listed in a currency pair. Like BTC_pUSD, the pUSD is the quote currency |
base_currency | string | The base currency is the first currency listed in a currency pair. Like BTC_pUSD, the BTC is the base currency. |
order_status | int | The status of this order. Open:10 Canceling:35 Cancelled:40 Filled:50 |
created_at | string | The created time of this order |
updated_at | string | The updated time of this order |
order_num_string | string | The order num string |
trade_list | []object | |
› trade_id | string | The ID of this trade |
› user_id | string | The id of user who owns this trade |
› liquidity | string | The liquidity of this trade |
› bid_order_id | string | The id of bid order for this trade |
› ask_order_id | string | The id ask order for this trade |
› quote_asset_id | string | The id of quote asset for this trade |
› base_asset_id | string | The id of base asset for this trade |
› side | string | The side of this trade. ASK or BID |
› price | string | The price of this trade |
› amount | string | The amount of this trade |
› instrument_name | string | The instrument_name of this trade |
› fee_amount | string | The fee_amount of this trade |
› fee_asset_id | string | The fee_asset_id of this trade |
› underlying_price | string | The underlying price of this trade |
› status | int | The status of this trade. Open:10 Closed:20 |
› created_at | string | The created time of this trade |
› updated_at | string | The updated time of this trade |
Get Order By ID
GET /api/v1/order/:id
Description
Get the order by id
Authorization required
true
Request
Empty
Response
Get Order By ID Example Response
{
"code": 0,
"data": {
"order_id": "a4677cb7-457d-41c5-b756-b7a4b717d81d",
"order_num": 1425064994763968512,
"user_id": "f9196699-923d-4b9e-b639-10b913bfd7b7",
"side": "BID",
"order_type": "LIMIT",
"price": "100.00",
"remaining_amount": "0",
"filled_amount": "10",
"remaining_funds": "40",
"filled_funds": "10",
"margin": "4000",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"option_type": "PUT",
"delivery_type": "PHYSICAL",
"strike_price": "40000",
"expiration_timestampe": 1628669700,
"expiration_date": "2021-11-12T16:00:08+08:00",
"quote_currency": "USDT",
"base_currency": "BTC",
"order_status": 50,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00",
"trade_list": [
{
"trade_id": "f0a40d84-e25a-30c9-8793-55a02fde3306",
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"liquidity": "TAKER",
"bid_order_id": "154ad904-8095-4f9f-89cb-529a223e5d49",
"ask_order_id": "18da50f2-1419-4689-8732-434a98ab2b41",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"side": "ASK",
"price": "100",
"amount": "0.1",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"fee_amount": "0",
"fee_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"underlying_price": "",
"status": 10,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00"
}
],
"order_num_string": "1425021902073630720"
}
},
"msg": "success"
}
Returns the order that wrapped in General Response. You can view structure details from the previous API
Position
Get Positions
GET /api/v1/positions
Description
Get list of position with requested paremeters
Authorization required
true
Request
Parameter | Type | Required | Enum | Desciprtion |
---|---|---|---|---|
status | string | false | open /closed |
The status of this position you want to get. open include user positions that not be delivered (position.settlement = 0), closed include positions that was delivered (position.settlement = 1) |
order | string | false | asc /desc |
The order of position list.ASC or DESC . |
Response
Get Position List Example Response
{
"code": 0,
"data": {
"pages": 0,
"records": [
{
"position_id": "407c3095-3189-3f9b-8239-5e71f0843fd7",
"position_num": 1425021902673416192,
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"side": "ZERO", Developers have to use Mixin token to exchange OptionDance token with us. Mixin token that we used to recognize user identification is obtained from Mixin network. Please refer to this document Mixin API Authorization
"type": "PUT",
"size": 10.0,
"funds": 1000.0,
"margin": 0.0,
"exercised_size": 10.0,
"average_price": 0.0,
"strike_price": "38000",
"option_type": "PUT",
"delivery_type": "PHYSICAL",
"quote_currency": "pUSD",
"base_currency": "BTC",
"expiration_date": "2021-11-12T16:00:08+08:00",
"expiration_timestamp": 1628669700,
"status": 30,
"settlement": 1,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00",
"position_num_string": "1425090813360082944",
"trade_list": [
{
"trade_id": "f0a40d84-e25a-30c9-8793-55a02fde3306",
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"liquidity": "TAKER",
"bid_order_id": "154ad904-8095-4f9f-89cb-529a223e5d49",
"ask_order_id": "18da50f2-1419-4689-8732-434a98ab2b41",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"side": "ASK",
"price": "100",
"amount": "0.1",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"fee_amount": "0",
"fee_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"underlying_price": "",
"status": 10,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00"
}
],
"initial_funds": "0.00000000"
}
],
"total": 1
},
"msg": "success"
}
Returns the list of position wrapped in the Pagination Response
Field | Type | Description |
---|---|---|
position_id | string | Unique identity for a position instance. It used to locate storage tiers |
position_num | int | Used to locate storage tiers |
user_id | string | Unique identify for an user instance |
instrument_name | string | The option that this position related |
side | string | Position side. ASK or BID |
type | string | The type option that this position related. CALL or PUT |
size | float | The size of this position |
funds | float | The funds of this position. Negative numbers indicate short positions |
margin | float | The margin status of this position. |
exercised_size | float | The exercised size of this position. It will be 0 if there is no exercise. |
average_price | float | The average price of this position. |
strike_price | string | The type of option that this position related |
delivery_type | string | The delivery type of option that this position related. CASH or PHYSICAL . |
quote_currency | string | The quote currency is the second currency listed in a currency pair. Like BTC_pUSD, the pUSD is the quote currency. |
base_currency | string | The base currency is the first currency listed in a currency pair. Like BTC_pUSD, the BTC is the base currency. |
expiration_date | string | The expiration date of option that this position related |
expiration_timestamp | int | The expiration timestamp of option that this position related |
status | int | The status of this position. NotExercised:10 ExerciseRequested:20 Exercised:30 |
settlement | int | The settlement status of this position. It will be 1 if the position has been settlement. |
created_at | string | The created time of this position |
updated_at | string | The updated time of this position |
position_num_string | string | The string type for position num |
initial_funds | int | The initial funds of this position. It is calculated by its related trade list. |
exercisable | bool | The exercisable information of this position. Since all options are European, they are only related to time |
expiry | bool | Whether this position has expired |
trade_list | object | The trade list of this position |
› trade_id | string | The ID of this trade |
› user_id | string | The id of user who owns this trade |
› liquidity | string | The liquidity of this trade |
› bid_order_id | string | The id of bid order for this trade |
› ask_order_id | string | The id ask order for this trade |
› quote_asset_id | string | The id of quote asset for this trade |
› base_asset_id | string | The id of base asset for this trade |
› side | string | The side of this trade |
› price | string | The price of this trade |
› amount | string | The amount of this trade |
› instrument_name | string | The instrument_name of this trade |
› fee_amount | string | The fee_amount of this trade |
› fee_asset_id | string | The fee_asset_id of this trade |
› underlying_price | string | The underlying price of this trade |
› status | string | The status of this trade. Open:10 Closed:20 |
› created_at | string | The created time of this trade |
› updated_at | string | The updated time of this trade |
Get Position By ID
GET /api/v1/position/:id
Description
Get position by its id
Authorization required
true
Request
Empty
Response
Get Position Example Response
{
"code": 0,
"data": {
"position_id": "61634c36-4c51-31d3-bcec-8e67f4e81c4a",
"position_num": 1425111080526417920,
"user_id": "154cdf75-c5ab-49d7-9efd-67f757425a81",
"instrument_name": "P-pUSD-BTC-11AUG21-36000-P",
"side": "BID",
"type": "PUT",
"size": 1.2,
"funds": -80,
"margin": 0,
"exercised_size": 0,
"average_price": 0,
"strike_price": "36000",
"option_type": "PUT",
"delivery_type": "PHYSICAL",
"quote_currency": "pUSD",
"base_currency": "BTC",
"expiration_date": "2021-08-11T16:15:00+08:00",
"expiration_timestamp": 1628669700,
"status": 10,
"settlement": 1,
"created_at": "2021-08-10T23:05:34+08:00",
"updated_at": "2021-08-11T16:29:32+08:00",
"position_num_string": "1425111080526417920",
"trade_list": [
{
"trade_id": "f0a40d84-e25a-30c9-8793-55a02fde3306",
"user_id": "019308a5-e1a9-427c-af2a-e05093beedaa",
"liquidity": "TAKER",
"bid_order_id": "154ad904-8095-4f9f-89cb-529a223e5d49",
"ask_order_id": "18da50f2-1419-4689-8732-434a98ab2b41",
"quote_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"base_asset_id": "dcde18b9-f015-326f-b8b1-5b820a060e44",
"side": "ASK",
"price": "100",
"amount": "0.1",
"instrument_name": "P-pUSD-BTC-11AUG21-40000-P",
"fee_amount": "0",
"fee_asset_id": "965e5c6e-434c-3fa9-b780-c50f43cd955c",
"underlying_price": "",
"status": 10,
"created_at": "2021-11-12T16:00:08+08:00",
"updated_at": "2021-11-12T16:00:08+08:00"
}
],
"initial_funds": 0
},
"msg": "success"
}
Returns the position that wrapped in the General Response. You can view the structure details from the previous API
System
Get MTG Group Info
GET /api/v1/system/mtg-group
Description
Get MTG group info in our system.
Authorization required
true
Request
Empty
Response
Get MTG Group Info Example Response
{
"code": 0,
"data": {
"members": [
"b4bb244f-f057-4212-a2bc-9465e689aa2b",
"5faa9be8-2645-4fe0-8121-70b74e5173f8",
"7da030dc-e6c0-4300-9e2e-0a5bfecdbce2"
],
"threshold": 2
},
"msg": "success"
}
Field | Type | Description |
---|---|---|
members | []string | The members of this MTG group |
threshold | 2 | The threshold of this MTG group |
Error Handling
We use integer field code in the response JSON to deliver error status of API execution. If the API returns an error, developers can view more detail from the msg field
code | Description |
---|---|
0 | It is not exactly a error code. It means the API executed successfully. |
40001 | It is not exactly a error code. It means the dapp token maybe invalid |
50000 | Unknown type error. If you encounter this error code, maybe you should contact us. |