OpenMM Grid Trading
by @adacapo21
Create and manage grid trading strategies with OpenMM. Automated buy/sell around center price.
clawhub install openmm-grid-tradingπ About This Skill
name: openmm-grid-trading version: 0.1.0 description: "Create and manage grid trading strategies with OpenMM. Automated buy/sell around center price." tags: [openmm, grid, trading, strategy, automation] metadata: openclaw: emoji: "π" requires: bins: [openmm] env: [MEXC_API_KEY, GATEIO_API_KEY, BITGET_API_KEY, KRAKEN_API_KEY] install: - kind: node package: "@3rd-eye-labs/openmm" bins: [openmm]
OpenMM Grid Trading
Create automated grid trading strategies that profit from market volatility.
What is Grid Trading?
Grid trading places multiple buy and sell orders at preset price intervals around the current center price. As price oscillates, the bot automatically:
The grid uses levels per side and spacing to distribute orders. With 5 levels and 2% spacing (linear), orders are placed at 2%, 4%, 6%, 8%, 10% from center on both sides (10 total orders).
When to Use
Good for:
Avoid when:
Quick Start
1. Dry Run First (Always!)
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT --dry-run
2. Start Grid with Defaults
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT
3. Custom Configuration
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT \
--levels 5 \
--spacing 0.02 \
--size 50 \
--max-position 0.6 \
--safety-reserve 0.3
4. Stop the Strategy
Press Ctrl+C to gracefully stop. The system will:
1. Cancel all open orders
2. Disconnect from exchange
3. Display final status
Command Options
Required Parameters
--strategy grid β Specifies grid trading strategy--exchange β Exchange to trade on (mexc, bitget, gateio, kraken)--symbol β Trading pair (e.g., INDY/USDT, SNEK/USDT, ADA/EUR)Grid Parameters
| Parameter | Description | Default | |-----------|-------------|---------| |--levels | Grid levels each side (max: 10, total = levels x 2) | 5 |
| --spacing | Base price spacing between levels (0.02 = 2%) | 0.02 |
| --size | Base order size in quote currency | 50 |
| --confidence | Minimum price confidence to trade | 0.6 |
| --deviation | Price deviation to trigger grid recreation | 0.015 |
| --debounce | Delay between grid adjustments | 2000 |
| --max-position | Max position size as % of balance | 0.8 |
| --safety-reserve | Safety reserve as % of balance | 0.2 |
| --dry-run | Simulate without placing real orders | β |Dynamic Grid Parameters
| Parameter | Description | Default | |-----------|-------------|---------| |--spacing-model | linear, geometric, or custom | linear |
| --spacing-factor | Geometric spacing multiplier per level | 1.3 |
| --size-model | flat, pyramidal, or custom | flat |
| --grid-profile | Load grid config from a JSON profile file | β |Volatility Parameters
| Parameter | Description | Default | |-----------|-------------|---------| |--volatility | Enable volatility-based spread adjustment | off |
| --volatility-low | Low volatility threshold | 0.02 |
| --volatility-high | High volatility threshold | 0.05 |Spacing Models
Linear (default): Equal spacing between all levels.
With --spacing 0.02 and 5 levels:
Level 1: 2% from center
Level 2: 4% from center
Level 3: 6% from center
Level 4: 8% from center
Level 5: 10% from center
Geometric: Tighter spacing near center, wider gaps at outer levels.
openmm trade --strategy grid --exchange kraken --symbol BTC/USD \
--levels 5 --spacing 0.005 --spacing-model geometric --spacing-factor 1.5
Level 1: 0.50% from center
Level 2: 1.25% from center
Level 3: 2.38% from center
Level 4: 4.06% from center
Level 5: 6.59% from center
Custom: Define exact spacing offsets per level using a grid profile JSON file.
Size Models
Flat (default): All levels get equal order sizes.
Pyramidal: Larger orders near center price where fills are more likely, tapering at outer levels.
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT \
--levels 5 --size 50 --size-model pyramidal
Grid Profiles
JSON files for complete grid configuration:
{
"name": "balanced-geometric",
"description": "Geometric spacing with pyramidal sizing",
"levels": 10,
"spacingModel": "geometric",
"baseSpacing": 0.005,
"spacingFactor": 1.3,
"sizeModel": "pyramidal",
"baseSize": 50
}
openmm trade --strategy grid --exchange gateio --symbol SNEK/USDT \
--grid-profile ./profiles/balanced-geometric.json
Volatility-Based Spread Adjustment
When enabled, the grid automatically widens during volatile conditions and tightens when the market calms. Tracks price changes over a 5-minute rolling window.
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT \
--levels 10 \
--spacing 0.005 \
--spacing-model geometric \
--spacing-factor 1.3 \
--size-model pyramidal \
--size 5 \
--volatility
Trading Examples
Conservative
openmm trade --strategy grid --exchange bitget --symbol SNEK/USDT \
--levels 2 \
--spacing 0.02 \
--size 20
Active
openmm trade --strategy grid --exchange mexc --symbol BTC/USDT \
--levels 7 \
--spacing 0.005 \
--size 25
Dynamic (Geometric + Pyramidal)
openmm trade --strategy grid --exchange kraken --symbol SNEK/EUR \
--levels 10 \
--spacing 0.005 \
--spacing-model geometric \
--spacing-factor 1.5 \
--size-model pyramidal \
--size 5
Risk Management
--max-position β Maximum % of balance used for trading (default: 80%)--safety-reserve β % of balance kept as reserve (default: 20%)--confidence β Minimum price confidence required (default: 60%)--deviation)Exchange-Specific Notes
MEXC/Gate.io: Minimum order value 1 USDT per order Bitget: Minimum 1 USDT. Requires API key, secret, and passphrase. 6 decimal price precision for SNEK/NIGHT pairs. Kraken: Minimum 5 EUR/USD per order. Supports major fiat pairs (EUR, USD, GBP).
Tips for Agents
1. Always dry-run first β show user the plan before executing
2. Check balance β verify sufficient funds with openmm balance --exchange
3. Check current price β use openmm ticker --exchange
4. Respect minimum order values β ensure --size divided by --levels meets exchange minimums
5. Use Ctrl+C to stop β graceful shutdown cancels all open orders
β‘ When to Use
π‘ Examples
1. Dry Run First (Always!)
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT --dry-run
2. Start Grid with Defaults
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT
3. Custom Configuration
openmm trade --strategy grid --exchange mexc --symbol INDY/USDT \
--levels 5 \
--spacing 0.02 \
--size 50 \
--max-position 0.6 \
--safety-reserve 0.3
4. Stop the Strategy
Press Ctrl+C to gracefully stop. The system will:
1. Cancel all open orders
2. Disconnect from exchange
3. Display final status