用户信息 (Profile)
获取当前登录用户的账户详情。
接口信息
- Method:
GET - Path:
/api/v1/account/profile - Authentication: 需要身份验证
响应示例
{
"address": "0x742d35cc6634c0532925a3b844bc9e7595f0beb",
"referral_code": "ZTDX1234",
"referrer_address": "0x123...",
"created_at": "2024-01-01T00:00:00Z"
}
响应字段说明
| 字段 | 类型 | 描述 |
|---|---|---|
| address | string | 用户 Ethereum 地址(小写) |
| referral_code | string | null | 用户的推荐码(如已创建) |
| referrer_address | string | null | 推荐人地址(如已绑定) |
| created_at | string | 账户创建时间(ISO 8601 格式) |
说明
- 如果用户首次访问,系统会自动创建用户记录
referral_code需要用户主动创建才会有值referrer_address在用户绑定推荐码后会填充
获取用户订单历史
接口信息
- Method:
GET - Path:
/api/v1/account/orders - Authentication: 需要身份验证
查询参数
| 参数 | 类型 | 必须 | 描述 |
|---|---|---|---|
| symbol | string | 否 | 交易对筛选 |
| status | string | 否 | 状态筛选(open/filled/cancelled) |
| limit | number | 否 | 返回数量(默认 50,最大 200) |
| offset | number | 否 | 偏移量(默认 0) |
响应示例
{
"orders": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"symbol": "BTCUSDT",
"side": "buy",
"order_type": "limit",
"price": "65000.00",
"amount": "0.1",
"filled_amount": "0.1",
"leverage": 10,
"status": "filled",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:05:00Z"
}
],
"total": 150
}
获取用户成交历史
接口信息
- Method:
GET - Path:
/api/v1/account/trades - Authentication: 需要身份验证
查询参数
| 参数 | 类型 | 必须 | 描述 |
|---|---|---|---|
| symbol | string | 否 | 交易对筛选 |
| limit | number | 否 | 返回数量(默认 50,最大 200) |
| offset | number | 否 | 偏移量(默认 0) |
响应示例
{
"trades": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"order_id": "550e8400-e29b-41d4-a716-446655440001",
"symbol": "BTCUSDT",
"side": "buy",
"price": "65000.00",
"amount": "0.1",
"fee": "0.65",
"realized_pnl": "0.00",
"timestamp": "2024-01-01T00:00:00Z"
}
],
"total": 300
}
响应字段说明
| 字段 | 类型 | 描述 |
|---|---|---|
| trades | array | 成交记录列表 |
| total | number | 总记录数 |
Trade 对象字段
| 字段 | 类型 | 描述 |
|---|---|---|
| id | string | 成交 ID |
| order_id | string | 关联的订单 ID |
| symbol | string | 交易对 |
| side | string | 方向(buy/sell) |
| price | string | 成交价格 |
| amount | string | 成交数量 |
| fee | string | 手续费 |
| realized_pnl | string | 已实现盈亏 |
| timestamp | string | 成交时间 |
获取用户仓位列表
接口信息
- Method:
GET - Path:
/api/v1/account/positions - Authentication: 需要身份验证
响应示例
{
"positions": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"symbol": "BTCUSDT",
"side": "long",
"size": "6500.00",
"entry_price": "65000.00",
"mark_price": "65500.00",
"liquidation_price": "60000.00",
"collateral": "650.00",
"leverage": 10,
"unrealized_pnl": "50.00",
"realized_pnl": "0.00",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T01:00:00Z"
}
]
}
详细字段说明请参考 仓位管理文档。