Thank you for considering a contribution. Titanium Alpha is a research-oriented project and the bar for new code is deliberately high: we care about statistical integrity and look-ahead bias far more than feature count. Please read this guide before opening a PR.
git clone https://github.com/cockles98/titanium-alpha.git
cd titanium-alpha
poetry install --with dev
cp .env.example .env # fill in GEMINI_KEY + optional NEWSAPI_KEY
docker compose -f docker/docker-compose.yml up -d
poetry run pytest # must stay at 1002+ passing- Branch from
masterwith a descriptive name (feat/<topic>,fix/<bug>,refactor/<scope>,test/<scope>,docs/<scope>). - Use the Claude Code subagents in
.claude/agents/when making changes:- architect before any new module or cross-system integration.
- quant-reviewer after any change to model, backtest, or feature engineering code. This is mandatory for financial logic.
- security-data after touching any ingestion / transformation script.
- test-writer after any new function or class in
src/. - docs-writer after a module or phase completes.
- Keep commits small and semantic. Hooks and CI run
ruff+mypy+pytest. - Open a PR. The description should state (a) what changed, (b) why, and (c) any metric impact (Sharpe, CAGR, MaxDD, Beta).
<type>: <short imperative sentence>
<body, if needed — explain "why" not "what">
<type> is one of feat, fix, refactor, test, docs, perf, chore.
- Type hints on every public method.
mypy --strictis enforced. - Docstrings on every public function / class (Google style).
- No Pandas. The project uses Polars end-to-end. Fixtures and
intermediate frames must be
pl.DataFrame. - No
print()in production code. Useloguru(from loguru import logger). - Never swallow exceptions. Re-raise with context if you catch.
- No bare
except:. Catch specific exception classes. - No real API calls in tests. Mock
yfinance, Gemini, Anthropic, NewsAPI. Tests run on CI without network access. - No look-ahead bias. Rolling windows must use closed="left" or
equivalent shifting;
fill_nullmust not propagate future values backward.
Do not rearrange or cross these boundaries without discussion:
src/data/ ingestion + persistence
src/models/ PatchTST + features
src/agents/ LangGraph + RAG
src/backtest/ CPCV, CPCV-OOS, walk-forward, benchmark metrics / report
src/portfolio/ HRP + decision engine
src/dashboard/ Streamlit app
src/utils/ shared helpers
tests/ pytest
notebooks/ exploration only (never imported by src/)
docs/ documentation (Portuguese)
docker/ Dockerfiles + compose
config/ tickers.json
Import firewalls:
src/agentsmust not import fromsrc/portfolio(and vice versa).src/backtestmust not import fromsrc/agents(the backtest-production gap is a deliberate design choice documented indocs/design_gap_backtest_vs_production.md).
- Coverage floor: 80% per module (70% for LangGraph-heavy agent code).
- Every new function gets at least a happy-path test and one edge-case test (empty input, NaN, single-row DataFrame).
- No flaky tests. If a test depends on time or randomness, seed it.
- Run the full suite before pushing:
poetry run pytest --cov=src --cov-report=term-missing
- Further CPCV-OOS parameter sweeps. The parameter space has been saturated (982 configs). New tuning requests should come with a hypothesis, not a grid search.
- Integration of the LangGraph debate into the walk-forward loop. The token-cost gap is a documented design decision, not a bug.
- Additional tickers beyond the current 52. More tickers dilute signal.
- Pandas refactors. The project uses Polars by choice.
- Backwards-compatibility shims or feature flags around internal APIs. Rename freely and update callers.
For bugs, open a GitHub issue with (a) a minimal reproduction, (b) the
expected vs actual behaviour, (c) the output of poetry env info and git rev-parse HEAD. For methodology questions, open a Discussion rather than
an issue.
By contributing, you agree that your contribution will be licensed under the
MIT License (see LICENSE).