Skip to content

Institutional operations: risk limits, kill switch, audit trail, repo… - #3

Merged
devam2001 merged 1 commit into
mainfrom
feature/institutional-ops
Oct 10, 2026
Merged

devam2001 merged 1 commit into
mainfrom
feature/institutional-ops

Conversation

@devam2001

Copy link
Copy Markdown
Owner

…rts, CI, Docker

Risk & kill switch

  • ridgeline/risk.py: pure portfolio limits (35% max position, 4.5% max open risk, 3% daily loss, 15% drawdown halt), overridable via "ridgeline_risk" in config.json. ridgeline/freqtrade_risk.py: RiskMixin that all three strategies inherit - vetoes entries and caps stakes in backtests, paper and live alike. Strategy parameters unchanged.
  • Panel: risk gauges plus Pause / Resume / Flatten (typed FLATTEN confirm; stopentry -> forceexit all -> stop) for any reachable bot.
  • ridgeline/audit.py: append-only, hash-chained audit log of control actions, risk events and watchdog alerts; tamper detection shown in the panel.

Reporting

  • ridgeline/report.py + scripts/report.py: self-contained HTML tear sheet (monthly grid, equity vs BTC, drawdown, Sharpe/Sortino/Calmar, trade log, disclosures) from paper DBs or backtests; panel links for sessions/replays.

Deployment & monitoring

  • Dockerfile + docker-compose.yml: bot, monitor-mode panel, watchdog; ports on 127.0.0.1 only. scripts/watchdog.py alerts via Telegram (or console) on bot down/stalled/paused/halted and limits >= 80%.
  • scripts/init_private_config.py generates API secrets for new machines/CI.

Tests & CI

  • 48 pytest tests: limit boundaries, audit tampering, lookahead (prefix invariance) per strategy, point-in-time universe, panel dry-run guard and flatten sequence, report maths, repo hygiene. ruff lint. GitHub Actions.

Research re-run with the risk layer: TrendRider4h OOS +17.3% (was +19.3%), still 8/9 gates (99 trades); drawdown halt cut TrendDipBuyer1h's IS loss from -20.7% to -8.0%. Docs: docs/OPERATIONS.md runbook, README sections, note on licensing for managing other people's money.

…rts, CI, Docker

Risk & kill switch
- ridgeline/risk.py: pure portfolio limits (35% max position, 4.5% max open
  risk, 3% daily loss, 15% drawdown halt), overridable via "ridgeline_risk"
  in config.json. ridgeline/freqtrade_risk.py: RiskMixin that all three
  strategies inherit - vetoes entries and caps stakes in backtests, paper
  and live alike. Strategy parameters unchanged.
- Panel: risk gauges plus Pause / Resume / Flatten (typed FLATTEN confirm;
  stopentry -> forceexit all -> stop) for any reachable bot.
- ridgeline/audit.py: append-only, hash-chained audit log of control actions,
  risk events and watchdog alerts; tamper detection shown in the panel.

Reporting
- ridgeline/report.py + scripts/report.py: self-contained HTML tear sheet
  (monthly grid, equity vs BTC, drawdown, Sharpe/Sortino/Calmar, trade log,
  disclosures) from paper DBs or backtests; panel links for sessions/replays.

Deployment & monitoring
- Dockerfile + docker-compose.yml: bot, monitor-mode panel, watchdog; ports
  on 127.0.0.1 only. scripts/watchdog.py alerts via Telegram (or console) on
  bot down/stalled/paused/halted and limits >= 80%.
- scripts/init_private_config.py generates API secrets for new machines/CI.

Tests & CI
- 48 pytest tests: limit boundaries, audit tampering, lookahead (prefix
  invariance) per strategy, point-in-time universe, panel dry-run guard and
  flatten sequence, report maths, repo hygiene. ruff lint. GitHub Actions.

Research re-run with the risk layer: TrendRider4h OOS +17.3% (was +19.3%),
still 8/9 gates (99 trades); drawdown halt cut TrendDipBuyer1h's IS loss
from -20.7% to -8.0%. Docs: docs/OPERATIONS.md runbook, README sections,
note on licensing for managing other people's money.
@devam2001
devam2001 merged commit e32fa47 into main Oct 10, 2026
2 checks passed
@devam2001
devam2001 deleted the feature/institutional-ops branch October 10, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant