跳至主要内容

交易日誌

整個賬戶統一錢包裡的交易日誌, 支持最多查詢過去2年的數據

HTTP 請求

GET /v5/account/transaction-log

請求參數

參數是否必需類型說明
accountTypefalsestring錢包類型. 僅支持UNIFIED
categoryfalsestring交易產品類型
  • 統一帳戶2.0: spot,linear,option,inverse
  • 統一帳戶1.0: spot,linear,option
  • currencyfalsestring貨幣
    baseCoinfalsestring交易幣種. 例如: BTCUSDT 的 baseCoin 是 BTC
    typefalsestring交易日誌的類型
    startTimefalseinteger開始時間戳 (毫秒)
    • startTime 和 endTime都不傳入, 則默認返回最近7天的數據
    • startTime 和 endTime都傳入的話, 則確保endTime - startTime 7天
    • 若只傳startTime,則查詢startTime和startTime+7天的數據
    • 若只傳endTime,則查詢endTime-7天和endTime的數據
    endTimefalseinteger結束時間戳 (毫秒)
    limitfalseinteger每頁數量, 最大50. 默認每頁20條
    cursorfalsestring游標,用於翻頁

    響應參數

    參數類型說明
    listarrayObject
    > idstring唯一id
    > symbolstring合約名稱
    > categorystring產品類型
    > sidestring方向. Buy,Sell,None
    > transactionTimestring交易時間戳(毫秒)
    > typestring類型
    > qtystring數量.
  • 現貨: 正的qty表示該幣數量增加, 負的qty表示該幣數量減少
  • 期貨: 對於成交的流水來說, 這裡的qty表示每筆成交的數量, 不帶方向
  • > sizestring倉位. 特別地, 對於成交的流水來說, 這裡的size表示成交後的倉位大小, 帶有方向, 比如空倉, 則有"-"
    > currencystringUSDC、USDT、BTC、ETH
    > tradePricestring交易價格
    > fundingstring資金費用. 正數表示用戶收取xx資金費, 負數表示用戶支出xx資金費
  • 對於USDC永續合約, 由於資金費結算週期和8小時結算的週期一致, 所以您會看到資金費和8小時結算的數據存在於同一條流水中(type=SETTLEMENT), 您可以通過funding來確定資金費用, 以及cashFlow來確定8小時平倉盈虧
  • > feestring手續費, 正數表示用戶付出xx手續費, 負數表示返佣
    > cashFlowstring現金流, 比如平倉時的未平盈虧結算, USDC永續和交割合約的8小時結算, 以及劃入劃出等. 該值不包含任何手續費或者資金費
    > changestring變更 = cashFlow + funding - fee
    > cashBalancestring餘額(當前幣種), 資金流發生後的該幣種的錢包餘額
    > feeRatestring
    • 對於type=TRADE, 則表示交易手續費率
    • 對於type=SETTLEMENT, 則表示資金費率. 當side=Buy, feeRate=市場結算費率; 當side=Sell, feeRate=-市場結算費率
    > bonusChangestring體驗金的變化
    > tradeIdstring交易id
    > orderIdstring訂單id
    > orderLinkIdstring用戶自定義訂單id
    nextPageCursorstring游標,用於翻頁

    請求示例

    GET /v5/account/transaction-log?accountType=UNIFIED&category=linear&currency=USDT HTTP/1.1
    Host: api-testnet.bybit.com
    X-BAPI-SIGN: XXXXX
    X-BAPI-API-KEY: XXXXX
    X-BAPI-TIMESTAMP: 1672132480085
    X-BAPI-RECV-WINDOW: 5000

    響應示例

    {
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    "nextPageCursor": "21963%3A1%2C14954%3A1",
    "list": [
    {
    "id": "592324_XRPUSDT_161440249321",
    "symbol": "XRPUSDT",
    "side": "Buy",
    "funding": "-0.003676",
    "orderLinkId": "",
    "orderId": "1672128000-8-592324-1-2",
    "fee": "0.00000000",
    "change": "-0.003676",
    "cashFlow": "0",
    "transactionTime": "1672128000000",
    "type": "SETTLEMENT",
    "feeRate": "0.0001",
    "bonusChange": "",
    "size": "100",
    "qty": "100",
    "cashBalance": "5086.55825002",
    "currency": "USDT",
    "category": "linear",
    "tradePrice": "0.3676",
    "tradeId": "534c0003-4bf7-486f-aa02-78cee36825e4"
    },
    {
    "id": "592324_XRPUSDT_161440249321",
    "symbol": "XRPUSDT",
    "side": "Buy",
    "funding": "",
    "orderLinkId": "linear-order",
    "orderId": "592b7e41-78fd-42e2-9aa3-91e1835ef3e1",
    "fee": "0.01908720",
    "change": "-0.0190872",
    "cashFlow": "0",
    "transactionTime": "1672121182224",
    "type": "TRADE",
    "feeRate": "0.0006",
    "bonusChange": "-0.1430544",
    "size": "100",
    "qty": "88",
    "cashBalance": "5086.56192602",
    "currency": "USDT",
    "category": "linear",
    "tradePrice": "0.3615",
    "tradeId": "5184f079-88ec-54c7-8774-5173cafd2b4e"
    },
    {
    "id": "592324_XRPUSDT_161407743011",
    "symbol": "XRPUSDT",
    "side": "Buy",
    "funding": "",
    "orderLinkId": "linear-order",
    "orderId": "592b7e41-78fd-42e2-9aa3-91e1835ef3e1",
    "fee": "0.00260280",
    "change": "-0.0026028",
    "cashFlow": "0",
    "transactionTime": "1672121182224",
    "type": "TRADE",
    "feeRate": "0.0006",
    "bonusChange": "",
    "size": "12",
    "qty": "12",
    "cashBalance": "5086.58101322",
    "currency": "USDT",
    "category": "linear",
    "tradePrice": "0.3615",
    "tradeId": "8569c10f-5061-5891-81c4-a54929847eb3"
    }
    ]
    },
    "retExtInfo": {},
    "time": 1672132481405
    }