burneh
Trading

A ladder of orders that harvests the chop.

A grid doesn't predict anything. It lays buys below and sells above, and every time price crosses a rung it banks the step and re-arms the other side. It's a genuinely good tool in a ranging market, and a genuinely bad one in a trend, so we build it with the bounds and the kill switch that keep the bad case survivable.

The grid, in real code.

No black box. The whole thing is a short, readable file: a band it works inside, a step between rungs, a size, and a cap. The two rules that matter are re-arm on a fill and halt when price leaves the band.

grid.pypython
1# grid.py — a bounded grid that harvests a ranging market
2from burneh.grid import Grid, Order
3
4class ChopHarvester(Grid):
5 band = (138, 162) # only operate inside this range
6 step = 3 # one rung every $3
7 size = 8 # lots per rung
8 cap = 6 # never hold more than 6 rungs on one side
9
10 def build(self):
11 # lay resting buys below mid and sells above, one every step
12 for level in self.rungs(*self.band, self.step):
13 side = "buy" if level < self.mid else "sell"
14 self.rest(Order(side, level, self.size))
15
16 def on_fill(self, fill):
17 # a fill banks the step and re-arms the other side, one rung away
18 if self.inventory >= self.cap:
19 return self.pause("max inventory — not adding into the move")
20 self.rest(Order.flip(fill, by=self.step))
21
22 def on_leave_band(self, price):
23 # price left the range: the bad case. halt, do not average in.
24 self.cancel_all()
25 self.halt(f"left the band at {price}")
grid · SOL-PERP150.00
162
sell
159
sell
156
sell
153
sell
150
sell
147
buy
144
buy
141
buy
138
buy
working+$0.00

It re-arms as it fills.

Buys rest below the price, sells above. Each time it crosses a rung the order fills, banks the step, and immediately arms the opposite side one rung away. In a market that keeps crossing back and forth, that step gets banked over and over.

The same grid, in two markets.

In a range it does exactly what it's sold to do. In a trend the very same grid stacks losing inventory, until the bound we build in stops it. Switch the market and watch the P&L flip.

live
band floor
0 open lots+$0 realized+$0 unrealized
net profit & loss
+$0

harvesting the chop

Anyone selling a grid as a set-and-forget money printer is selling you only the good half of that sentence.

The bounds are the point.

The danger in a grid is unbounded accumulation into a trend, exactly what you just watched. So every grid we build ships with the brakes on.

Range bounds

It only operates inside a band you set. Price leaves, it stops adding risk.

Max inventory

A hard cap on how much it can hold on one side before it stops buying deeper.

Kill switch

One command halts the grid and cancels every resting order at once.

A grid is a tool for one kind of market, not a forecast for all of them.

When price ranges, a grid is a genuinely good way to earn the back-and-forth. When it trends, the same grid leans the wrong way and bleeds. We don't pretend to know which market you'll get. What we can build is the version that harvests the good one and survives the bad one, because the bounds and the kill switch are in from the first line, not bolted on after a loss.

A ladder of orders that harvests the chop.

It re-arms as it fills, profits in a range and is honest about the trend, and ships bounded with a max-inventory cap and a kill switch.