This bot provides complete manual control of your Hyperliquid account via Telegram, with professional-grade statistics tracking including P&L, win rates, Sharpe ratio, Sortino ratio, and all the metrics you'd expect from a trading platform.

Carles Sentis 5f4d851d65 Refactor trading bot launcher and update Telegram bot features - Simplify the trading bot launcher for systemd deployment, removing error handling and auto-restart features. Introduce a versioning system for the bot and enhance the Telegram bot with a new /version command to display bot and system information. Update welcome messages and command descriptions for clarity and improved user experience. 6 days ago
config 7e3f3b7a7b Enhance trading statistics reporting - Add completed trades metric to TradingStats class and update message formatting to display performance metrics based on completed trades. Improve error handling in stats message and provide informative messages for open positions, enhancing user experience in trading analysis. 6 days ago
docs 9eccf900ad Enhance trading infrastructure and position tracking - Update README with key features of the trading system, including multi-platform support and advanced position tracking. Introduce a new reset_data.sh script for clearing trading data, and add SYSTEM_INTEGRATION.md to document the integration of TradingStats for unified position management. Refactor telegram_bot.py to utilize enhanced tracking methods and improve notification messaging for trade actions. Add tests for integrated position tracking to ensure functionality across multi-entry/exit scenarios. 6 days ago
src 5f4d851d65 Refactor trading bot launcher and update Telegram bot features - Simplify the trading bot launcher for systemd deployment, removing error handling and auto-restart features. Introduce a versioning system for the bot and enhance the Telegram bot with a new /version command to display bot and system information. Update welcome messages and command descriptions for clarity and improved user experience. 6 days ago
tests 81afc9a92a Enhance trading statistics reporting in Telegram bot - Update daily, weekly, and monthly statistics to include performance metrics for days, weeks, and months with no trades. Refactor message formatting to ensure consistent display of trading activity, including summaries for periods without trades. Add tests to verify period stats consistency across different trading scenarios. 6 days ago
utils a456b4a88a Fix Telegram Chat ID finder asyncio issues - Add robust event loop handling and alternative simple script 6 days ago
.gitignore 5b76ad1144 Enhance documentation and update .gitignore - Add comprehensive command reference and project structure documentation, improve README for clarity, and update .gitignore to include test artifacts and temporary files. 6 days ago
README.md 9eccf900ad Enhance trading infrastructure and position tracking - Update README with key features of the trading system, including multi-platform support and advanced position tracking. Introduce a new reset_data.sh script for clearing trading data, and add SYSTEM_INTEGRATION.md to document the integration of TradingStats for unified position management. Refactor telegram_bot.py to utilize enhanced tracking methods and improve notification messaging for trade actions. Add tests for integrated position tracking to ensure functionality across multi-entry/exit scenarios. 6 days ago
requirements.txt 1a4449c4ab Hyperliquid Manual Trading Bot - Complete professional trading solution with Telegram interface, comprehensive statistics, auto-restart, and mobile control 6 days ago
reset_data.sh 9eccf900ad Enhance trading infrastructure and position tracking - Update README with key features of the trading system, including multi-platform support and advanced position tracking. Introduce a new reset_data.sh script for clearing trading data, and add SYSTEM_INTEGRATION.md to document the integration of TradingStats for unified position management. Refactor telegram_bot.py to utilize enhanced tracking methods and improve notification messaging for trade actions. Add tests for integrated position tracking to ensure functionality across multi-entry/exit scenarios. 6 days ago
trading_bot.py 5f4d851d65 Refactor trading bot launcher and update Telegram bot features - Simplify the trading bot launcher for systemd deployment, removing error handling and auto-restart features. Introduce a versioning system for the bot and enhance the Telegram bot with a new /version command to display bot and system information. Update welcome messages and command descriptions for clarity and improved user experience. 6 days ago

README.md

๐Ÿš€ Hyperliquid Manual Trading Bot

Professional-grade manual trading with comprehensive statistics and mobile control

Complete phone control of your Hyperliquid account via Telegram with institutional-level analytics, auto-restart capabilities, and bulletproof data persistence.

CCXT Compatible Testnet Safe Mobile First

๐ŸŽฏ What This Bot Delivers

๐Ÿ“ฑ Phone Trading

  • Complete control from anywhere via Telegram
  • One-tap actions with inline keyboards
  • Instant notifications for trades and errors
  • Mobile-optimized interface design

๐Ÿ“Š Professional Analytics

  • Real-time P&L tracking with percentage returns
  • Advanced metrics: Sharpe ratio, Sortino ratio, VaR (95%)
  • Trade analytics: Win rate, profit factor, expectancy
  • Risk monitoring: Max drawdown, volatility analysis
  • Complete audit trail with order IDs and timestamps

๐Ÿ›ก๏ธ Bulletproof Reliability

  • Auto-restart on errors (up to 10 attempts)
  • Persistent statistics that survive forever
  • Error notifications sent to your phone
  • Comprehensive logging with daily files
  • Graceful shutdown handling

