Skip to content

Conversation

perplover
Copy link
Contributor

Summary

Adds a basic grid trading bot implementation that creates and maintains a grid of buy and sell orders around a central price. The bot automatically replaces filled orders with new ones on the opposite side, creating a mean-reversion trading strategy.

Features

  • Creates a symmetric grid of buy/sell orders around the current market price
  • Configurable grid size and price spacing
  • Automatic order replacement when orders are filled
  • Error handling and retries for continuous operation. TODO: exponential backoff and quit after X tries
  • Adds tests

Implementation

  • GridTradingBot class in examples/basic_grid_trading_bot.py
  • Uses Hyperliquid's L2 book data for price discovery
  • Places limit orders with GTC (Good Till Cancel) time in force
  • Monitors order status and replaces filled orders
  • Input validation for grid parameters

Example

from examples.basic_grid_trading_bot import GridTradingBot

bot = GridTradingBot(
    coin="ETH",          # Trading ETH
    grid_size=5,         # 5 orders on each side
    price_spacing_percent=0.01,  # 1% between each level
    order_size=0.1       # 0.1 ETH per order
)
bot.run()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant