backend API v1 Trade - CAFECA-IO/TideBitEx Wiki

統一的Response格式

{
  "powerby": "TideWallet API v1.0.0",
  "success": true,
  "code": "00000000",
  "message": "Human-readable medium",
  "payload": {}
}

postPlaceOrder

只有帳戶有足夠資金才能下單

HTTP Request

POST /api/v1/trade/order

Request

Request Example

買入 限價單

POST /api/v1/trade/order
body
{
    "instId":"ETH-USDT",
    "tdMode":"cash",
    "side":"buy",
    "ordType":"limit",
    "px":"2.15",
    "sz":"2"
}

賣出 市價單立即成交並取消剩餘

POST /api/v1/trade/order
body
{
    "instId":"ETH-USDT",
    "tdMode":"cash",
    "side":"sell",
    "ordType":"optimal_limit_ioc",
    "sz":"2"
}

Request Parameters

Parameter Type Required Description
instId String Yes 產品Id,e.g. ETH-USDT
tdMode String Yes 交易模式保證金模式: isolated: 逐倉, cross: 全倉非保證金模式: cash
ccy String No 保證金幣種只適用於cross交易
side String Yes 訂單方向buysell
ordType String Yes 訂單模式limit: 限價單optimal_limit_ioc: 市價單立即成交並取消剩餘(僅限於future(交割合約)swap(永續合約))
sz String Yes 委託數量
px String Optional 委託價格僅適用於limit
tgtCcy String No 市價單委託數量的類型只適用於SPOT(幣幣)訂單base_ccy: 交易貨幣quote_ccy: 計價貨幣

Response

Response Example

{
    "powerby": "TideBitEx api 1.0.0",
    "success": true,
    "code": "00000000",
    "message": "postPlaceOrder",
    "payload": [
        {
            "clOrdId": "377bd372412fSCDE",
            "ordId": "401784794253770752",
            "sCode": "0",
            "sMsg": "",
            "tag": "377bd372412fSCDE"
        }
    ]
}

Response Parameters

Parameter Type Description
ordId String 訂單Id
clOrdId String 自定義訂單Id
tag String 訂單標籤
sCode String 事件執行成果,成功為'0'
sMsg String 事件執行失敗的訊息

getOrderList

取得目前帳戶未成交訂單列表

HTTP Request

GET /api/v1/trade/orders-pending

Request

Request Example

GET /api/v1/trade/orders-pending?ordType=market,optimal_limit_ioc&instType=SPOT

Request Parameters

Parameter Type Required Description
instType String No 產品類型SPOT: 幣幣SWAP: 永續合約
instId String No 產品Id,e.g. ETH-USD
ordType String No 訂單模式limit: 限價單optimal_limit_ioc: 市價單立即成交並取消剩餘(僅限於future(交割合約)swap(永續合約))
state String No 訂單狀態live: 等待成交partially_filled: 部分成交
after String No 回傳更舊的內容,填入的內容為ordId
before String No 回傳更新的內容,填入的內容為ordId
limit String No 回傳數量,預設為100

Response

Response Example

