NovaAlpha · API 参考
所有端点列表与请求/响应示例 · 基础地址 https://novaalpha.vip/api
认证与用户
| 方法 | 路径 | 说明 | 鉴权 |
| POST | /api/auth/register | 邮箱注册(含 birthday) | - |
| POST | /api/auth/login | 登录获取 JWT | - |
| POST | /api/auth/reset-password | 重置密码(邮箱+生日) | - |
| GET | /api/auth/me | 当前用户信息 + 余额 | JWT |
| GET | /api/auth/oauth/redirect | Google OAuth 跳转 | - |
| GET | /api/auth/oauth/callback/google | Google OAuth 回调 | - |
注册
curl -X POST https://novaalpha.vip/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"secret","birthday":"1990-01-01"}'
# → { "success": true, "data": { "id": 1, "email": "...", "balance_usdt": 0 } }
登录
curl -X POST https://novaalpha.vip/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"secret"}'
# → { "success": true, "data": { "token": "eyJhbGci...", "user": {...} } }
策略市场
| 方法 | 路径 | 说明 | 鉴权 |
| GET | /api/strategies | 策略列表(分类/分页/搜索) | - |
| GET | /api/strategies/:id | 策略详情(含历史表现) | - |
| GET | /api/strategies/categories | 策略分类统计 | - |
# 浏览免费策略
curl "https://novaalpha.vip/api/strategies?category=free&page=1&pageSize=20"
# → {
# "success": true,
# "data": [
# { "id": 1, "code": "martin_ge", "name": "马丁格尔",
# "category": "free", "is_free": 1, "monthly_fee_usdt": 0,
# "performance_30d": 8.5, "max_drawdown_30d": 12.3, "total_users": 156 }
# ],
# "pagination": { "page": 1, "pageSize": 20, "total": 1 }
# }
订阅管理
| 方法 | 路径 | 说明 | 鉴权 |
| GET | /api/subscriptions | 我的订阅列表 | JWT |
| POST | /api/subscriptions | 创建订阅(扣费+启动策略) | JWT |
| POST | /api/subscriptions/:id/pause | 暂停策略 | JWT |
| POST | /api/subscriptions/:id/resume | 恢复策略 | JWT |
| DELETE | /api/subscriptions/:id | 取消订阅 | JWT |
| PUT | /api/subscriptions/:id/params | 更新策略参数 | JWT |
| POST | /api/subscriptions/:id/renew | 立即续费(延长 30 天) | JWT |
curl -X POST https://novaalpha.vip/api/subscriptions \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{"strategy_id":2,"apikey_id":1,"custom_params":{"base_amount":0.002}}'
# → {
# "success": true,
# "data": {
# "subscription": { "id": 5, "status": "active", "current_period_end": "..." },
# "balance_after": 20.1
# }
# }
交易所 API Key
| 方法 | 路径 | 说明 | 鉴权 |
| GET | /api/apikeys | 我的 API Key 列表 | JWT |
| POST | /api/apikeys | 添加 API Key(AES-256 加密存储) | JWT |
| DELETE | /api/apikeys/:id | 删除 API Key | JWT |
| POST | /api/apikeys/:id/test | 测试 API Key 连通性 | JWT |
curl -X POST https://novaalpha.vip/api/apikeys \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{
"exchange":"okx",
"label":"主账号",
"api_key":"...",
"api_secret":"...",
"passphrase":"..."
}'
# → { "success": true, "data": { "id": 1, "exchange": "okx", "label": "主账号" } }
⚠️ 建议交易所 API Key 只开交易权限,关闭提现权限,并设置 IP 白名单为平台服务器 IP。
交易与仪表盘
| 方法 | 路径 | 说明 | 鉴权 |
| GET | /api/trading/dashboard | 仪表盘汇总 | JWT |
| GET | /api/trading/trades | 交易记录(分页) | JWT |
| GET | /api/trading/positions | 当前持仓 | JWT |
| GET | /api/trading/performance | 收益曲线(30d/90d/all) | JWT |
curl https://novaalpha.vip/api/trading/dashboard \
-H "Authorization: Bearer <jwt>"
# → {
# "success": true,
# "data": {
# "total_profit_usdt": 12.34,
# "active_strategies": 2,
# "total_trades": 86,
# "balance_usdt": 45.6,
# "active_positions": 1,
# "subscriptions_summary": [...]
# }
# }
支付与钱包
| 方法 | 路径 | 说明 | 鉴权 |
| GET | /api/pay/wallet/balance | 余额 + 最近流水 | JWT |
| POST | /api/pay/wallet/deposit | 创建充值订单(ClawPay USDT) | JWT |
| GET | /api/pay/wallet/transactions | 余额流水(分页) | JWT |
| POST | /api/pay/clawpay/callback | ClawPay USDT 回调(HMAC 验签) | 签名 |
curl -X POST https://novaalpha.vip/api/pay/wallet/deposit \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{"amount_usdt": 50}'
# → {
# "success": true,
# "data": {
# "order_no": "NVA1691...",
# "pay_url": "https://clawpay.click/cashier/...",
# "amount_usdt": 50
# }
# }
支付完成后 ClawPay 回调 /api/pay/clawpay/callback,验签通过后自动入账并写余额流水。
Agent 接口
| 方法 | 路径 | 说明 | 鉴权 |
| POST | /api/agent/register | Agent 注册(kakan.email 自动分配) | - |
| POST | /api/agent/login | Agent 登录(api_key 或 email+password) | - |
| GET | /api/agent/me | Agent 信息 | API Key |
| GET | /api/agent/strategies | 可用策略列表 | API Key |
| POST | /api/agent/subscribe | Agent 代用户订阅 | API Key |
| GET | /api/agent/dashboard | Agent 仪表盘 | API Key |
# 注册 Agent(自动分配 kakan.email 邮箱)
curl -X POST https://novaalpha.vip/api/agent/register \
-H "Content-Type: application/json" \
-d '{"name":"量化Agent"}'
# → { "success": true, "data": { "api_key": "nva_xxx...", "email": "auto@kakan.email" } }
# 代用户订阅
curl -X POST https://novaalpha.vip/api/agent/subscribe \
-H "X-API-Key: nva_xxx..." \
-H "Content-Type: application/json" \
-d '{"user_id":10,"strategy_id":2,"apikey_id":3}'