Skip to content

5. The Jacobs Ladder experiment

jacobs_ladder.strategy is the strategy file Dio ships. It is provided as a worked example of the strategy layer, and it is the strategy currently running live and publicly on diophantsolutions.com, where its decisions, holdings, and latency are visible to anyone. It is one strategy among the set the engine can run, chosen because it is simple enough to read in full and produces enough activity to be worth observing.

Nothing in the engine depends on it. It is a file in a directory, bound to assets by name in configuration, and section 4 describes what the engine provides to any file placed there.

5.1 What it does

Jacobs Ladder buys price declines and sells the bought base one interval higher, taking every sizing and activity value from the oracle's decision record. It adopts a deliberate survivability posture: it knowingly removes traditional risk controls such as stop-losses, reactive hedging, and position exits, and replaces them with capital survivability constraints computed upstream by the oracle.

Buy placement. Exactly one resting buy sits below the current price and trails upward with it. The buy never crosses above the top bid, respects a minimum move of one tick, and moves down only to correct an actual violation of the restricted zone described next. While any sell is tracked by order management, the buy trails up only to one grid interval below the current price or two intervals below the closest sell, whichever is lower. This zone is price independent and releases only when the sell leaves tracking through fill or cancel. A fresh placement after a fill obeys the same clamp.

Sell placement. Every filled buy owes exactly one sell of what it bought, anchored at the fill price raised by one grid interval. Sells layer, one per filled buy, and once placed are never cancelled. Pending sells are never cancelled either; replacement applies only to previously existing levels, placed furthest out first.

Activity gating. When the oracle marks an asset inactive, the strategy places no new buys and amends no resting buys. The sell leg always runs, because a sell needs inventory. When inventory is first held while inactive, the leg checks whether a sell can be attempted and places it if the balance allows, so a cascading buy execution that consumed all quote resumes selling as quickly as possible. If sellable base sits below the venue minimum order size, the leg logs a warning and skips that sell; the strategy is not paused.

All orders are post-only limit orders with good-till-cancelled time in force stated honestly to the exchange, and orders that would cross the book are rejected.

Why the posture is defensible. This locates risk control upstream of the order. A conventional grid hedges drawdowns with stop-losses or dynamic de-risking at the order level. Jacobs Ladder accepts unrestricted downside exposure at the order level while the oracle constrains aggregate risk structurally: capital is sized so the ladder cannot exhaust before funding a large fraction of the worst decline the asset has ever produced, and spacing and size are resolved from measured history on every pass rather than held constant, so the engine's commitment tracks how much runway the asset has left. The ladder itself trails up resiliently on reversals, using existing sells as anchors.

5.2 Accumulation through reserved base

On profitable sell fills, the persistence layer reserves a slice of base into reserved_base. This reserve is excluded from future sell sizing, so the position grows from trading gains alone, a cost averaging mechanism funded without new capital. A completed cycle earns the resolved interval of price movement less the maker fee on both sides, so the oracle's survival model charges fees on both legs. Because the reserve lives in a persistent store keyed by symbol and venue, accumulation survives engine restarts, and because it is applied at the persistence layer, it works identically on venues with discrete lot sizing.

This is one strategy's use of engine output; the reserved_base mechanism is available to any strategy that wants to net out earned base from its own sell sizing.

5.3 Sentiment-adaptive accumulation threshold

The accumulation_buffer is configured as a [min, max] range on every venue and resolved dynamically using linear interpolation against a sentiment index (the CoinMarketCap Crypto Fear & Greed index for digital assets, the CNN Fear & Greed index for US equities), scaled 0 to 100:

resolved_value = min + (index / 100) * (max - min)

Low sentiment trends the resolved value toward the minimum bound, lowering the accumulation threshold so the position grows more aggressively in fearful markets. High sentiment trends it toward the maximum bound, raising the threshold in euphoric markets. The index is fetched at startup and cached atomically, and re-evaluated whenever the underlying asset moves a configured percentage from the baseline recorded at the last evaluation.

Sentiment plays no other role in sizing. Spacing and order size are resolved exclusively by the oracle's parameter search from measured price history; there is no sentiment-derived and no configuration fallback path for either.

This produces a strategy whose accumulation appetite is automatically more aggressive in fearful markets and more conservative in euphoric ones, while its trading geometry stays anchored to each asset's measured history.

5.4 Reading the file

The strategy is 151 lines and is meant to be read top to bottom. Its opening declares persistent state, its triggers are the three event kinds the ladder reacts to, and the bulk of the file is the ordered cycle: prepare and recover, clean up expired work, synchronise open orders, refresh fees, evaluate the buy gate, place or amend, then plan, place, and finalise the sell leg.

Two features illustrate what the layer can express. The first is that the buy and sell legs are gated independently, so the strategy can be prevented from opening while remaining able to close. The second is that nearly every step carries a compound guard naming several conditions at once, which lets a 151-line file describe a complete trading cycle against a real exchange.