โš™๏ธ CCXT Compatibility

  • Standard authentication following CCXT patterns
  • Enhanced parameters support for advanced trading
  • Future-proof architecture
  • Professional configuration management

๐Ÿš€ Single Command Launch

python trading_bot.py

That's it! This one command:

  • โœ… Starts Telegram bot automatically
  • โœ… Handles all errors and restarts
  • โœ… Sends notifications to your phone
  • โœ… Manages logging and data persistence
  • โœ… Validates configuration before starting

โšก Quick Setup (5 Minutes)

1. Install & Configure

# Clone repository
git clone git@repo.codeskraps.com:codeskraps/ManualTrader.git
cd ManualTrader

# Setup environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Configure bot
cp config/env.example .env
nano .env  # Add your keys

2. Get Telegram Chat ID

# Use the robust script
python utils/get_telegram_chat_id.py

3. Start Trading!

python trading_bot.py

๐Ÿ“ฑ Open Telegram โ†’ Send /start to your bot

๐Ÿ“ Clean Project Structure

ManualTrader/
โ”œโ”€โ”€ ๐Ÿš€ trading_bot.py              # MAIN LAUNCHER (run this!)
โ”œโ”€โ”€ ๐Ÿ“Š trading_stats.json          # Your persistent statistics  
โ”œโ”€โ”€ ๐Ÿ“ .env                        # Your configuration
โ”‚
โ”œโ”€โ”€ ๐Ÿ”ง src/                        # Core modules
โ”‚   โ”œโ”€โ”€ config.py                  # CCXT-style configuration
โ”‚   โ”œโ”€โ”€ hyperliquid_client.py      # Enhanced API wrapper
โ”‚   โ”œโ”€โ”€ telegram_bot.py            # Mobile-optimized interface
โ”‚   โ””โ”€โ”€ trading_stats.py           # Professional analytics
โ”‚
โ”œโ”€โ”€ ๐Ÿ› ๏ธ utils/                      # Setup & maintenance tools
โ”‚   โ”œโ”€โ”€ get_telegram_chat_id.py   # Robust Chat ID finder
โ”‚   โ”œโ”€โ”€ simple_chat_id.py         # Alternative for servers
โ”‚   โ”œโ”€โ”€ demo_stats.py             # See sample statistics
โ”‚   โ””โ”€โ”€ [other utilities]
โ”‚
โ”œโ”€โ”€ โš™๏ธ config/                     # Configuration templates
โ”œโ”€โ”€ ๐Ÿ“‹ logs/                       # Auto-created logs & errors
โ””โ”€โ”€ ๐Ÿ“– docs/                       # Organized documentation

๐Ÿ“ฑ Mobile Trading Interface

Quick Commands

/start      # Main menu with instant buttons
/balance    # Real-time balance + P&L
/stats      # Complete trading statistics
/positions  # Open positions with P&L
/orders     # Pending orders

Trading Commands

/buy 0.001 50000    # Buy 0.001 BTC at $50,000
/sell 0.001 55000   # Sell 0.001 BTC at $55,000

Instant Action Buttons

Send /start for one-tap access to:

  • ๐Ÿ’ฐ Balance, ๐Ÿ“Š Stats, ๐Ÿ“ˆ Positions, ๐Ÿ“‹ Orders, ๐Ÿ’ต Price

๐Ÿ“Š Professional Statistics

๐Ÿ“Š Trading Statistics

๐Ÿ’ฐ Balance Overview
โ€ข Initial: $1,000.00        โ† Starting balance (never lost)
โ€ข Current: $1,150.00        โ† Real-time balance
โ€ข Total P&L: $150.00        โ† Profit/Loss
โ€ข Total Return: 15.00%      โ† Percentage return

๐Ÿ“ˆ Trading Activity  
โ€ข Total Trades: 25          โ† Complete trade count
โ€ข Buy Orders: 13            โ† Order breakdown
โ€ข Sell Orders: 12
โ€ข Days Active: 30           โ† Since first launch

๐Ÿ† Performance Metrics
โ€ข Win Rate: 68.0%           โ† Profitable trades %
โ€ข Profit Factor: 2.15       โ† Gains รท Losses
โ€ข Avg Win: $45.50           โ† Average winning trade
โ€ข Avg Loss: $28.75          โ† Average losing trade
โ€ข Expectancy: $6.25         โ† Expected $ per trade

๐Ÿ“Š Risk Metrics
โ€ข Sharpe Ratio: 1.85        โ† Risk-adjusted returns
โ€ข Sortino Ratio: 2.41       โ† Downside risk metric
โ€ข Max Drawdown: 8.5%        โ† Worst decline from peak
โ€ข Volatility: 12.3%         โ† Price volatility
โ€ข VaR (95%): 3.2%          โ† Value at Risk

