Skip to main content

financial-agent

A Python platform for systematic ETF research, cost-aware portfolio backtesting, statistical certification, paper trading and explicitly gated Alpaca and IBKR execution. It also retains an equity-research harness and separate RL/deep-learning research stacks. The platform is beta: live performance is unproven, and neither a historical gate pass nor paper results guarantee profit.

Five-minute offline quickstart

Install uv; Python 3.12 is selected by .python-version. From the repository root:

uv sync --locked
uv run fa-quant demo
uv run fa-quant --help

The demo uses seeded synthetic data with a planted trend. It runs backtest, validation/certificate creation, 25 local paper sessions and status without network access after dependencies are installed. Its printed numbers demonstrate software behavior, not market performance. To keep the artifacts, use a fresh state directory:

uv run fa-quant demo --sessions 25 --state-dir /tmp/fa-quant-demo-release

Core dependencies include NumPy <2, pandas >=2,<3, yfinance, Gymnasium and requests. Default development tools are installed by uv sync; optional rl, dl, notebooks and research extras add the heavier research stacks. Full release verification uses uv sync --locked --all-extras.

Once a release is published to PyPI, pip install fa-quant installs the fa-quant command and the financial_agent import package. The PyPI project financial-agent is unrelated. Python 3.12 is the tested version; on 3.13+ the NumPy <2 pin builds NumPy from source. Examples, docs and evidence stay in this repository; see releasing.

Real-data research

The example uses SPY, QQQ, IWM, EFA, EEM, TLT, IEF, LQD, GLD, DBC and VNQ, weekly next-open fills, whole shares and a 2% cash buffer. Downloads are cached under gitignored var/. Use the latest completed session as the inclusive end:

uv run fa-quant backtest --config examples/quant/paper.toml --end 2026-10-12 --json
uv run fa-quant validate --config examples/quant/paper.toml --end 2026-10-12 --json
uv run fa-quant certify --config examples/quant/paper.toml --end 2026-10-12 \
  --output var/quant-paper/certificate.json

validate/certify return 2 when any gate fails; failed certificates can be saved but cannot authorize live trading. With --config, settings come from the TOML; standalone strategy/provider/start flags do not override it. See strategy research for grids and interpretation.

The committed real-data evidence uses the earliest common ETF date, 2006-02-06 through 2026-10-12, unchanged default costs and the disclosed four-variant trend grid. All four full-period default comparisons are shown here:

Strategy CAGR Net Sharpe Max drawdown Turnover/year
Trend vol target 5.625% 0.740 16.533% 14.375×
Dual momentum 11.100% 0.754 26.397% 10.550×
SPY buy-and-hold 11.122% 0.652 54.299% 0.048×
60/40 SPY/IEF 8.212% 0.785 31.979% 0.206×

Trend passes all eight historical checks: OOS Sharpe 0.729, DSR 0.996, OOS maximum drawdown 17.114%. PBO 0.650 warns that in-sample parameter selection adds no reliable value. Single-default dual momentum and 60/40 also pass all eight statistical checks; SPY fails the OOS drawdown limit. For a single pre-registered variant, CSCV computes absolute OOS loss frequency; PBO and degradation slope are not applicable. Warmup/OOS windows differ; read the report for dates, exact checks, costs, bootstrap intervals, stress results and data caveats. No parameters or thresholds were tuned to pass. Statistical passes do not override execution limits: default dual momentum's three slots allocate 33.3% each versus the 30% per-name cap, and concentrated SPY/60-40 benchmarks also exceed runtime caps.

The dated equity research_forecast strategy also fails its real-ledger gate: there is too little history to support promotion. This is the retained result for the LLM research signal, not an implied trading edge.

Paper trading and live gate

Load Alpaca paper keys into the process environment as APCA_API_KEY_ID and APCA_API_SECRET_KEY; keep them out of TOML, git and command history. With keys loaded, preview and run before the opening auction (around 08:45 New York time):

uv run fa-quant run --config examples/quant/paper.toml --dry-run
uv run fa-quant run --config examples/quant/paper.toml
uv run fa-quant status --config examples/quant/paper.toml

