3 Commits

Author SHA1 Message Date
tinkle-community
d008ccc6ab fix(market): route Hyperliquid USDC perps correctly + symbol fuzzy match
A single-symbol QNT-USDC trader produced 0 candidate coins, 500 errors
from Hyperliquid, and "🚫 Dropped AI decision" warnings — the agent had
no market data to reason about, so it sat in `wait` forever. Three
chained bugs:

1. provider/hyperliquid/kline.go (IsXYZAsset / FormatCoinForAPI):
   asset detection required the base symbol to appear in the hardcoded
   StockPerpsSymbols / XYZOtherSymbols / display-alias lists. QNT, ARM,
   and every other newly-listed Hyperliquid USDC perp wasn't in the
   list, so the code routed them to the crypto path (CoinAnk) which
   doesn't have them. Now the `-USDC` suffix and `xyz:` prefix are
   trusted as definitive Hyperliquid signals — these tokens are
   Hyperliquid-specific and new listings don't require a code change.
   The hardcoded lists are kept as fallbacks for bare base symbols.

2. market/data_klines.go (getKlinesFromHyperliquid): the function
   stripped the `xyz:` prefix before calling GetCandles, defeating
   GetCandles's own FormatCoinForAPI logic. With the hardcoded list
   missing the new ticker, FormatCoinForAPI couldn't re-add the prefix
   and the request hit Hyperliquid's crypto perp endpoint — which
   returns 500 for stock-only tickers. Pass the symbol through as-is.

3. trader/auto_trader_loop.go (filterDecisionsToStrategyUniverse): the
   AI sometimes echoes a candidate as "QNTUSDC" / "QNT-USDC" / "QNTUSDT"
   / bare "QNT" instead of the canonical "xyz:QNT" we supplied. Strict
   exact-match was dropping all of them. Added a base-level key
   (strips xyz:, -USDC, -USDT, USDC, USDT, USD; normalizes display
   aliases like ROBINHOOD → HOOD) and rewrites the matched decision's
   symbol to the canonical form so the order pipeline downstream sees
   the format it expects.

After this, a single-symbol stock trader fetches real K-line data from
Hyperliquid, the AI sees real candidates, and decisions get executed
on-chain instead of silently filtered.
2026-05-29 22:14:41 +08:00
shinchan-zhai
4ab4024628 fix: fallback to Binance kline when coinank returns empty data for non-Binance exchanges
CoinAnk recently stopped providing free kline data for OKX/Bitget/Gate
exchanges (returns success but empty array). This caused '3-minute
k-line data is empty' errors for all users on those exchanges.

Fix: detect empty kline response and automatically fallback to Binance
kline data, which is always available.
2026-03-27 13:41:49 +08:00
tinkle-community
cb31782be4 refactor: split large files and clean up project structure
- Rename experience/ to telemetry/ for clarity
- Split 15+ large Go files (800-2200 lines) into focused modules:
  kernel/engine.go, backtest/runner.go, market/data.go, store/position.go,
  api/handler_trader.go, trader/auto_trader_grid.go, and 9 exchange traders
- Split frontend monoliths: types.ts, api.ts, AITradersPage.tsx, BacktestPage.tsx
  into domain-specific modules with barrel re-exports
- Remove stale files: screenshots, .yml.old, pyproject.toml
- Remove unused scripts/ and cmd/ directories
- Remove broken/outdated test files (network-dependent, stale expectations)
2026-03-12 12:53:57 +08:00