- OKX交易自动化 (okx-auto-position, okx-crypto, okx-exchange) - 交易信号处理 (signal-confirmation-templates, trading-signal-aggregator) - 量化因子挖掘 (quant-factor-mining) - 长桥集成 (longbridge-cli, longbridge-python-sdk) - 六合彩分析 (lottery-hk) - 股息投资 (dividend-investing, dividend-scanner) - 日内交易 (intraday-trading) - 同花顺 (tonghuashun)
1.2 KiB
1.2 KiB
LongPort API Error Codes
Authentication Errors
| Code | Meaning | Fix |
|---|---|---|
| 401004 | Token invalid | Token truncated/expired. Check bashrc has full token (1053 chars). Use Python to parse bashrc directly, don't rely on source. |
| 403201 | Auth failed | Similar to 401004 — token masking by terminal tool. Use execute_code + SDK instead of CLI. |
Geo-Restriction Errors
| Code | Meaning | Fix |
|---|---|---|
| 602315 | Mainland China regulatory block | API detects mainland China IP. Must use VPN (HK/US/etc). Read-only may still work; trading is blocked. |
Trading Errors
| Code | Meaning | Fix |
|---|---|---|
| 301607 | Too many k-lines requested | Max ~1000 per candlesticks() call. Use history_candlesticks_by_offset() for pagination. |
Common Error Patterns
- 401004 + 602315: Both appeared in same session. 401004 was from truncated token in .env, 602315 after token was fixed (real token loaded from bashrc).
- Token "..." truncation: bashrc shows
m_eyJh...jb-kin grep output even when full 1053-char token exists. The...is just display truncation by the shell/terminal, not in the actual file. Usepython3 -c "import os; ..."to verify real length.