多平台账户凭据管理与签名服务,专注于单一职责:为不同平台提供签名功能。
/api/v1
application/json
POST /api/v1/sign
Content-Type: application/json
{
"platformId": "pacifica",
"accountId": "pac-main-001",
"data": {
"type": "place_order",
"market": "BTC-USD",
"side": "bid",
"amount": "0.001",
"price": "65000"
}
}
响应 (200 OK):
{
"success": true,
"data": {
"signature": "base58_encoded_signature",
"algorithm": "ed25519",
"encoding": "base58",
"publicKey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"signedAt": "2025-09-28T12:00:00Z"
}
}
错误响应 (404 Not Found):
{
"success": false,
"error": {
"code": "ACCOUNT_NOT_FOUND",
"message": "指定账户不存在",
"details": {
"platformId": "pacifica",
"accountId": "pac-main-001"
}
}
}
POST /api/v1/sign/batch
Content-Type: application/json
{
"requests": [
{
"requestId": "req_001",
"platformId": "pacifica",
"accountId": "pac-main-001",
"data": {"type": "place_order", "symbol": "BTC-USD"}
},
{
"requestId": "req_002",
"platformId": "aster",
"accountId": "ast-hedge-001",
"data": {"action": "cancel_order", "orderId": "12345"}
}
]
}
响应 (200 OK):
{
"success": true,
"data": {
"results": [
{
"requestId": "req_001",
"status": "success",
"signature": "base58_signature_1",
"algorithm": "ed25519"
},
{
"requestId": "req_002",
"status": "success",
"signature": "0x8c7e40c7b23c0b86...",
"algorithm": "eip191"
}
],
"summary": {
"total": 2,
"successful": 2,
"failed": 0
}
}
}
GET /api/v1/accounts?platform=pacifica
响应 (200 OK):
{
"success": true,
"data": {
"accounts": [
{
"accountId": "pac-main-001",
"platformId": "pacifica",
"alias": "Pacifica主账户",
"status": "active",
"environment": "production",
"usage": {
"totalSigns": 1250,
"lastSignAt": "2025-09-28T11:30:00Z",
"errorCount": 2
}
}
],
"total": 1
}
}
GET /api/v1/accounts/{platformId}/{accountId}
响应 (200 OK):
{
"success": true,
"data": {
"accountId": "pac-main-001",
"platformId": "pacifica",
"alias": "Pacifica主账户",
"status": "active",
"environment": "production",
"algorithm": "ed25519",
"publicKey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"createdAt": "2025-09-01T10:00:00Z",
"lastUsed": "2025-09-28T11:30:00Z"
}
}
POST /api/v1/config/reload
响应 (200 OK):
{
"success": true,
"data": {
"reloadedAt": "2025-09-28T12:00:00Z",
"changes": {
"added": 1,
"updated": 0,
"removed": 0
},
"accountCount": 8,
"platformCount": 4
}
}
GET /api/v1/status
响应 (200 OK):
{
"success": true,
"data": {
"status": "healthy",
"uptime": "72h 15m 30s",
"config": {
"path": "/path/to/credentials.json",
"lastLoaded": "2025-09-28T12:00:00Z",
"isWatching": true
},
"accounts": {
"total": 8,
"byPlatform": {
"pacifica": 3,
"aster": 2,
"binance": 2,
"okx": 1
}
},
"performance": {
"avgSigningTime": "15ms",
"totalSigns": 12500,
"errorRate": 0.002
}
}
}
{
"platformId": "pacifica",
"accountId": "pac-main-001",
"data": {
"instruction": {
"type": "place_order",
"market": "BTC-USD",
"side": "bid",
"amount": "0.001",
"price": "65000"
},
"nonce": 1735390800000
}
}
{
"platformId": "aster",
"accountId": "ast-hedge-001",
"data": {
"message": {
"action": "place_order",
"symbol": "BTCUSDT",
"price": "65000",
"quantity": "0.001",
"timestamp": 1735390800000
}
}
}
{
"platformId": "binance",
"accountId": "bn-spot-001",
"data": {
"method": "POST",
"endpoint": "/api/v3/order",
"params": {
"symbol": "BTCUSDT",
"side": "BUY",
"type": "LIMIT",
"quantity": "0.001",
"price": "65000",
"timestamp": 1735390800000
}
}
}
{
"platformId": "okx",
"accountId": "okx-perp-001",
"data": {
"method": "POST",
"path": "/api/v5/trade/order",
"body": {
"instId": "BTC-USDT",
"side": "buy",
"ordType": "limit",
"sz": "0.001",
"px": "65000"
},
"timestamp": "2025-09-28T12:00:00.000Z"
}
}
错误代码 | HTTP状态码 | 描述 |
---|---|---|
ACCOUNT_NOT_FOUND |
404 | 指定账户不存在 |
PLATFORM_NOT_SUPPORTED |
400 | 不支持的平台 |
INVALID_DATA_FORMAT |
400 | 签名数据格式错误 |
SIGNATURE_FAILED |
500 | 签名操作失败 |
CONFIG_LOAD_FAILED |
500 | 配置文件加载失败 |
ACCOUNT_INACTIVE |
423 | 账户已禁用 |