How ojuawo/hyperliquidaibot works
HyperliquidAiBot is a continuously running .NET trading bot that turns exchange and account data into AI trade proposals, checks them against deterministic safety rules, then submits approved orders. Its main workflow is orchestrated by the background TradingWorker: gather market/account inputs, compute technical indicators, request a research decision, evaluate risk, and execute orders with protective triggers. A web dashboard exposes status and cycle-trigger controls, backed by in-memory state. The README documents REST/WebSocket exchange access, EIP-712 signing, dry-run operation, and Gemini/OpenAI support; some worker and client wiring is inferred only where excerpts omit method bodies.
Main entry points: TradingWorker.cs Trading worker · HyperliquidClient.cs Exchange client · Program.cs Web host and API · ResearchEngine.cs AI research engine
Components 17
Trading runtime
- Trading worker
src/HyperliquidAiBot.Worker/TradingWorker.cs - Bot settings
src/HyperliquidAiBot.Core/Config/BotSettings.cs
Market analysis
- Market context
src/HyperliquidAiBot.Core/Models/MarketContext.cs - Technical analysis
src/HyperliquidAiBot.Core/Services/TechnicalAnalysisService.cs - AI research engine
src/HyperliquidAiBot.Core/Services/ResearchEngine.cs - Trade decision
src/HyperliquidAiBot.Core/Models/TradeDecision.cs
Risk and execution
- Exchange client
src/HyperliquidAiBot.Core/Services/HyperliquidClient.cs - Exchange payloads
src/HyperliquidAiBot.Core/Models/HyperliquidPayloads.cs - EIP-712 signer
src/HyperliquidAiBot.Core/Services/HyperliquidSigner.cs - Risk manager
src/HyperliquidAiBot.Core/Services/RiskManager.cs - Risk rules
src/HyperliquidAiBot.Core/Config/RiskRules.cs
Dashboard and state
- In-memory bot state
src/HyperliquidAiBot.Core/Services/BotStateService.cs - Web host and API
src/HyperliquidAiBot.Worker/Program.cs - Visual dashboard
src/HyperliquidAiBot.Worker/wwwroot/index.html
Other components
- Bot operator
- Hyperliquid DEX
- Gemini / OpenAI
Connections 24
- Bot settings → Trading worker: configures
- Trading worker → Exchange client: fetches market data
- Exchange client → Hyperliquid DEX: requests data
- Hyperliquid DEX → Exchange client: returns data
- Trading worker → Market context: builds context
- Trading worker → Technical analysis: computes indicators
- Technical analysis → Market context: returns indicators
- Trading worker → AI research engine: requests analysis
- AI research engine → Gemini / OpenAI: requests proposal
- Gemini / OpenAI → AI research engine: returns proposal
- AI research engine → Trade decision: creates
- Trading worker → Risk manager: evaluates trade
- Risk manager → Risk rules: applies limits
- Trading worker → Exchange client: submits approved orders
- Exchange client → EIP-712 signer: signs action
- Exchange client → Exchange payloads: formats exchange payloads
- Exchange client → Hyperliquid DEX: posts signed orders
- Trading worker → In-memory bot state: records cycle
- Bot operator → Visual dashboard: views status
- Visual dashboard → Web host and API: requests dashboard
- Web host and API → In-memory bot state: reads snapshot
- Web host and API → In-memory bot state: queues cycle trigger
- In-memory bot state → Trading worker: signals immediate cycle
- Web host and API → Bot settings: binds configuration