Commit Graph

87 Commits

Author SHA1 Message Date
jgrusewski
fd9534e978 feat(exec): multistrat book on Alpaca — target-weight bridge + crypto BTC leg
Puts the adaptive multi-strat ETF book on the clean execution port:
- multistrat.target_weights(closes): exposes the final-day per-instrument weights
  (L*tw*volnorm_scale) that book_series applies but only collapses into a return.
  Refactored _volnorm via a shared _volnorm_scale so book_series stays byte-identical.
  Tested: sum(w*R[last]) reconstructs book_series's last booked return exactly.
- ExecutionService.rebalance_weights(weights, prices): a direct pre-computed-weights
  entry beside rebalance(book), sharing one _plan engine (gates + fractional sizing).
  Caller owns data<->broker symbol mapping.
- AlpacaBroker crypto-aware: a slash symbol (BTC/USD) -> time_in_force gtc; equities
  stay day. So the book's BTC-USD leg trades on Alpaca crypto alongside the 5 ETFs.
- CLI fxhnt execute-multistrat (maps BTC-USD -> BTC/USD); the alpaca-rebalancer
  CronJob now runs it (suspended until paper keys).

Full suite green (1832); +5 tests. Alpaca-crypto position-symbol form validated on
first paper run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 00:33:22 +02:00
jgrusewski
5b2cb72500 docs: spec — Alpaca execution foundation (fractional US-equity venue)
AlpacaBroker (httpx REST, Broker port) + fractional-aware ExecutionService +
paper-first CronJob. Runs on the survivor book (fxhnt execute --broker alpaca)
end-to-end. The multi-strat ETF book's position logic is NOT on the clean port
(only its return series is; live exec is an archived out-of-repo foxhunt script),
so putting THAT book on Alpaca (weight-extraction + ExecutionService bridge +
BTC-USD leg) is an explicit follow-up reusing this foundation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 23:48:26 +02:00
jgrusewski
adc3d96d60 docs: spec update — add tail-concentration cap + drop glitch-guard (moves are real)
OHLC/spot investigation: the +150% microcap days are REAL (HUSDT +154% spot-
corroborated, $214M turnover, capturable at $100k) — NOT glitches. So the fix is
capacity-cap (scale protection) + an ISV-driven per-coin tail-concentration cap
(contribution <= K*sigma_book, gains-only) to cut the fat-right-tail dependence
(28% of return from 10 days), NOT a glitch guard (would suppress real gains).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 22:23:37 +02:00
jgrusewski
b737445a67 docs: spec — positioning capacity-aware realized returns
Cap each coin's realized GAIN by a capacity fraction min(1, pi*med_turnover/(capital*|w|))
in _book_breakdown (the SSOT for the positioning forward + gate ref + 4-edge book).
Gains-only/conservative; capital-aware (barely binds at $100k where positioning IS
capturable, caps thin names as capital scales). Fixes the microcap-squeeze overstatement
(28% of return from 10 uncapturable +150% microcap days) the investigation surfaced.
Data-glitch filtering + other sleeves are non-goals.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 22:16:39 +02:00
jgrusewski
f258222094 docs: FALSIFY H2 spec — vol-target overlay is reactive de-sizing in disguise
Ran the spec's own anti-pro-cyclical gate early (pre-build): the +0.24 OOS book
Sharpe is pure vol-shrinkage, not return (daily diff -0.31bp, t=-0.65). The
de-risk misses more upside than downside it avoids (net -10.8%) and cuts hardest
before top-decile up days (0.854 vs 0.904) = the cut-before-the-bounce signature.
In crypto-bull, high vol correlates with drawdown-then-bounce, so vol-conditioning
== the 3x-rejected drawdown de-sizing in effect. Not built; raw momentum stands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 20:02:23 +02:00
jgrusewski
f34fa0b856 docs: spec H2 — back-compute+swap deploy, multi-condition gate 1
Q2 (deterministic warehouse-backed sleeve): drop the separate 2-3wk shadow wait.
Back-compute vol-targeted momentum + book over backtest + elapsed forward; if
gates pass, swap into bybit_4edge (re-inceptions 0/21) and let the book's own
21-day gate be the frozen-forward validation. Contrast xsfunding (live-snapshot,
un-backfillable). Q1: gate 1 becomes multi-condition (net Sharpe >=+0.15 AND DD
non-worse AND per-year consistent AND anti-pro-cyclical clean) instead of a
brittle single +0.2 point.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 19:43:33 +02:00
jgrusewski
9e3040be04 docs: spec — momentum-sleeve vol-target overlay (H2), de-risk-only, shadow-first
Ex-ante sleeve-level volatility-target overlay on crypto_tstrend (TrendRunner):
scale exposure DOWN in high-realized-vol regimes, never lever (cap=1.0). OOS
investigation (881 test days) shows +0.24 book Sharpe / -1.4pp maxDD, robust
net-of-cost to 40bp/turn and across L/floor params. Distinguished from the 3x
rejected reactive de-sizing (conditions on vol, not drawdown; improves DD).
Strict gates: net-book re-measure >=0.2 Sharpe, anti-pro-cyclical falsification,
per-year consistency. Shadow-first deploy (false-WAIT-safe).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 19:35:23 +02:00
jgrusewski
180bed28ee docs: spec — tail-budgeted levered shape (carry ~40%, bounds -20% dislocation to -8%)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 00:27:07 +02:00
jgrusewski
e706b6488c docs: plan — cockpit levered track views (Backtest measured curve + Replay toggle)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 22:33:27 +02:00
jgrusewski
95b5d9e8b0 docs: spec — surface levered shadow track in cockpit Backtest + Replay
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 22:31:44 +02:00
jgrusewski
e02907684d docs: plan — bybit_4edge levered shadow track (Phase 1, static leverage, observe-only)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:35:02 +02:00
jgrusewski
85a4afa7ab docs: spec — phase leverage overlay (Phase 1 = static-leverage shadow track, observe-only; Phase 2 = adaptive re-tune)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:31:16 +02:00
jgrusewski
09b6af4c75 docs: spec — bybit_4edge leverage overlay (re-tune existing overlay, carry 5-8x, book-gross <=1.5x, -35%/yr ruin cap)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:27:23 +02:00
jgrusewski
dd5500a0ed docs: plan — Bybit testnet real-paper execution leg (Phase 1 task-by-task, TDD)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 13:37:22 +02:00
jgrusewski
7ed3926a13 docs: spec — Bybit testnet real-paper execution leg (v2, post critical-review)
Execution-mechanics validation on Bybit testnet via a SEPARATE Dagster job (no CronJob),
ccxt adapter, market orders, raw-weights + overlay-re-applied-on-testnet-state, decomposed
slippage (execution vs timing, pure+tested), execution-gap verdict. Slippage-magnitude
(unlock 35bp) honestly deferred to mainnet micro-live (thin testnet alt liquidity).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 13:35:44 +02:00
jgrusewski
11ded748bf docs(spec): warehouse->TimescaleDB consolidation (hypertable+compression; we already run timescaledb-pg16)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 16:05:33 +02:00
jgrusewski
0fa36ca454 docs(spec): Bybit ingestion + carry re-validation on the live venue (funding/klines/universe, MiCA note)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 15:51:32 +02:00
jgrusewski
5563f772b5 docs(spec): interactive simulator cockpit + multi-track wiring (configurable sim, slider, 2/3-edge+carry tracks)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:15:16 +02:00
jgrusewski
dfe58fbd9c docs(spec): combined risk stack — K(D*) sizing + WEH structural-retirement + killswitch backstop
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 01:29:51 +02:00
jgrusewski
0149de2535 docs(spec): drawdown controller v1 design (ex-ante DD budget + per-sleeve edge-health, replace whipsaw killswitch)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 00:02:12 +02:00
jgrusewski
dd83251933 docs(carry): tail data-acquisition design (workflow research output, fact-checked)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 17:12:10 +02:00
jgrusewski
931dce4a8a docs(audit): A6 converge-to-2-edge spec (carry live-only + gross-cap + warmup + cycle-validate)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:52:59 +02:00
jgrusewski
39362263a7 docs(audit): paper-book foundation audit (going-in-circles pause)
Maps the 5-layer architecture + 6 confirmed issues (carry P&L not in equity,
gross-not-net leverage cap=6x, no warmup, 1yr-bull overfit -98.9% multi-year,
unreliable offline sweep, unmodellable carry tail) + architectural decisions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:44:24 +02:00
jgrusewski
3d23efd2a8 docs(carry): A5 faithful delta-neutral carry plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:56:54 +02:00
jgrusewski
ffe62307ad docs(carry): A5 faithful delta-neutral carry (spot ingest + basis) design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:55:44 +02:00
jgrusewski
449007018e docs(funding): A4 addendum — xsfunding carry return-source (price-MTM can't see funding)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 12:42:17 +02:00
jgrusewski
66fa02b0cc docs(funding): A4 funding-ingest + xsfunding-replay plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 12:19:45 +02:00
jgrusewski
104cc19774 docs(funding): A4 funding-history ingest + replayable xsfunding design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 12:18:00 +02:00
jgrusewski
a66c5eb7e0 docs(paper): A3h adaptive vol budget plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 11:13:51 +02:00
jgrusewski
6661e987d2 docs(paper): A3h ISV-adaptive vol budget design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 11:11:49 +02:00
jgrusewski
20cafc21fd docs(paper): A3g overlay re-tune plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 10:56:41 +02:00
jgrusewski
d5f867adea docs(paper): A3g overlay re-tune design (30% full-Kelly, dormant wide kill, drop gate)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 10:55:48 +02:00
jgrusewski
f5d0e7f31c docs(paper): A3f compounding equity-accounting fix plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 09:58:01 +02:00
jgrusewski
833cec0d6a docs(paper): A3f compounding equity-accounting fix design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 09:55:49 +02:00
jgrusewski
6c9dc00a54 docs(paper): A3e marginal-gate + cleanup implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 09:15:27 +02:00
jgrusewski
a01875b7be docs(paper): A3e marginal-gate + cleanup design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 09:13:13 +02:00
jgrusewski
638bfde86f docs(paper): A3d vol-target + killswitch implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 08:04:52 +02:00
jgrusewski
f52d893163 docs(paper): A3d vol-target leverage + drawdown killswitch design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 07:56:27 +02:00
jgrusewski
5ed54a5ea4 docs(paper): A3c implementation plan + spec return-fn signature fix
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 23:27:01 +02:00
jgrusewski
fdc721e6d8 docs(paper): A3c spec fixes from critical review (disjoint regime signal, two-sided water-fill, shared return fn, mixed-history rule)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 23:21:29 +02:00
jgrusewski
4bbae5cacc docs(paper): A3c ISV-adaptive sleeve weighting design (state-derived meta-params)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:47:07 +02:00
jgrusewski
27accf0458 docs(paper): A3c dynamic inverse-vol sleeve weighting design
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:37:42 +02:00
jgrusewski
d726d058c7 docs: plan — equal-weight replayable sleeves + wire unlock to warehouse (Phase 2F-A3b)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:17:34 +02:00
jgrusewski
cdcb0f747a docs: spec — paper book equal-weight replayable sleeves + wire unlock to warehouse (Phase 2F-A3b)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:15:36 +02:00
jgrusewski
8f7ffd39ba docs: plan — paper replay (paper_nav + backfill + /paper/replay scrubber) Phase 2F-A3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 21:03:57 +02:00
jgrusewski
a5493d71cd docs: spec — paper replay (backfill + paper_nav + /paper/replay scrubber) Phase 2F-A3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 21:02:09 +02:00
jgrusewski
6cc9aafae4 docs: plan — paper-snapshot job (current_weights per sleeve + service + dagster asset) Phase 2F-2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 20:10:44 +02:00
jgrusewski
aad97c2b27 docs: spec — paper-snapshot job feeds /paper real positions (Phase 2F-2)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 20:08:51 +02:00
jgrusewski
d816d2d709 docs: plan — paper-trading cockpit MVP (TDD: persist positions/trades + live MTM view)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 19:21:39 +02:00
jgrusewski
672570e079 docs: spec — paper-trading cockpit live MTM (Phase 2F MVP: persist positions/trades + live view)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 19:19:09 +02:00