[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82290":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},82290,"hyperliquid-trading-bot","metanode-trade\u002Fhyperliquid-trading-bot","metanode-trade","hyperliquid trading bot, perp trading bot, hyperliquid profitable trading bot, hyperliquid trading bot, perp trading bot, hyperliquid profitable trading bot, hyperliquid trading bot, perp trading bot, hyperliquid profitable trading bot, hyperliquid trading bot, perp trading bot, hyperliquid profitable trading bot",null,"TypeScript",6,117,75,1,0,6.22,"Apache License 2.0",false,"main",true,[22,23,24,25,26,27,28],"bot","defi","grid-trading","hyperliquid","nodejs","trading-bot","typescript","2026-06-12 02:04:25","# Hyperliquid Grid Trading Bot\n\n> YAML-configured grid trading for [Hyperliquid](https:\u002F\u002Fhyperliquid.xyz\u002F) perpetuals. Define your levels, price range, and risk limits in a single config file — the engine handles order placement, rebalancing, and drawdown protection.\n\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-≥20.19-339933?logo=node.js&logoColor=white)](https:\u002F\u002Fnodejs.org\u002F)\n[![Hyperliquid](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FExchange-Hyperliquid-00D4AA)](https:\u002F\u002Fhyperliquid.xyz\u002F)\n[![License: Apache 2.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-blue.svg)](LICENSE)\n\n---\n\n## Why Grid Trading on Hyperliquid?\n\nGrid bots profit from **range-bound volatility** — buying lower, selling higher, repeatedly. Hyperliquid offers deep perp liquidity and low fees, making it a strong venue for systematic grids.\n\nThis bot stands out because:\n\n- **Config-driven** — no recompiling to change symbol, levels, or risk\n- **Auto price range** — optional `%` range around current mid\n- **Built-in risk management** — drawdown limits, position caps, optional SL\u002FTP\n- **Clean shutdown** — SIGINT cancels open orders (positions preserved)\n- **Testnet first** — separate keys and flag for safe experimentation\n\n---\n\n## Quick Start\n\n### 1. Install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmetanode-trade\u002Fhyperliquid-trading-bot.git\ncd hyperliquid-trading-bot\nnpm install\ncp .env.example .env\n```\n\n### 2. Set keys\n\n```env\n# Testnet (recommended first)\nHYPERLIQUID_TESTNET=true\nHYPERLIQUID_TESTNET_PRIVATE_KEY=0x...\n\n# Mainnet (when ready)\n# HYPERLIQUID_MAINNET_PRIVATE_KEY=0x...\n```\n\n### 3. Validate config\n\n```bash\nnpm run validate\nnpx tsx src\u002FrunBot.ts --validate bots\u002Fbtc_conservative.yaml\n```\n\n### 4. Run\n\n```bash\nnpx tsx src\u002FrunBot.ts bots\u002Fbtc_conservative.yaml\n# or\nnpm start\n```\n\n---\n\n## Bot Configuration (YAML)\n\nExample structure in `bots\u002F*.yaml`:\n\n```yaml\nactive: true                    # auto-select when no path arg\n\nexchange:\n  type: hyperliquid             # or \"hl\"\n  testnet: true\n\naccount:\n  max_allocation_pct: 50        # % of notional base (10_000 USD)\n\ngrid:\n  symbol: BTC\n  levels: 10\n  price_range:\n    auto:\n      range_pct: 5              # ±5% around mid\n\nrisk_management:\n  max_drawdown_pct: 10\n  max_position_pct: 80\n  rebalance_threshold_pct: 2\n  # optional stop_loss_pct \u002F take_profit_pct\n\nmonitoring:\n  log_level: INFO               # DEBUG | INFO | WARNING | ERROR\n```\n\n### Key sections\n\n| Section | Controls |\n|---------|----------|\n| `active` | Bot picked automatically when no file arg |\n| `exchange` | Venue and testnet\u002Fmainnet |\n| `account.max_allocation_pct` | Sizes `total_allocation` vs 10k USD notional base |\n| `grid` | Symbol, level count, manual or auto price range |\n| `risk_management` | Drawdown, position %, rebalance, SL\u002FTP |\n| `monitoring` | Log verbosity |\n\n---\n\n## Environment Variables\n\n| Variable | Scope |\n|----------|--------|\n| `HYPERLIQUID_TESTNET_PRIVATE_KEY` | Testnet signing key |\n| `HYPERLIQUID_MAINNET_PRIVATE_KEY` | Mainnet signing key |\n| `HYPERLIQUID_PRIVATE_KEY` | Legacy fallback |\n| `HYPERLIQUID_TESTNET` | Overrides YAML `exchange.testnet` |\n\n---\n\n## How the Engine Works\n\n```mermaid\nflowchart TB\n    YAML[bot.yaml] --> Loader[Config Loader]\n    Loader --> Engine[Grid Engine]\n    WS[HL WebSocket allMids] --> Engine\n    Engine --> Orders[Place \u002F Cancel Grid Orders]\n    Engine --> Risk[Risk Manager]\n    Risk -->|drawdown breach| Orders\n```\n\n1. Load and validate YAML\n2. Connect Hyperliquid adapter + WebSocket mids feed\n3. Compute grid levels within price range\n4. Place limit orders on each level\n5. Rebalance when price moves beyond threshold\n6. Enforce drawdown and position limits\n\n---\n\n## Project Structure\n\n```\nbots\u002F                    # YAML configs (btc_conservative.yaml, etc.)\nsrc\u002F\n├── runBot.ts            # CLI: validate | run\n├── core\u002F\n│   ├── engine.ts        # Main loop\n│   ├── configLoader.ts  # YAML parsing\n│   ├── keys.ts          # Env key resolution\n│   └── risk.ts          # Drawdown + limits\n├── strategies\u002Fgrid\u002F\n│   └── basicGrid.ts     # Grid logic\n└── exchanges\u002Fhyperliquid\u002F\n    ├── adapter.ts       # REST + order management\n    └── websocket.ts     # allMids feed\n```\n\n---\n\n## CLI Reference\n\n| Command | Description |\n|---------|-------------|\n| `npm run validate` | Validate default\u002Factive bot config |\n| `npx tsx src\u002FrunBot.ts --validate \u003Cyaml>` | Validate specific file |\n| `npx tsx src\u002FrunBot.ts \u003Cyaml>` | Run bot |\n| `npm run typecheck` | TypeScript check |\n\n---\n\n## Shutdown Behavior\n\n**SIGINT (Ctrl+C)** → cancels all open grid orders. **Positions are NOT flattened automatically** — review exposure before stopping.\n\n---\n\n## Safety Checklist\n\n- [ ] Run on **testnet** with fake funds first\n- [ ] Keep private keys **outside the repo** (env only)\n- [ ] Set conservative `max_drawdown_pct` and `max_position_pct`\n- [ ] Monitor logs during first live session\n- [ ] Understand grid risk in trending markets (one-sided inventory)\n\n---\n\n## Disclaimer\n\nTestnet before mainnet. Keys grant full account access. Authors not liable for trading losses.\n\n---\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n","该项目是一个基于Hyperliquid交易所的网格交易机器人，专为永续合约设计。它允许用户通过YAML配置文件定义交易级别、价格范围及风险限制，自动处理订单放置、再平衡和回撤保护。使用TypeScript编写，并支持Node.js环境。该机器人具备配置驱动、自动价格范围设定、内置风险管理（如回撤限制和仓位上限）以及安全关闭等特性。适用于希望在波动市场中通过系统化网格策略获利的交易者，尤其适合对Hyperliquid平台感兴趣的用户。",2,"2026-06-11 04:08:16","CREATED_QUERY"]