{
    "powerby": "TideBitEx api 1.0.0",
    "success": true,
    "code": "00000000",
    "message": "getOrderList",
    "payload": [
        {
            "accFillSz": "0",
            "avgPx": "",
            "cTime": "1642141839922",
            "category": "normal",
            "ccy": "",
            "clOrdId": "377bd372412fSCDE",
            "fee": "0",
            "feeCcy": "USDT",
            "fillPx": "",
            "fillSz": "0",
            "fillTime": "",
            "instId": "ETH-USDT",
            "instType": "SPOT",
            "lever": "",
            "ordId": "402107253066711042",
            "ordType": "limit",
            "pnl": "0",
            "posSide": "net",
            "px": "3500",
            "rebate": "0",
            "rebateCcy": "ETH",
            "side": "sell",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "",
            "source": "",
            "state": "live",
            "sz": "0.001",
            "tag": "",
            "tdMode": "cash",
            "tgtCcy": "",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "",
            "tradeId": "",
            "uTime": "1642141839922"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String 產品類型
instId String 產品Id
tgtCcy String 市價單委託數量的類型base_ccy: 交易貨幣quote_ccy: 計價貨幣
ordId String 訂單Id
clOrdId String 客戶自定義訂單Id
tag String 訂單標籤
px String 委託價格
sz String 委託數量
pnl String 收益
ordType String 訂單模式limit: 限價單optimal_limit_ioc: 市價單立即成交並取消剩餘(僅限於future(交割合約)swap(永續合約))
side String 訂單方向
tdMode String 交易模式
accFillSz String 累積成交數量
fillPx String 最新成交價
fillSz String 最新成交量
fillTime String 最新成交時間
tradeId String 最新成交Id
avgPx String 平均成交價
state String 訂單狀態live: 等待成交partially_filled: 部分成交
tpTriggerPx String 止盈觸發價
tpTriggerPxType String 止盈觸發價類型last: 最新價格mark: 標記價格
slTriggerPx String 止損觸發價
slTriggerPxType String 止損觸發價類型last: 最新價格mark: 標記價格
slOrdPx String 止損委託價
feeCcy String 手續費幣種
fee String 手續費,為負數
utime String 訂單更新時間Unix timestamp milliseconds
ctime String 訂單建立時間Unix timestamp milliseconds

getOrderHistory

取得目前帳戶7天內已完成的訂單列表

HTTP Request

GET /api/v1/trade/orders-history

Request

Request Example

GET /api/v1/trade/orders-history?ordType=market,optimal_limit_ioc&instType=SPOT

Request Parameters

Parameter Type Required Description
instType String Yes 產品類型SPOT: 幣幣SWAP: 永續合約
instId String No 產品Id,e.g. ETH-USD
ordType String No 訂單模式limit: 限價單optimal_limit_ioc: 市價單立即成交並取消剩餘(僅限於future(交割合約)swap(永續合約))
state String No 訂單狀態canceled: 撤單成功filled: 完全成交
after String No 回傳更舊的內容,填入的內容為ordId
before String No 回傳更新的內容,填入的內容為ordId
limit String No 回傳數量,預設為100

Response

Response Example

{
    "powerby": "TideBitEx api 1.0.0",
    "success": true,
    "code": "00000000",
    "message": "getOrderHistory",
    "payload": [
        {
            "accFillSz": "0.001",
            "avgPx": "3366.84",
            "cTime": "1642070931283",
            "category": "normal",
            "ccy": "",
            "clOrdId": "377bd372412fSCDE",
            "fee": "-0.00336684",
            "feeCcy": "USDT",
            "fillPx": "3366.84",
            "fillSz": "0.001",
            "fillTime": "1642070931287",
            "instId": "ETH-USDT",
            "instType": "SPOT",
            "lever": "",
            "ordId": "401809840678518784",
            "ordType": "limit",
            "pnl": "0",
            "posSide": "net",
            "px": "3352",
            "rebate": "0",
            "rebateCcy": "ETH",
            "side": "sell",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "",
            "source": "",
            "state": "filled",
            "sz": "0.001",
            "tag": "377bd372412fSCDE",
            "tdMode": "cash",
            "tgtCcy": "",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "",
            "tradeId": "165739350",
            "uTime": "1642070932303"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String 產品類型
instId String 產品Id
tgtCcy String 市價單委託數量的類型base_ccy: 交易貨幣quote_ccy: 計價貨幣
ordId String 訂單Id
clOrdId String 客戶自定義訂單Id
tag String 訂單標籤
px String 委託價格
sz String 委託數量
pnl String 收益
ordType String 訂單模式limit: 限價單optimal_limit_ioc: 市價單立即成交並取消剩餘(僅限於future(交割合約)swap(永續合約))
side String 訂單方向
tdMode String 交易模式
accFillSz String 累積成交數量
fillPx String 最新成交價
fillSz String 最新成交量
fillTime String 最新成交時間
tradeId String 最新成交Id
avgPx String 平均成交價
state String 訂單狀態canceled: 撤單成功filled: 完全成交
tpTriggerPx String 止盈觸發價
tpTriggerPxType String 止盈觸發價類型last: 最新價格mark: 標記價格
slTriggerPx String 止損觸發價
slTriggerPxType String 止損觸發價類型last: 最新價格mark: 標記價格
slOrdPx String 止損委託價
feeCcy String 手續費幣種
fee String 手續費,為負數
utime String 訂單更新時間Unix timestamp milliseconds
ctime String 訂單建立時間Unix timestamp milliseconds