[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83349":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":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":10,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":25,"discoverSource":26},83349,"HTX-human-elite-copy-trading-bot","HTX-Trading-ToolKit\u002FHTX-human-elite-copy-trading-bot","HTX-Trading-ToolKit","HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot HTX Human Elite Copy Trading Bot","",null,"TypeScript",28,36,2,1,0,67,4.7,false,"main",true,[],"2026-06-12 02:04:33","# HTX Human Elite Copy Trading Bot\n\nA production-grade TypeScript bot that mirrors **HTX (Huobi) human elite lead traders** on USDT-margined linear swap futures. It watches configured elite traders, detects position changes in real time, and copies trades using **Smart Copy** (proportional to leader fund usage), **Fixed Ratio**, or **Elite Sentiment** strategies — with full risk controls and paper trading.\n\n## Features\n\n- **Human Elite Copy Trading** — Follow multiple HTX lead traders and mirror their futures positions automatically\n- **Smart Copy Mode** — HTX Copy Trading 4.0–style proportional sizing based on leader AUM vs. exposure ratio\n- **Fixed Ratio Mode** — Copy a fixed percentage of leader contract volume\n- **Elite Sentiment Mode** — Trade using HTX public elite trader sentiment indices (`swap_elite_account_ratio`, `swap_elite_position_ratio`)\n- **Paper Trading** — Full simulation engine with mock elite traders for risk-free testing\n- **Live Trading** — Direct HTX USDT linear swap API integration with HMAC-SHA256 signing\n- **Risk Management** — Stop loss, take profit, max position size, max daily loss, max open positions\n- **State Persistence** — Resume leader snapshots and trade counts across restarts\n- **Graceful Shutdown** — Persists state on SIGINT\u002FSIGTERM\n- **Structured Logging** — Pino-based logging with configurable levels\n- **Type-Safe Config** — Zod schema validation for all environment variables\n\n## How Copy Trading Works\n\n```\nElite Lead Trader                Copy Engine                    Your Account\n─────────────────               ─────────────                  ──────────────\nOpens BTC-USDT LONG    ──▶   Detect position change    ──▶   Mirror LONG\n  20 contracts @ 5x           Calculate smart volume          (proportional)\nAdjusts to 30 contracts ──▶  Delta = +10 contracts    ──▶   Add to position\nCloses position        ──▶   Detect close event       ──▶   Close yours\n```\n\n**Smart Copy** calculates your order size so your exposure ratio matches the leader's fund usage — the same principle as HTX Smart Copy mode.\n\n**Elite Sentiment** uses HTX's public top-trader sentiment API when you prefer aggregate elite bias over following a specific trader.\n\n## Project Structure\n\n```\nHTX-human-elite-copy-trading-bot\u002F\n├── src\u002F\n│   ├── cli\u002F              # CLI entry (start, validate, leaders, sentiment, dry-run)\n│   ├── config\u002F           # Zod-validated environment configuration\n│   ├── core\u002F             # Copy engine — leader diffing and trade execution\n│   ├── exchange\u002F         # HTX API client, paper simulator, leader feed\n│   ├── risk\u002F             # Stop loss, take profit, position limits\n│   ├── services\u002F         # Bot orchestration and state persistence\n│   ├── strategies\u002F       # Smart copy, fixed ratio, elite sentiment logic\n│   ├── types\u002F            # Shared TypeScript interfaces\n│   └── utils\u002F            # Logger, retry, formatting helpers\n├── tests\u002F                # Unit and integration tests (Vitest)\n├── .env.example          # Environment variable template\n├── package.json\n└── tsconfig.json\n```\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js 18 or higher\n- npm 9 or higher\n- HTX account with API key enabled for futures (for live trading)\n\n### Setup\n\n```bash\ncd HTX-human-elite-copy-trading-bot\nnpm install\ncp .env.example .env\n```\n\nEdit `.env` with your configuration:\n\n```env\nHTX_API_KEY=your_api_key_here\nHTX_API_SECRET=your_api_secret_here\nCONTRACT_CODE=BTC-USDT\nLEAD_TRADER_IDS=elite_alpha,elite_beta\nCOPY_MODE=smart\nLEVERAGE=5\nPAPER_TRADING=true\n```\n\n### Validate Configuration\n\n```bash\nnpm run dev -- validate\n```\n\n### List Elite Lead Traders\n\n```bash\nnpm run dev -- leaders\n```\n\n### Check Elite Trader Sentiment\n\n```bash\nnpm run dev -- sentiment\n```\n\n### Dry Run (Single Poll Cycle)\n\n```bash\nnpm run dev -- dry-run\n```\n\n### Start the Bot (Paper Trading)\n\n```bash\nnpm run dev -- start\n```\n\n### Start the Bot (Live Trading)\n\nSet `PAPER_TRADING=false` in `.env`, then:\n\n```bash\nnpm run build\nnpm start -- start\n```\n\n## Configuration Reference\n\n| Variable | Description | Default |\n|---|---|---|\n| `HTX_API_KEY` | HTX API access key | — |\n| `HTX_API_SECRET` | HTX API secret key | — |\n| `CONTRACT_CODE` | USDT linear swap pair (e.g. BTC-USDT) | BTC-USDT |\n| `LEAD_TRADER_IDS` | Comma-separated elite trader IDs | — |\n| `COPY_MODE` | `smart`, `fixed`, or `elite_sentiment` | smart |\n| `COPY_RATIO` | Fixed copy ratio (when COPY_MODE=fixed) | 0.1 |\n| `MAX_EQUITY_PER_TRADE` | Max equity fraction per copied trade | 0.05 |\n| `LEVERAGE` | Leverage for copied positions | 5 |\n| `ACCOUNT_BALANCE_USDT` | Paper trading starting balance | 10000 |\n| `MAX_POSITION_USDT` | Max notional per position | 5000 |\n| `STOP_LOSS_PERCENT` | Auto-close at this loss % | 5 |\n| `TAKE_PROFIT_PERCENT` | Auto-close at this profit % | 15 |\n| `MAX_DAILY_LOSS_USDT` | Halt copying after daily loss | 500 |\n| `MAX_OPEN_POSITIONS` | Max simultaneous positions | 3 |\n| `ELITE_SENTIMENT_PERIOD` | Sentiment candle period | 60min |\n| `ELITE_LONG_THRESHOLD` | Go long above this buy ratio | 0.55 |\n| `ELITE_SHORT_THRESHOLD` | Go short below this buy ratio | 0.45 |\n| `PAPER_TRADING` | `true` for simulation | true |\n| `POLL_INTERVAL_MS` | Leader poll interval (ms) | 10000 |\n| `USE_TESTNET` | Use HTX testnet endpoint | false |\n| `LOG_LEVEL` | trace \u002F debug \u002F info \u002F warn \u002F error | info |\n\n## CLI Commands\n\n| Command | Description |\n|---|---|\n| `start` | Start the copy trading bot |\n| `validate` | Validate `.env` configuration |\n| `leaders` | List configured elite lead traders |\n| `sentiment` | Show HTX elite trader sentiment |\n| `dry-run` | Run one poll cycle and show stats |\n\n## Copy Mode Selection Guide\n\n| Goal | Recommended Mode | Settings |\n|---|---|---|\n| Mirror specific elite traders | `smart` | Set `LEAD_TRADER_IDS`, tune `MAX_EQUITY_PER_TRADE` |\n| Simple proportional copy | `fixed` | Set `COPY_RATIO=0.1` (10% of leader volume) |\n| Follow aggregate elite bias | `elite_sentiment` | Tune `ELITE_LONG_THRESHOLD` \u002F `ELITE_SHORT_THRESHOLD` |\n\n## Development\n\n```bash\n# Run tests\nnpm test\n\n# Type checking\nnpm run typecheck\n\n# Lint\nnpm run lint\n\n# Development mode\nnpm run dev -- start\n```\n\n## Risk Disclaimer\n\nCryptocurrency futures trading involves substantial risk of loss, including the possibility of losing more than your initial investment through leverage. Copy trading does not guarantee the same results as elite lead traders. This bot is provided as-is with no guarantees of profitability. Always test thoroughly in paper trading mode before deploying real funds. Never invest more than you can afford to lose.\n\n## License\n\nMIT\n\n---\n\n\u003Cdiv align=\"center\">\n\n## 💬 Technical Support\n\n### 👉 Telegram: [@tradingtermin](https:\u002F\u002Ft.me\u002Ftradingtermin)\n\n**Need help with setup, configuration, or troubleshooting?**\n\nContact **@tradingtermin** on Telegram for:\n\n| | |\n|---|---|\n| 🔧 | Installation and configuration help |\n| 📊 | Copy strategy tuning and elite trader selection |\n| 🐛 | Bug reports and feature requests |\n| 🚀 | Live trading setup guidance |\n\n**[@tradingtermin](https:\u002F\u002Ft.me\u002Ftradingtermin)** · [t.me\u002Ftradingtermin](https:\u002F\u002Ft.me\u002Ftradingtermin)\n\n\u003C\u002Fdiv>\n","2026-06-11 04:11:01","CREATED_QUERY"]