-
Notifications
You must be signed in to change notification settings - Fork 0
API v1.0.0 bolt‐transactions
Tiny_Murky edited this page Mar 29, 2024
·
10 revisions
- description: list all CFD
GET /api/v1/bolt-transactions/history
name | type | description | required | default |
---|---|---|---|---|
Dewt | string | Decentralized Web Token(DeWT) 是我們專為 TideBit-DeFi 設計的去中心化認證機制,為用戶登入時簽名的內容加上用戶簽名的結果進行 rlp 編碼 | true | -- |
name | type | description | required | default |
---|---|---|---|---|
orderType | string | bolt-transactions Type,orderType must be one of the following values: "CFD", "DEPOSIT", "WITHDRAW", "SPOT", return all types if not provided | false | undefined |
begin | timestamp | API will return bolt-transactions which was after this timestamp, timestamp present by second is recommended, if timestamp is precent by millisecond, it will be transfer to second | false | 0 (1970/1/1 0:0:0) |
end | timestamp | API will return bolt-transactions which was before this timestamp, timestamp present by second is recommended, if timestamp is precent by millisecond, it will be transfer to second | false | Infinity |
limit | integer | maximum length of bolt-transactions data array. maximum: Infinity, minimum: 0. | false | 10 |
page | integer | offset will be calculated by page and limit, page start with 1,bolt-transactions will present from (page-1) * limit
|
false | 1 |
asc | integer | bolt-transactions will be sort by ascent order if any string was provided, otherwise use default(sorted by Descent) | false | undefined |
GET /api/v1/bolt-transactions/history?orderType=CFD&begin=1701612407&end=1711622407&limit=10&page=1&asc=true
name | type | description |
---|---|---|
success | boolean | request 成功或失敗 |
code | string | response code |
data |
IAcceptedOrder[] | []
|
response data |
成功的回傳
GET /api/v1/bolt-transactions/history?begin=1701612407&end=1711622407&orderType=CFD&limit=1&page=1&asc=true
{
"success": true,
"code": "00000000",
"data": [
{
"id": "0xa5baa3f32e4ac12c3af62c437850ce90",
"userAddress": "0x7903d1813b1f2254909FE975155a648F4Db0B7cE",
"orderType": "CFD",
"sequence": 951489,
"txhash": "0xa5baa3f32e4ac12c3af62c437850ce90",
"applyData": {
"orderType": "CFD",
"operation": "CREATE",
"instId": "ETH-USDT",
"quotation": {
"instId": "ETH-USDT",
"targetAsset": "ETH",
"unitAsset": "USDT",
"typeOfPosition": "BUY",
"price": "2185.73",
"spotPrice": "2171.19",
"spreadFee": "14.54",
"deadline": 1704684529,
"signature": "0x43e2698fe9260a5b46d838e63ca9694b"
},
"typeOfPosition": "BUY",
"price": "2185.73",
"amount": "0.01",
"targetAsset": "ETH",
"unitAsset": "USDT",
"margin": {
"asset": "USDT",
"amount": "4.37"
},
"leverage": 5,
"liquidationPrice": "1967.15",
"liquidationTime": 1705289329,
"guaranteedStop": false,
"guaranteedStopFee": "0",
"createTimestamp": 1704684472,
"fee": "0",
"outerFee": "0"
},
"receipt": {
"txhash": "0xa5baa3f32e4ac12c3af62c437850ce90",
"sequence": 951489,
"balanceSnapshot": [
{
"id": "659b6acb5a28804ce46eeb07",
"userAddress": "0x7903d1813b1f2254909FE975155a648F4Db0B7cE",
"currency": "USDT",
"available": "95.63",
"locked": "4.37",
"blockNumber": 0,
"createdAt": 1704684235,
"updatedAt": 1704684258
}
],
"orderSnapshot": {
"orderType": "CFD",
"id": "0x15de75ce81a524d0159b756bf04dbff8",
"txhash": "0xa5baa3f32e4ac12c3af62c437850ce90",
"orderStatus": "PROCESSING",
"state": "OPENING",
"instId": "ETH-USDT",
"userAddress": "0x7903d1813b1f2254909FE975155a648F4Db0B7cE",
"targetAsset": "ETH",
"unitAsset": "USDT",
"margin": {
"amount": "4.37",
"asset": "USDT"
},
"openPrice": "2185.73",
"openSpotPrice": "2171.19",
"openSpreadFee": "14.54",
"amount": "0.01",
"fee": "0",
"outerFee": "0",
"typeOfPosition": "BUY",
"leverage": 5,
"guaranteedStop": false,
"liquidationPrice": "1967.15",
"liquidationTime": 1705289329,
"share": false,
"updatedTimestamp": 1704684479,
"createTimestamp": 1704684479,
"guaranteedStopFee": "0",
"pnl": {
"type": "EQUAL"
}
}
},
"userSignature": "0xbfd8735c4500eb526a748de142fa7548ddc5de49f203b23459e7997f2bd9a4f45a5b386234612d10918621c76ecd84340db095c9ec683650f28ce39c1a7d2f0e1c",
"droneSignature": "0x939f4ae134049393a4dc9dee5d8ee048",
"locutusSignature": "0x216bee755d465191ef2a69877eb19e0c",
"createTimestamp": 1704684479,
"updateTimestamp": 1704684479
}
]
}
失敗的回傳
- Header沒有加上
deWT
{
"success": false,
"code": "40430003",
"message": "did not receive deWT. ",
"reason": "ERROR_MESSAGE.DEWT_IS_NOT_LEGIT",
"data": null
}
- orderType 輸入
"CFD"
,"DEPOSIT"
,"WITHDRAW"
,"SPOT"
以外的值
GET /api/v1/bolt-transactions/history?orderType=aaa
{
"statusCode": 400,
"message": [
"orderType must be one of the following values:\"CFD\", \"DEPOSIT\", \"WITHDRAW\", \"SPOT\""
],
"error": "Bad Request"
}
- begin, end, limit, page輸入非數字
GET /api/v1/bolt-transactions/history?begin=1701612407a&end=1711622407a&limit=1a&page=1a
{
"statusCode": 400,
"message": [
"begin must be a positive number",
"end must be a positive number",
"limit must be a positive number",
"page must be a positive number"
],
"error": "Bad Request"
}