7 Commits

Author SHA1 Message Date
tinkle-community
2d32a8f6c9 chore(hyperliquid): refresh shared wallet-connect constants
The Hyperliquid wallet-connect flow signs configuration values that
must match what the server expects and what the order placement layer
sends on-chain. The same constants live in four call sites:

  - trader/hyperliquid/trader.go     (used at order placement)
  - api/handler_hyperliquid_wallet.go (returned by the connect endpoint
                                       and validated on submit)
  - web/src/components/common/HyperliquidWalletConnect.tsx
                                       (signed by the user during connect)
  - trader/hyperliquid/builder_fee_test.go
                                       (pins the trader-side value)

Refresh all four together so the surfaces stay in lockstep.
2026-06-02 12:04:28 +08:00
tinkle-community
7f0a9f0749 fix(hyperliquid): bump go-hyperliquid v0.26 -> v0.36 to dodge spot-meta panic
go-hyperliquid v0.26.0 crashed at startup with

    panic: runtime error: index out of range [479] with length 464
    github.com/sonirico/go-hyperliquid.NewInfo (info.go:75)
    NewExchange -> NewHyperliquidTrader -> AutoTrader.NewAutoTrader
    -> TraderManager.LoadTradersFromStore -> main.main

The library's NewInfo built the spot-asset map by indexing
`spotMeta.Tokens[spotInfo.Tokens[0]]` directly, but Hyperliquid recently
added spot tokens whose Tokens[0] value (a logical token *index*, not an
array position) was larger than the Tokens slice length. With every
restart the backend panicked before the API server bound, so the
frontend's `/api/*` proxy got connection refused on every poll and the
dashboard rendered "全是 error" toasts.

v0.36 fixes the panic by building `tokensByIndex map[int]SpotTokenInfo`
and looking up by logical index instead of position. Adopting v0.36
required two small adaptations to our wrapper:

  - trader/hyperliquid/trader.go: NewExchange grew an extra `perpDexs
    *MixedArray` argument. Passing `nil` keeps the existing
    "auto-fetch on first use" behavior.
  - trader/hyperliquid/trader_sync.go: `Info.NameToAsset(coin) int` was
    renamed to `Info.CoinToAsset(coin) (int, bool)` with an `ok` flag.
    refreshMetaIfNeeded now treats `!ok || assetID == 0` as "needs
    refresh" (the same semantic as the old `assetID == 0`).

Verified: backend rebuilds cleanly, container is healthy, all
Hyperliquid traders load, AI cycles execute, and Hyperliquid order
sync receives the full historical trade window.
2026-05-30 01:48:11 +08:00
tinklefund
c7c003cc3c feat(trader): wire Hyperliquid wallet and quick trade flow
- Add wallet API endpoints and exchange storage fields for Hyperliquid

- Normalize quick trade order paths, symbols, and builder fee coverage

- Add frontend wallet connect and quick trade helpers
2026-05-25 01:24:58 +08:00
tinklefund
f37fc9f887 feat(hyperliquid): add stock symbol market data support
- Add Hyperliquid/XYZ symbol normalization tests and backend coverage

- Extend kline and market data lookup paths for US stock symbols

- Wire frontend data API types for stock-oriented market requests
2026-05-25 01:24: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
Hao Fu
06d6080751 feat(hyperliquid): Add Unified Account support for Spot as Perp collateral (#1387)
This PR adds support for Hyperliquid's Unified Account mode where Spot USDC
balance can be used as collateral for Perpetual trading.

Changes:
- Add HyperliquidUnifiedAcct field to Exchange config (default: true)
- Update HyperliquidTrader to support unified account mode
- When enabled, Spot USDC balance is added to available trading balance
- Update API request/response structs for unified account toggle
- Update trader config propagation from exchange config

This aligns with Hyperliquid's roadmap to make Unified Account the default.
2026-02-22 17:03:21 +08:00
tinkle-community
093d2a329d feat(gate): complete Gate.io exchange integration with trader refactoring
Gate.io Integration:
- Add Gate trader with full Trader interface implementation
- Add order_sync.go for background trade synchronization
- Fix quantity display (convert contracts to actual tokens via quanto_multiplier)
- Fix fill price return in OpenLong/OpenShort/CloseLong/CloseShort
- Add Gate-specific CoinAnk K-line data source support
- Add Gate to supported exchanges in frontend and backend
- Add Gate/KuCoin logo SVG icons

Trader Package Refactoring:
- Move exchange-specific code into subdirectories (binance/, bybit/, okx/, bitget/, hyperliquid/, aster/, lighter/, gate/)
- Create types/ package for shared types to avoid circular dependencies
- Move TraderTestSuite to trader/testutil package to avoid import cycles
- Update market.GetWithExchange to support exchange-specific data
2026-01-31 23:15:17 +08:00