grid_trader.md 4.7 KB

Grid Trader

Passive, structure-based liquidity strategy.

Best Used When

  • price is range-bound or choppy
  • volatility is low to moderate
  • liquidity is decent
  • Hermes wants to harvest mean reversion inside a structure

Avoid When

  • trend is strong and persistent
  • event risk is high
  • liquidity is thin or chaotic
  • execution quality is poor

How It Works

  • The strategy keeps a live base grid step, then derives side-specific buy and sell spacing from wallet imbalance.
  • ATR can override the configured base step. When ATR is available, grid_step_pct is a fallback rather than the final live step.
  • The live step is floored by grid_step_min_pct and capped by grid_step_max_pct.
  • Inventory skew only reduces the favored side. If the live step is already at the floor, the skew can disappear entirely.
  • Grid rebuilds use a separate recenter threshold built from recenter_pct, ATR, and the recenter clamps.
  • report() and render() expose the live base step plus the effective buy/sell split and current rebalance bias.

Parameters

  • grid_levels: Number of order levels per side.
  • grid_step_pct: Base spacing when ATR is unavailable or zero. If ATR exists, this is only the fallback seed.
  • volatility_timeframe: ATR source timeframe used for live spacing and recenter calculations.
  • volatility_multiplier: Multiplier applied to ATR to produce the live step when ATR is available.
  • grid_step_min_pct: Minimum allowed live step. This floor also applies after inventory skew, so it can erase the visible skew if set too high.
  • grid_step_max_pct: Maximum allowed live step.
  • inventory_rebalance_step_factor: Maximum fractional reduction applied to the favored side. The actual reduction is factor * imbalance.
  • order_notional_quote: Target quote notional per order.
  • max_order_notional_quote: Optional hard cap on quote notional per order.
  • recenter_pct: Fallback recenter threshold when ATR is unavailable.
  • recenter_atr_multiplier: Multiplier applied to ATR to derive the live recenter threshold.
  • recenter_min_pct: Minimum recenter threshold floor.
  • recenter_max_pct: Maximum recenter threshold ceiling.
  • trade_sides: Intended side selection. both is the normal mode; other values are not a separate one-sided grid design and may be constrained by rebuild logic.
  • dust_collect: Allows the shared sizing helper to use leftover size more aggressively when a venue minimum would otherwise strand a small remainder.
  • order_call_delay_ms: Delay between sequential order placements during seeding or rebuild.
  • debug_orders: Enables order-placement debug logging.

Hermes Policy Mapping

  • risk_posture adjusts grid spacing, levels, recentering, and cadence when policy is applied.
  • priority can override the risk posture to make the strategy more cautious or more aggressive.
  • In current code, apply_policy() rewrites grid_step_pct, recenter_pct, grid_levels, and order_call_delay_ms from policy.

Notes

  • The strategy does not decide regime fit itself.
  • Hermes decides activation.
  • Trader applies policy on reconcile.
  • report().supervision is descriptive, not imperative.
  • side_capacity and inventory_pressure describe the grid's current shape.
  • The grid step is asymmetric only when inventory is imbalanced enough to beat the minimum step floor.
  • If base value dominates quote value, the sell ladder is tightened to encourage rebalancing back into quote.
  • If quote value dominates base value, the buy ladder is tightened to encourage rebalancing back into base.
  • inventory_rebalance_step_factor is a cap, not a fixed override: small imbalances apply a small reduction and extreme imbalances apply up to the configured maximum reduction on the favored side only.
  • ordinary directional conditions alone should not force a rebuild or switch.
  • live fee rates are used directly, and the quote notional is the canonical sizing unit.
  • quote sizing flows through the shared strategy sizing helper, so grid and directional strategies use the same fee-aware notional rules.

Useful Example

{
  "grid_levels": 6,
  "grid_step_pct": 0.009,
  "volatility_timeframe": "15m",
  "volatility_multiplier": 1.5,
  "grid_step_min_pct": 0.001,
  "grid_step_max_pct": 0.03,
  "inventory_rebalance_step_factor": 0.4,
  "order_notional_quote": 25,
  "max_order_notional_quote": 50,
  "recenter_pct": 0.03,
  "recenter_atr_multiplier": 0.35,
  "recenter_min_pct": 0.002,
  "recenter_max_pct": 0.03,
  "trade_sides": "both",
  "dust_collect": true,
  "order_call_delay_ms": 150,
  "debug_orders": false
}

This is a practical low-to-moderate volatility setup. It keeps the minimum step low enough that inventory skew can still show up, while still letting ATR drive the live spacing when the market gets more active.