Skip to content

Strategy research (Phases 2–4), GLD result, multi-asset groundwork, CLAUDE.md - #4

Merged
TahubCS merged 3 commits into
mainfrom
claude/vigilant-cerf-mnuwnd
Sep 27, 2026
Merged

TahubCS merged 3 commits into
mainfrom
claude/vigilant-cerf-mnuwnd

Conversation

@TahubCS

@TahubCS TahubCS commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

This PR contains all work since #3: Phases 2–4, the registered GLD research and its result, the start of multi-asset research, and a CLAUDE.md so local Claude Code sessions can pick up where this one stopped.

Phases 2–4 (M1–M4)

  • Metrics: Sharpe, Sortino, volatility, Calmar, exposure, hit rate, profit factor and holding period for the strategy and both buy-and-hold benchmarks (metrics.py).
  • Experiment log: each distinct run is logged once in data/private/experiments.jsonl. A test checks that identical inputs give byte-identical reports.
  • Features (gld_features_v2): versioned and point-in-time, with a leakage test. features --date prints a snapshot for any day.
  • Strategy interface (strategies.py, selection.py): one code path for the backtest, rolling tests and paper-plan. History blocks any look-ahead, and a golden test proves the original SMA results are unchanged.
  • 12 registered GLD candidates (ADR-010): SMA crossovers, momentum, the 200-day trend with and without a volatility filter, Donchian channels, and volatility-targeted versions.

GLD result: the gate says FAIL (R1, R2, R4). Across 29 rolling windows the strategy made +15.6% compounded, against +158.7% for holding GLD. This is recorded in ADR-010, and no GLD strategy trades real money.

Multi-asset (ADR-011, MA2)

  • ADR-011 registers six ETFs (GLD, SLV, SPY, EFA, IEF, DBC), six candidates and the strictest gate: beat both an equal-weight buy-and-hold of the six and SPY. It was written before any multi-asset code or result existed.
  • Data pipeline: tiingo-import --universe, dividend-adjusted prices, and one aligned calendar where a missing day is refused (universe).
  • Disk use: import pruning keeps the newest three imports of each symbol, which fixes the steady growth from nightly GLD imports.

CLAUDE.md: the rules that are never broken, the commands, a code map, conventions, current status and the next step (MA3, the portfolio simulator).

Effects on paper trading

  • paper-auto now selects among the 12 registered GLD candidates at the paper risk settings. It is still a dry run.
  • Plans use schema 2: the signal records the strategy name, parameters and evidence, and the dashboard shows them.
  • The gate's forward count restarted, because the code that makes trading decisions changed.

Test plan

  • ruff check tradenow tests and mypy are clean.
  • python -m unittest discover -s tests passes, including the golden regression, leakage and determinism tests.
  • CI passed on Ubuntu and Windows for every commit through MA2.
  • gld was run once on real GLD data on the owner's PC; the result is recorded in ADR-010.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fx8W9jDiTaGhDRbiq7Hgm5


Generated by Claude Code

- ADR-010: add the one-time result on real GLD data (experiment
  cc6999fc32cd36f4): FAIL on R1, R2, R4; +15.6% compounded across 29
  rolling windows against +158.7% for holding GLD
- ADR-011: register the six-ETF universe (GLD, SLV, SPY, EFA, IEF,
  DBC), adjusted prices, three trend rules times two sizings (equal
  weight; inverse volatility capped at 35%), monthly rebalancing,
  costs, the ADR-010 selection method, and the strictest gate: beat
  both equal-weight buy-and-hold of the six and SPY, with no larger
  drawdown

Written before any multi-asset code or result exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fx8W9jDiTaGhDRbiq7Hgm5
- tiingo.import_symbol: any plain ticker, with the same manifest
  hashes, safe refresh, and revised-history refusal as GLD; import_gld
  is now a thin wrapper, so paper trading is unchanged
- prune_imports keeps the newest three imports of a symbol (and three
  superseded copies) after each import, capping disk growth; only that
  symbol's exact files are touched
- tradenow/universe.py: the ADR-011 universe, dividend-adjusted parsing
  with raw closes kept, alignment trimmed to the common range with any
  interior missing day refused, and a combined input hash
- CLI: tiingo-import --symbols/--universe (stops at the first failure
  and reports partial results) and an offline universe command

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fx8W9jDiTaGhDRbiq7Hgm5
Records the project's non-negotiable rules (paper only, the live-trading
gate, register before testing, no look-ahead, private secrets), the
commands, the code map, conventions, current status including the GLD
result, and where to resume: MA3, the portfolio simulator of ADR-011.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fx8W9jDiTaGhDRbiq7Hgm5
@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 15d3139d-e9f1-4fb1-aed2-d6c98a7a3a0a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TahubCS
TahubCS merged commit fc0be5c into main Sep 27, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b603cbe8bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tradenow/tiingo.py
for suffix in (".csv", ".raw.json", ".manifest.json"):
path = directory / f"{stem}{suffix}"
if path.exists():
path.unlink()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve source files for recorded experiments

After a symbol receives a fourth import, this deletes the CSV named by older saved reports and experiment records. Those records retain only source_name and the hash, while save_gld_report does not copy the input bytes, so the exact dataset—and therefore the experiment—can no longer be replayed if Tiingo later revises its history. Preserve imports referenced by experiments or archive an exact source copy before pruning.

Useful? React with 👍 / 👎.

Comment thread tradenow/__main__.py
Comment on lines +164 to +166
if import_complete(args.start, args.end, symbol=symbol):
results[symbol] = {"result": "ALREADY_COMPLETE"}
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify completed imports before skipping them

For multi-symbol --symbols runs, a manifest whose last_bar reaches the requested end is reported as ALREADY_COMPLETE even when its CSV is missing or no longer matches bars_sha256, because import_complete checks only the manifest date and this path never calls latest_import. Thus a damaged import can produce a successful exit without being repaired or reported; validate the complete file triplet and hash before skipping it.

Useful? React with 👍 / 👎.

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.

2 participants