概述
Deribit API 允许用户使用以下方法检索历史交易和订单记录 historical 参数。
虽然最近的记录 (30 分钟 用于订购和 24 小时 对于交易)可以在没有此参数的情况下进行访问,它们只能暂时存储并最终删除。在此期间之后,只能通过历史参数获得记录。
保留期:
-
最近的订单: 可用于 30 分钟 在移除之前。
-
最近的交易: 可用于 24 小时 在移除之前。
-
历史记录: 无限期坚持。
支持的终端节点
以下 API 端点支持历史数据检索:
-
private/get_order_history_by_instrument -
private/get_order_history_by_currency -
private/get_user_trades_by_instrument -
private/get_user_trades_by_instrument_and_time -
private/get_user_trades_by_currency -
private/get_user_trades_by_currency_and_time -
private/get_user_trades_by_order
API 使用情况
要检索历史交易和订单,请使用 historical 您向上面列出的任何终端节点发出 API 请求中的参数。
-
historical: false→ 检索最近的记录(执行后立即可用)。 -
historical: true→ 检索历史记录(在短暂延迟后可用于索引)。
请求示例:
{
"method": "private/get_user_trades_by_currency",
"params": {
"currency": "ETH",
"historical": true
},
"jsonrpc": "2.0",
"id": 2
}
示例响应:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"trades": [
{
"timestamp": 1741270338502,
"state": "open",
"price": 1355.9,
"direction": "sell",
"index_price": 2246.9768,
"instrument_name": "ETH_USDC",
"trade_seq": 18009,
"api": false,
"amount": 0.2505,
"mark_price": 2246.9768,
"order_id": "ETH_USDC-109841952",
"matching_id": null,
"tick_direction": 3,
"fee": 0,
"profit_loss": null,
"mmp": false,
"post_only": false,
"self_trade": false,
"contracts": 2505,
"original_order_type": "market",
"trade_id": "ETH_USDC-18820350",
"fee_currency": "USDC",
"order_type": "limit",
"risk_reducing": false,
"liquidity": "M"
},
{
"timestamp": 1741270338460,
"state": "open",
"price": 1355.9,
"direction": "sell",
"index_price": 2246.9768,
"instrument_name": "ETH_USDC",
"trade_seq": 18006,
"api": false,
"amount": 0.2505,
"mark_price": 2246.9768,
"order_id": "ETH_USDC-109841952",
"matching_id": null,
"tick_direction": 3,
"fee": 0,
"profit_loss": null,
"mmp": false,
"post_only": false,
"self_trade": false,
"contracts": 2505,
"original_order_type": "market",
"trade_id": "ETH_USDC-18820345",
"fee_currency": "USDC",
"order_type": "limit",
"risk_reducing": false,
"liquidity": "M"
}
],
"has_more": true
}
}