/app/tradehistory

查询交易历史记录

获取所有用户的交易历史记录。


分页参数说明

本接口采用 offset + limit 模式进行分页查询,适用于数据量较大的场景。

参数定义

参数名类型必填默认值说明
offsetinteger0跳过指定数量的记录,从0开始
limitinteger50返回的记录数量,最大值为500
startdatestring时间格式 Y-m-d\TH:i:s.u\Z,例如:
',例如:2025-09-04T03:01:01.000000Z
enddatestring时间格式 Y-m-d\TH:i:s.u\Z,例如:
,例如:2025-09-04T03:01:01.000000Z
orderstringdesc可选值 desc,asc

日期查询参数规范

1. 日期范围限制

  • 时间跨度:查询的时间区间不得超过 90天(3个月)
  • 验证规则:当开始日期与结束日期间的差值超过90天时,系统将返回以下错误信息:
{
  "message": "The given data was invalid.",
  "errors": {
    "startdate": [
      "The time interval for the query shall not exceed 90 days."
    ],
    "enddate": [
      "The time interval for the query shall not exceed 90 days."
    ]
  }
}
2. 默认日期规则
  • 空值处理:当开始日期(startdate)或结束日期(enddate)参数为空时,系统自动默认读取最近7天数据
  • 只有开始日期 默认结束日期为当前日期,但是如果区间超过3个月,仍然会提示超过时间跨度;
  • 只有结束日期 开始日期默认是截止日期的前7天

时间格式注意事项

开始结束日期如不传递,则

时间按created_at 查询

微秒部分必须是 6 位数字

时区必须是 Z(表示 UTC)

时间使用 24 小时制

月份和日期需要补零


使用规则

1. 基础分页查询

GET /app/tradehistory?offset=0&limit=20
  • 跳过 0 条记录
  • 返回前 20 条交易数据

2. 翻页查询示例

# 第一页
GET /app/tradehistory?offset=0&limit=20

# 第二页
GET /app/tradehistory?offset=20&limit=20

# 第三页  
GET /app/tradehistory?offset=40&limit=20

3. 结合时间筛选

GET //app/tradehistory?startdate=2024-01-01&enddate=2024-01-31&offset=0&limit=50

注意事项

  • 性能建议:当 offset 值较大时(如超过10000),查询性能会下降,建议结合 created_at 时间戳进行优化
  • 最大值限制limit 参数最大值为没有限制,但是建议每页不超过100条记录
  • 数据一致性:在频繁更新的数据集中使用分页时,建议按固定排序字段(如 created_at)排序,避免数据重复或遗漏

交易记录响应参数说明

参数名类型说明
trade_idstring交易唯一标识符
rfq_idstring关联的报价请求ID
quantitystring交易数量(字符串格式,确保精度);
Legend和用户交易的数字货币金额。结算的时候也以这个金额为准。
sidestring交易方向:buy(买入)/ sell(卖出)
pricestring交易价格(字符串格式,确保精度)
createdstring交易创建时间(ISO 8601格式)
executedstring交易执行时间(ISO 8601格式,如未执行为空)
pairstring交易对,如:BTC/USDT
trade_statusstring交易状态:pending(挂起)/ executed(已执行)/ canceled(已取消)
sizestring交易规模(法币价值,字符串格式)
platformstring交易平台标识
network_feeinteger网络手续费,默认:0 ;
向用户区块链地址发送代币时,所需支付的链上交易手续费(Gas Fee)。
processing_feenumber处理费,默认:0;
由 Legend Trading 收取的服务费用。
commissionstring为合作方预留的佣金字段(字符串格式);
数值说明:如果此功能未启用,该字段可予以忽略。
created_atstring记录创建时间(ISO 8601格式)
trade_sourcestring交易来源标识
user_idstring用户唯一标识
referencestring自定义参考信息


Query Params
string
Defaults to 50
string
Defaults to 0
string
Defaults to 2019-09-04T03:01:01.000000Z
string
Defaults to 2019-09-04T03:01:01.000000Z
string
Defaults to desc

"desc" or "asc"

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json