feat: add AI grid trading and market regime classification

- Add GridTrader interface with PlaceLimitOrder, CancelOrder, GetOrderBook
- Implement GridTrader for all exchanges (Binance, Bybit, OKX, Bitget, Hyperliquid, Aster, Lighter)
- Add grid engine with ATR-based boundary calculation and fund distribution
- Add market regime classification documents (Chinese/English)
- Add GridConfigEditor component for frontend configuration
This commit is contained in:
tinkle-community
2026-01-13 10:33:02 +08:00
parent 705aa641b0
commit 5fb26c17dc
22 changed files with 3901 additions and 32 deletions

View File

@@ -28,6 +28,7 @@ type Store struct {
strategy *StrategyStore
equity *EquityStore
order *OrderStore
grid *GridStore
mu sync.RWMutex
}
@@ -156,6 +157,9 @@ func (s *Store) initTables() error {
if err := s.Order().InitTables(); err != nil {
return fmt.Errorf("failed to initialize order tables: %w", err)
}
if err := s.Grid().InitTables(); err != nil {
return fmt.Errorf("failed to initialize grid tables: %w", err)
}
return nil
}
@@ -279,6 +283,16 @@ func (s *Store) Order() *OrderStore {
return s.order
}
// Grid gets grid trading storage
func (s *Store) Grid() *GridStore {
s.mu.Lock()
defer s.mu.Unlock()
if s.grid == nil {
s.grid = NewGridStore(s.gdb)
}
return s.grid
}
// Close closes database connection
func (s *Store) Close() error {
if s.driver != nil {