momentum is the template: it has its own price_buffer/fair_buffer and uses them directly. To give late_entry (and deep_value/adding)
their own, edit 3 places per strategy:
- LateEntry struct at
config.rs:205— addpub price_buffer: f64,andpub fair_buffer: f64,, and defaults in its Default impl (e.g. late_entry higher:price_buffer: 0.03). - Copy exactly how Momentum does it: fields at config.rs:156-157, defaults at config.rs:170-171.
- Under [
strategy.late_entry] (line 55), add:price_buffer = 0.03fair_buffer = 0.04 - (Template: [
strategy.momentum] at line 33, price_buffer/fair_buffer at 42–43.)
- src/strategy/late_entry.rs:53 — change:
let limit = buy_limit(ask, fair, ctx.cfg.execution.entry_price_buffer, ctx.cfg.execution.entry_fair_buffer); - to:
let limit = buy_limit(ask, fair, l.price_buffer, l.fair_buffer); - (
l = &ctx.cfg.strategy.late_entryis already bound at line 12/20.) - Same for deep_value.rs:54 →
d.price_buffer, d.fair_buffer, and adding.rs:48 (bindlet a = &ctx.cfg.strategy.adding;first).
Run from trading-engine-rust/:
# 1. Compile — engine + all binaries (live_selftest, balance_check). Catches type/borrow errors.
cargo build --release
# 2. Unit tests — all 85: signing known-answer vectors, strategy firing, exits,
# storage/rotation, config defaults. This is what caught your fair_buffer issue.
cargo test --release
# 3. Lints — treat warnings as must-fix.
cargo clippy --release
# 4. Config parses — a TOML syntax error is NOT caught by build/test (it's runtime),
## so validate config/strategy.toml explicitly:
python3 -c "import tomllib; tomllib.load(open('config/strategy.toml','rb')); print('TOML OK')"Details / why each matters:
- Build ≠ config-valid. Steps 1–3 never touch
strategy.toml, so I always add step 4 — that colon bug would sail through build+test+clippy and only die on the server at startup. - For behavior changes (not just config), I also do a targeted runtime check: the /verify skill, or for live-order-path changes I gate with the self-test (
LIVE_SELFTEST=1 ./target/release/live_selftest— places+cancels one resting order, zero fills) before any continuous live run.