๐ŸŽฏ Best/Worst Performance
โ€ข Largest Win: $125.00      โ† Best single trade
โ€ข Largest Loss: $75.00      โ† Worst single trade
โ€ข Max Consecutive Wins: 5   โ† Winning streaks
โ€ข Max Consecutive Losses: 2 โ† Losing streaks

๐Ÿ“… Tracking Since: 2024-01-15

โš™๏ธ CCXT-Style Configuration

Following CCXT standards for exchange compatibility:

# Hyperliquid API (CCXT Style)
HYPERLIQUID_PRIVATE_KEY=your_private_key_here
HYPERLIQUID_SECRET_KEY=your_secret_key_here
HYPERLIQUID_TESTNET=true

# Telegram Bot
TELEGRAM_BOT_TOKEN=your_token_from_botfather
TELEGRAM_CHAT_ID=your_chat_id_here
TELEGRAM_ENABLED=true

# Trading Settings
DEFAULT_TRADING_SYMBOL=BTC/USDC:USDC
DEFAULT_TRADE_AMOUNT=0.001

๐Ÿ›ก๏ธ Built-in Safety Features

๐Ÿ“Š Data Protection

  • Statistics never lost - saved to trading_stats.json
  • Automatic backups via comprehensive logging
  • Persistent between restarts - your data survives forever

๐Ÿ”„ Error Recovery

  • Auto-restart up to 10 attempts with exponential backoff
  • Telegram error notifications sent to your phone
  • Comprehensive logging to daily files
  • Graceful shutdown on Ctrl+C

โš ๏ธ Trading Safety

  • Testnet default - safe testing environment
  • Order confirmations - all trades require approval
  • Balance monitoring - real-time P&L tracking
  • Clear error messages with troubleshooting tips

๐ŸŽฎ Demo & Testing

See Sample Statistics

python utils/demo_stats.py

Shows you exactly what metrics the bot will track.

Test Configuration

python -c "import sys; sys.path.insert(0, 'src'); from config import Config; Config.validate()"

Alternative Chat ID Finder

# If the main script has issues
python utils/simple_chat_id.py

๐Ÿ“– Documentation

Guide Purpose Quick Link
Setup Guide 5-minute installation ๐Ÿ“– docs/setup.md
Commands Reference Complete command guide ๐Ÿ“– docs/commands.md
Project Structure Codebase organization ๐Ÿ“– docs/project-structure.md
Deployment Guide Production deployment ๐Ÿ“– docs/deployment.md

๐Ÿšจ Important Notes

Start with Testnet

  • Bot defaults to testnet mode (safe testing)
  • Get testnet keys from Hyperliquid Testnet
  • Switch to mainnet only when fully tested

Your Keys

  • Private Key: From Hyperliquid account settings
  • Secret Key: May be optional depending on implementation
  • Keep secure - never share your private keys

Statistics Persistence

  • โœ… YES - All statistics are permanently saved
  • โœ… Survives restarts - data loads automatically
  • โœ… Never lost - comprehensive backup via logging

๐Ÿ” Troubleshooting

Bot Won't Start

# Check configuration
python -c "import sys; sys.path.insert(0, 'src'); from config import Config; Config.validate()"

# Try alternative Chat ID finder
python utils/simple_chat_id.py

Telegram Issues

  1. Verify bot token from @BotFather
  2. Ensure you messaged your bot first
  3. Check Chat ID with utility scripts

Trading Problems

  1. Confirm sufficient balance
  2. Verify network connectivity
  3. Check logs in logs/ directory

๐ŸŽฏ What Makes This Special

  • ๐Ÿš€ One command - python trading_bot.py runs everything
  • ๐Ÿ“ฑ Professional mobile interface - institutional-grade phone trading
  • ๐Ÿ“Š Complete analytics - every metric you need from day one
  • ๐Ÿ›ก๏ธ Bulletproof reliability - auto-restart with error notifications
  • ๐Ÿ’พ Never lose data - statistics persist forever
  • โš™๏ธ CCXT compatible - follows industry standards
  • ๐Ÿงน Clean organization - logical folder structure
  • ๐Ÿ“– Complete documentation - guides for every use case

Get institutional-grade trading infrastructure with simple phone control! ๐Ÿš€๐Ÿ“ฑ

๐ŸŽฏ Key Features

Enhanced Trading Operations

  • Multi-Platform Support: Direct integration with Hyperliquid perpetuals trading
  • Smart Order Management: Long/short positions with market and limit orders
  • Advanced Position Tracking: Multi-entry/exit scenarios with weighted average calculations
  • Integrated Analytics: Single source of truth for position tracking and performance analysis
  • Risk Management: Automatic stop-loss functionality with customizable triggers

System Architecture

  • Unified Position Tracking: Integrated TradingStats system provides consistent position management
  • Real-Time Notifications: Context-aware alerts for position opens, increases, reductions, and closes
  • Multi-Entry/Exit Support: Advanced tracking for complex trading scenarios with accurate P&L calculations
  • Data Consistency: Single source of truth eliminates discrepancies between real-time and historical data