[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-163":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":42,"readmeContent":43,"aiSummary":44,"trendingCount":15,"starSnapshotCount":15,"syncStatus":45,"lastSyncTime":46,"discoverSource":47},163,"hyperliquid-trading-bot","freq-trades\u002Fhyperliquid-trading-bot","freq-trades","hyperliquid perpetuals grid crypto derivatives dex typescript nodejs automated-trading algorithmic-trading quant api leverage orderbook market-making testnet defi trading-bot blockchain risk OHLCV crypto-bot grid-strategy stop-loss drawdown viem websocket yaml systematic futures spot hedging rebalance liquidation SDK npm opensource observability d","https:\u002F\u002Fgithub.com\u002Ffreq-trades\u002Fhyperliquid-trading-bot",null,"Python",188,319,102,0,7.52,"Apache License 2.0",false,"main",true,[22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"algorithmic-trading","api","automated-trading","blockchain","bot","crypto-trading","cryptocurrency","decentralized-exchange","defi","dex","grid-trading","hyperliquid","market-making","nodejs","perpetuals","perps","quantitative-trading","trading-bot","typescript","web3","2026-06-12 02:00:09","# Hyperliquid grid trading bot\n\n**Repository:** [github.com\u002Ffreq-trades\u002Fhyperliquid-trading-bot](https:\u002F\u002Fgithub.com\u002Ffreq-trades\u002Fhyperliquid-trading-bot)\n\nA configurable grid strategy runner for [Hyperliquid](https:\u002F\u002Fhyperliquid.xyz). It places layered buy and sell orders around a price range and supports basic risk rules (stop loss, take profit, drawdown limits, and rebalancing). The main implementation is **TypeScript on Node.js**; a legacy **Python** tree remains for reference and scripts.\n\n> **Risk.** Trading digital assets and derivatives is risky. This repository is for education and research. You can lose your capital. **Use Hyperliquid testnet and small size until you understand the behavior.** The authors and contributors are not providing financial or legal advice.\n\n---\n\n## What you need\n\n| Requirement | Notes |\n|-------------|--------|\n| [Node.js](https:\u002F\u002Fnodejs.org\u002F) **20.19 or newer** | Required for the main bot (`package.json` → `engines`). |\n| A Hyperliquid **wallet (private key)** | For testnet: use a dedicated key; fund via [testnet faucet](https:\u002F\u002Ffaucet.chainstack.com\u002Fhyperliquid-testnet-faucet) or your preferred source. |\n| `git` | To clone the repository. |\n\nOptional: [uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv) if you use the Python examples under `learning_examples\u002F` or `src\u002Frun_bot.py`.\n\n---\n\n## Install and run (main bot)\n\nFollow these steps in order.\n\n**1. Clone and install dependencies**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ffreq-trades\u002Fhyperliquid-trading-bot.git\ncd hyperliquid-trading-bot\nnpm install\n```\n\n**2. Environment file**\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` and set at least:\n\n- **Testnet:** `HYPERLIQUID_TESTNET_PRIVATE_KEY`, `HYPERLIQUID_TESTNET=true`, and the testnet URL variables if you use the defaults from `.env.example`.\n- **Mainnet (real funds):** use the mainnet private key variable and `HYPERLIQUID_TESTNET=false` as described in `.env.example`. **Double-check YAML `exchange.testnet: false` for live trading.**\n\nNever commit `.env` or share your private key.\n\n**3. Bot configuration**\n\nConfigs live in `bots\u002F*.yaml`. The sample `btc_conservative.yaml` is a conservative grid profile. Set `active: true` on the file you want the auto-discovery runner to pick (only one should be `active: true` if you rely on auto-discovery), or pass an explicit path when starting (see below).\n\n**4. Validate, then start**\n\n```bash\nnpm run validate\nnpm start\n```\n\n| Command | Purpose |\n|--------|---------|\n| `npm start` | Runs the bot using the first `active: true` config under `bots\u002F`. |\n| `npm run validate` | Checks that a selected YAML is structurally valid (no private key required for this step). |\n| `npx tsx ts\u002Fsrc\u002FrunBot.ts path\u002Fto\u002Fconfig.yaml` | Runs with an explicit config file. |\n| `npm test` | Runs automated tests (e.g. grid math). |\n\nOn **Ctrl+C**, the engine attempts to cancel open orders; review logs for your environment.\n\n---\n\n## How configuration fits together\n\n- **`.env`** – Private keys, testnet flag, and API base URLs. See `.env.example` for all options and comments.\n- **`bots\u002F\u003Cname>.yaml`** – Strategy name, `exchange` (e.g. Hyperliquid, testnet on\u002Foff), `account` allocation, `grid` (symbol, levels, range), `risk_management`, and `monitoring.log_level`.\n\nThe TypeScript runner reads YAML and can override `exchange.testnet` with `HYPERLIQUID_TESTNET` in `.env` when set.\n\nExample structure (illustrative; see `bots\u002Fbtc_conservative.yaml` for the full, commented file):\n\n```yaml\nname: \"my_grid\"\nactive: true\n\nexchange:\n  type: \"hyperliquid\"\n  testnet: true\n\naccount:\n  max_allocation_pct: 10.0\n\ngrid:\n  symbol: \"BTC\"\n  levels: 10\n  price_range:\n    mode: \"auto\"\n    auto:\n      range_pct: 5.0\n\nrisk_management:\n  stop_loss_enabled: false\n  take_profit_enabled: false\n  max_drawdown_pct: 15.0\n  max_position_size_pct: 40.0\n  rebalance:\n    price_move_threshold_pct: 12.0\n\nmonitoring:\n  log_level: \"INFO\"\n```\n\n---\n\n## Risk features (overview)\n\nWhen enabled in YAML, the stack can act on things like: stop loss, take profit, maximum drawdown, position size limits, and grid rebalancing when price moves outside your band. Defaults are conservative in spirit; read each flag in the sample bot file before enabling live trading.\n\n---\n\n## Python (legacy) and learning examples\n\nThe `src\u002F` tree and `src\u002Frun_bot.py` are the older Python entrypoint. To use them:\n\n```bash\nuv sync\nuv run src\u002Frun_bot.py --validate\nuv run src\u002Frun_bot.py\n```\n\nEducational scripts (market data, orders, websockets) live under `learning_examples\u002F`. Examples:\n\n```bash\nuv run learning_examples\u002F01_websockets\u002Frealtime_prices.py\nuv run learning_examples\u002F02_market_data\u002Fget_all_prices.py\nuv run learning_examples\u002F04_trading\u002Fplace_limit_order.py\n```\n\nUse testnet keys and small sizes when experimenting.\n\n---\n\n## Development\n\n- **TypeScript:** `npx tsc --noEmit` for typecheck; `npm test` for tests. Layout and commands: [ts\u002FREADME.md](ts\u002FREADME.md).\n- **Python:** `uv run …` as above; see `AGENTS.md` \u002F `CLAUDE.md` for repository conventions if you contribute.\n\n### Publishing to `freq-trades` (maintainers)\n\nUse a PAT with **repo** + org permission to push **`main`** to **`github.com\u002Ffreq-trades\u002Fhyperliquid-trading-bot`**. See **`scripts\u002Fpublish-to-polypulse.ps1`** as a template (set **`GITHUB_TOKEN`** for the session only). Never commit tokens.\n\n---\n\n## License and disclaimer\n\nThis software is provided “as is,” without warranty of any kind. You are solely responsible for how you use it, for securing keys and API access, and for compliance with applicable laws and exchange rules in your jurisdiction.\n","Hyperliquid-trading-bot 是一个用于在 Hyperliquid 平台上执行网格交易策略的自动化交易机器人。项目核心功能包括自动放置多层买卖订单、支持基本风险管理规则如止损和止盈等，并且能够进行仓位再平衡。技术上，该项目主要使用 TypeScript 和 Node.js 开发，也保留了部分 Python 代码作为参考。适合对去中心化交易所（DEX）特别是 Hyperliquid 上的永续合约感兴趣的量化交易者或开发者使用。用户可以在测试网中安全地学习和测试该交易机器人的行为模式，以避免实际资金损失。",2,"2026-05-06 17:19:02","CREATED_QUERY"]