IBKR uses the locally running Client Portal Gateway, with daily browser login. Copy ibkr-paper.toml, set your USD paper account ID (DU…/DF…) and gateway port, then use the same fa-quant run command. TLS verification can be disabled only on loopback; remote gateways require a trusted certificate or CA path. Order questions halt unless every message ID is explicitly allowed. Follow the gateway setup.

The release verifies execution through local paper and fake Alpaca/IBKR transports; a real credentialed paper run is still an owner step. A dry run suppresses new orders but journals observations and can synchronize earlier fills.

Live needs mode = "live", FA_QUANT_ALLOW_LIVE=1, a passing certificate no older than 90 days matching the exact strategy/params, at least 20 distinct clean paper sessions from the same broker (Alpaca or IBKR), no recent risk halts/reconciliation breaks, and observed paper slippage within twice modeled allowance. Runtime risk limits cannot be loosened by config. MCP exposes research and paper previews only. Read safety and go-live steps before changing mode, and operations for scheduling, kill/unkill and incidents. Kill stops new submissions; it does not cancel orders or liquidate positions.

Research harness, equity workflow and RL

The native ticker workflow combines sourced evidence, Decimal arithmetic, optional earnings/DCF/comps models and structural audits; retained research remains provisional. The daily equity workflow produces dated source/prediction packages. The harness provides deterministic report checks and ledger audits, not autonomous completion of every prompt stage:

uv run python -m financial_agent.harness --help
uv run python -m financial_agent.harness audit --output-dir agents/equity/output

Generic RL supplies tabular Q-learning, GridWorld, Gymnasium wrappers and bounded training/evaluation loops. Examples demonstrate learning APIs; notebooks retain historical experiment outputs. Install --extra rl, --extra dl or --extra notebooks as needed. The FinRL-derived trading/ and TensorFlow dl/ stacks are experimental; they do not feed capital unless adapted to Strategy and passed through the same gates. The historical autotrain entrypoint has unresolved signature/name issues and is not turnkey.

Repository map

Path Purpose
src/financial_agent/quant Data, strategies, backtest, validation, risk, execution, runner and CLI/MCP
docs/quant Architecture, safety, operations, strategy guide
examples/quant / deploy/quant Paper TOML and cron/launchd/systemd templates
reports/quant Computed default and research-forecast evidence
tests/quant Deterministic offline regression coverage
src/financial_agent/harness Equity schemas, gates, kernels and policy
agents/equity / skills Daily/native equity workflows and Turtle research
src/financial_agent/rl / example/rl Generic RL APIs and examples
src/financial_agent/trading / src/financial_agent/dl Financial RL and prediction research
notebooks / archive Saved research outputs; avoid incidental reruns

Limitations

Yahoo's retrospectively adjusted OHLCV can change and is not raw auction execution data. The fixed ETF universe retains selection bias. Simulations omit taxes, cash interest, capacity/market impact and exact live corporate-action accounting. Statistics measure this historical sample, not future profitability. The scheduled runner does not continuously monitor intraday loss or guarantee fills; reference-price limits do not eliminate gap risk. State/journal hashes are integrity checks, not signatures. The POSIX runner targets macOS/Linux.

License

MIT. Software is provided as is, without warranty.

Metadata

Release files for fa-quant 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fa-quant 1.2.1
File Size Uploaded Provenance
fa_quant-1.2.1.tar.gz 177.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fa-quant 1.2.1
File Interpreter ABI Platform
fa_quant-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 392.1 kB

Release files / fa_quant-1.2.1.tar.gz

Download URL fa_quant-1.2.1.tar.gz
Size 177.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1b9e3eae1a7398132278b689bb63d47b4dd021b27dfe1510f619fd970e013903
BLAKE2b-256 checksum
How to use checksums
50c65a2b3012e7d935556e9fb7ca46538318ae9dca49185c5f346becb9ae8498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / fa_quant-1.2.1-py3-none-any.whl

Download URL fa_quant-1.2.1-py3-none-any.whl
Size 215.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65c14b42b7df0cf40a313b23f9b945a24ac5859dc6317b638a814fe1a6cdd164
BLAKE2b-256 checksum
How to use checksums
6b28a8c41ad7439308f6eb7a5986a7c3b3ded442bb5b4f4cffb7adb097beecec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for fa-quant 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fa_quant-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page