Frequently Asked Questions
New here? Start with Configuring OKX API keys — it's the most common stumbling block, walked through step by step.
On this page
- Login & Wallet
- API Key configuration
- Strategy & Backtest
- Trading & Positions
- SSE & Real-time data
- Performance & Deployment
Login & Wallet
Login signature failed — MetaMask shows an error
Possible causes:
- MetaMask is locked → unlock it
- Wrong wallet selected → switch to the one you registered with
- Large local time skew → correct your system clock
- Other browser extensions interfering → disable other Web3 extensions
Try this: disconnect MetaMask, reload the page, and reconnect. If the error persists, try a different browser (Chrome → Firefox) to isolate extension conflicts.
Logged out immediately after sign-in
Your browser is probably blocking third-party cookies. TodoAI uses the qt_session httpOnly cookie; if disabled, set-cookie has no effect.
Fix (Chrome): Settings → Privacy and security → Cookies and other site data → Block third-party cookies → toggle off for app.totodo.icu.
Fix (Safari): the default "Prevent cross-site tracking" blocks our cookie. Either disable it globally or add app.totodo.icu as an exception.
"Too many requests" / IP rate-limited on login
/api/user/login is rate-limited to 5/minute/IP to prevent signature brute-force. Wait one minute, then retry.
If you keep hitting this without actually logging in, your wallet's auto-sign flow may be spamming. Disconnect the wallet fully, refresh, then click "Connect Wallet" exactly once.
API Key configuration
Test connection failed: Invalid Api-Key
- Re-copy the API Key from OKX (it may have been renamed/deleted)
- Confirm you chose
API Tradingtype at creation - If you enabled IP whitelist, confirm the current server IP is in it
- Check that the API key isn't expired (OKX allows setting an expiration)
Test connection failed: Passphrase is wrong
90% of connection failures are this. The Passphrase is the field you set yourself when creating the API — not your OKX login password, not your funds password.
If you forgot it, you must delete the API key and create a new one. OKX cannot recover a lost Passphrase.
Test connection failed: Server IP not in OKX whitelist
You enabled IP whitelist when creating the API on OKX. The server's outbound IP needs to be added.
- Self-hosted: run
curl ifconfig.meon the server to get the public IP - Vercel/hosted: check your provider's egress IP documentation
- Not sure? the simplest fix is to disable IP whitelist in the OKX API settings (it's enabled by default but not required)
Test connection failed: API Key lacks required permissions
OKX API doesn't have Read and Trade checked.
- Delete the API key on OKX
- Recreate it, this time ticking Read + Trade
- Do NOT enable Withdraw — that's the single most important security step
- Re-paste into TodoAI's Configure modal
Paper key fails but OKX shows the key as fine
Paper API keys must be created at OKX Demo Trading, NOT the main OKX site. The two are not interchangeable — mainnet keys won't work against the demo endpoint, and vice versa.
Strategy & Backtest
Strategy keeps showing HOLD — no trades ever fire
Usually the rules didn't trigger. Run /backtest with the same parameters to check. If backtest also doesn't trigger:
- Are indicator thresholds too extreme? (e.g. RSI < 10 is rarely hit)
- Is the timeframe too short to see the trigger?
- Is the symbol's volatility too low?
Loosen the conditions or change the timeframe to test.
Backtest shows 0 trades
- Thresholds are too extreme
- Timeframe too short, can't see the trigger
- Symbol liquidity is weak, price barely moves
Try a longer backtest period (3 months+) and a more liquid symbol (BTC/USDT) first to verify the system works, then refine.
AI-generated strategy doesn't work
- Look at the reasoning chain — does each step match your intent?
- Try editing a step (e.g. adjust RSI from 30 to 25) and click regenerate
- Edit rules directly in the DSL editor
- Simplify the prompt and start over
The AI is a model, not a magic wand — clearer inputs produce better strategies.
Backtest is great, but live loses money
Paper → live has several differences:
- Slippage — paper assumes zero, live has some
- Matching — paper assumes instant fill, live has delay
- Funding rates — overnight fees in futures mode
- Liquidity — paper assumes infinite, real markets don't
Recommendations:
- Run on Paper for 1+ week and compare to backtest
- Watch if max drawdown is deeper than backtest predicted
- Tighten SL if needed
- Use the panic close all button if things go wrong
Trading & Positions
Strategy stopped but positions are still open
Stopping a strategy does not auto-close positions. You need to:
- Manually close on
/trade, OR - Use the Panic close all button (closes everything immediately)
This is by design — you may want to stop a strategy's future signals while keeping existing positions open to ride out the move.
Some positions remain after Panic close
Panic sends a market order per position independently. If one fails (insufficient balance, network error, exchange rate limit), it stays in the errors[] array of the response. Check the response payload for failed positions and close them manually.
Position PnL shows incorrectly
Check Position.side:
- LONG profit =
closePrice - averagePrice(price went up) - SHORT profit =
averagePrice - closePrice(price went down)
If it shows the wrong sign, it may be legacy PnL data from before version 0.3.4.0 (the PnL formula changed when we added SHORT support). The scripts/backfill-pnl-side.js backfill script handles this.
SSE & Real-time data
SSE keeps dropping
- Check the reverse proxy (Nginx/Caddy) — it may be buffering SSE responses. Set
X-Accel-Buffering: nofor the relevant paths - Browser DevTools → Network → EventStream — check connection state
- Some NAT/firewalls have aggressive idle timeouts (60s+). Our default heartbeat is 15s, which usually keeps connections alive
- VPN — corporate VPNs sometimes block long-lived connections
Real-time data is 30s+ behind
- The engine cron tick is 30s by default — that's the floor for new trade events
- SSE poll cadence: 2.5s (events) / 800ms (reasoning) — worst case ~3s combined
- For sub-30s engine ticks, edit
scripts/systemd/quantokx-cron.timerand reduceOnCalendar
HeroMetrics winStreak / winRate stuck
The metrics update on profit_record_created events, which only fire when a position closes with PnL. Open positions don't affect win rate.
If you haven't closed any trades yet, the values stay at 0 (or initial state).
Performance & Deployment
Production build fails: db_check.ts module not found
db_check.ts is a temporary debug script at the repo root. Next.js TypeScript includes **/*.ts so root-level scripts end up in the type check. Fix: delete the file or move it under scripts/.
Multi-instance deploy: tier cache inconsistent
You must configure Upstash Redis:
UPSTASH_REDIS_REST_URL=https://...
UPSTASH_REDIS_REST_TOKEN=...Without these, the in-process Map cache is used, where each instance caches independently for 5 minutes. A PRO user on instance A may appear FREE on instance B until the cache expires.
profit-broadcaster doesn't work across instances
Currently a per-process Map. Single-instance works fine. Multi-instance needs Redis pub/sub (on the roadmap — until then, scale vertically or use sticky sessions on the load balancer).
Engine tick is slow / cron timer overlapping
The inflight + DB lock prevents concurrent execution of the same strategy, but if a single tick takes >30s, the next one starts before the previous finishes. Solutions:
- Increase timer interval in
scripts/systemd/quantokx-cron.timer - Set
STRATEGY_LIMIT=Nto cap strategies per tick - Check OKX API rate-limit headers — you may be hitting throttling
Still stuck?
- Search the Concepts docs — system architecture, error normalization, and other internals are documented
- Open an issue on GitHub with: error message, what you tried, and (anonymized) screenshots
- Email: support@totodo.icu