Trading bot: /metrics endpoint + roll-doubling hazard documentation #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/trading-observability"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two commits that complete the trading bot's observability wiring and contain a stop-the-bleeding fix for the roll-doubling hazard discovered mid-session.
Commits
disable daily cycle + document roll-doubling hazard (
dashboard/crontab,strategies/pmcc.py)_StubChainFetcher's fixed-strike symbols (SPY_L630/SPY_S14): no close-then-open semantics, no expiration-unique OCC symbols, no expired-contract filter inJournalPositionProvider. Net effect: position doubles each cycle once DTE goes negative.ponytail:ceiling comment in_should_roll_shortnaming the three-step upgrade path: (1) close legs in_roll_signalvia the existingbuild_exit_orderpattern, (2) filter expired contracts in_aggregate_net, (3) expiration-unique OCC-like symbols in_StubChainFetcher.trading.dbwiped;paper_trading.dbcash reset to initial $100K, positions/orders/fills wiped) so the dashboard shows clean state./metricsroute for Prometheus scrape (dashboard/app.py)prometheus_clientdependency + container rebuild). Eight gauges cover dashboard-observable state:trading_dashboard_up(liveness)trading_dashboard_trading_db_present/paper_db_presenttrading_dashboard_cash/initial_capital/open_positionstrading_dashboard_trades_totaltrading_dashboard_cycle_status(1=complete, 0=started, -1=none/error)https://trades.viztekpro.com/metrics(robust to container IP changes via Traefik). Federated up to BatKave via the existingfederation-vpsjob.Test plan
dashboard/app.py/metricsroute verified locally via FastAPI TestClient — valid Prometheus exposition, correct content-type.trading-dashboardcontainer;curl https://trades.viztekpro.com/metricsreturns the 8 gauges.trading-dashboard → https://trades.viztekpro.com/metrics | up.trading_dashboard_up = 1,trading_dashboard_cash = 100000.trading.db0 rows in all tables,paper_trading.db1 paper_account row with cash=initial=$100K, 0 positions/orders/fills.Cross-repo coordination
This PR is one of three merge units for the trading-bot-to-observability wiring. See
pook/engineer-teamPR #5 for the central alertmanager/Prometheus config changes, andpook/batkave-homePR (pending) for the ntfy + alertmanager-webhook bind fixes.🤖 Generated with Claude Code