This repository is a local-first US equities research, risk, portfolio, and paper-execution system built on top of the upstream TradingAgents graph, with:
- Default live LLM provider: Google Vertex AI
- Default live model:
gemini-2.5-flash - Default data source:
yfinance - Execution mode: local paper trading
- Persistence: SQLite + report artifacts
- Optional artifact publishing to Google Cloud Storage (GCS)
- Compute Engine VM deployment scripts for unattended daily runs
The local trading and paper broker flow is preserved. Cloud deployment is additive.
- Added Vertex AI Gemini provider path (ADC/service-account based).
- Switched default live model/provider to
vertex+gemini-2.5-flash. - Kept OpenAI and other provider paths optional.
- Added publishable artifact export tree:
reports/YYYY-MM-DD/summary.mdreports/YYYY-MM-DD/summary.jsonsnapshots/latest_positions.jsonsnapshots/latest_orders.jsonsnapshots/latest_run_summary.json- optional:
snapshots/latest_regime.json,snapshots/latest_candidates.json
- Added GCS upload utility.
- Added Compute Engine deployment scripts and cron-based daily execution wrapper.
- Preserved yfinance reliability guardrails and fail-fast data impairment checks.
Primary local system modules are under tradingagents/system:
config.py: typed settings, env/config merge, provider readiness checksdata/yfinance_provider.py: robust yfinance access with batch+fallback/retriescontext/regime.py: structured regime model from liquid proxy instrumentsuniverse/selector.py: screening, ranking, shortlist pipelineresearch/adapter.py+research/organization.py: upstream adapter + multi-role research artifactsrisk/engine.py: deterministic hard risk committee logicportfolio/service.py: fit + target-weight + execution plan logicexecution/paper.py: paper broker with persisted positions/orders/fillsstorage/db.py+storage/repository.py: SQLite schema and repository APIsorchestration/runner.py: run lifecycle, guardrails, report generation, export/publish hookorchestration/reporting.py: markdown/json daily reportorchestration/artifacts.py: publishable snapshot exportcloud/gcs_publisher.py: GCS uploadercli.py: operator CLI
Default config now uses:
TRADINGAGENTS_LLM_PROVIDER=vertexTRADINGAGENTS_LLM_MODEL=gemini-2.5-flashTRADINGAGENTS_LLM_DEEP_MODEL=gemini-2.5-flashTRADINGAGENTS_LLM_QUICK_MODEL=gemini-2.5-flash
Vertex auth is via ADC (local gcloud auth application-default login) or attached VM service account.
OpenAI remains optional:
- set
TRADINGAGENTS_LLM_PROVIDER=openai - set
OPENAI_API_KEY=...
Local/macOS:
- Python 3.10+ (3.12 recommended)
gcloudinstalled and authenticated- ADC configured (
gcloud auth application-default login) for Vertex/GCS if running live LLM/publish locally - Docker Desktop optional
GCP target assumptions for deployment scripts:
- Project:
ta-henry-2026 - Region:
us-central1 - Zone:
us-central1-a - VM:
ta-runner-01 - Bucket:
gs://ta-artifacts-ta-henry-2026 - APIs enabled:
compute,aiplatform,storage,iam
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .envSee .env.example. Core defaults are:
TRADINGAGENTS_LLM_PROVIDER=vertex
TRADINGAGENTS_LLM_MODEL=gemini-2.5-flash
TRADINGAGENTS_VERTEX_PROJECT=ta-henry-2026
TRADINGAGENTS_VERTEX_REGION=us-central1
TRADINGAGENTS_GCS_BUCKET=ta-artifacts-ta-henry-2026
TRADINGAGENTS_PUBLISH_ON_RUN=falseNo static JSON key file is required. ADC/service-account is used.
Setup/bootstrap:
tradingagents setupHealth check:
tradingagents health-checkDry run:
tradingagents dry-run --as-of 2026-04-13Run once (paper execute):
tradingagents run-once --as-of 2026-04-13 --executeRun daily local loop (non-VM mode):
tradingagents run-daily --run-at 15:45Replay:
tradingagents replay --start 2026-04-01 --end 2026-04-10 --no-executeInspect state:
tradingagents show-positions
tradingagents show-recent-orders --limit 20
tradingagents show-regime --as-of 2026-04-13
tradingagents show-candidates --as-of 2026-04-13 --limit 20
tradingagents generate-daily-report --as-of 2026-04-13Export/publish artifacts:
tradingagents export-artifacts --as-of 2026-04-13
tradingagents publish-artifacts --as-of 2026-04-13docker compose build
docker compose run --rm tradingagents health-check
docker compose run --rm tradingagents dry-run --as-of 2026-04-13
docker compose run --rm tradingagents run-once --as-of 2026-04-13 --executeDefault root: ~/.tradingagents
- DB:
~/.tradingagents/db/tradingagents.db - Logs:
~/.tradingagents/logs/tradingagents-system.log - Reports:
~/.tradingagents/reports/YYYY-MM-DD/summary.md|summary.json - Export staging:
~/.tradingagents/artifacts/publish/...
Deployment scripts are in scripts/gcp.
./scripts/gcp/create_infra.shThis script:
- ensures service account
ta-runner-sa@ta-henry-2026.iam.gserviceaccount.com - grants:
roles/aiplatform.user(Vertex inference)- bucket-level
roles/storage.objectAdminongs://ta-artifacts-ta-henry-2026(artifact writes/overwrites)
- creates VM
ta-runner-01if missing, with:e2-micro- 20GB
pd-standard - Ubuntu 22.04 LTS
- attached service account + cloud-platform scope
./scripts/gcp/deploy_or_update.sh./scripts/gcp/bootstrap_vm.shThis installs Python runtime, creates venv, installs project, and writes /opt/tradingagents/runtime.env.
./scripts/gcp/install_cron.shCron behavior:
CRON_TZ=America/New_York- default schedule:
45 15 * * 1-5 - executes
scripts/gcp/vm_daily_run.sh - wrapper is idempotent for a given market date (skips if already completed)
./scripts/gcp/health_check_vm.sh./scripts/gcp/run_remote_daily.shscripts/gcp/vm_daily_run.sh executes:
- activate venv + load runtime env
- resolve market session date
- skip if run already completed for that date
tradingagents run-once --as-of <date> --executetradingagents export-artifacts --as-of <date>tradingagents publish-artifacts --as-of <date>
Manual VM scripts:
scripts/gcp/vm_run_once.sh [YYYY-MM-DD]scripts/gcp/vm_publish_once.sh [YYYY-MM-DD]
On VM:
- Repo:
/opt/tradingagents/TradingAgents - Runtime env:
/opt/tradingagents/runtime.env - Venv:
/opt/tradingagents/venv - Local app home:
/opt/tradingagents/.tradingagents - Daily log:
/opt/tradingagents/.tradingagents/logs/daily-run.log - Cron log:
/opt/tradingagents/.tradingagents/logs/cron.log - SQLite:
/opt/tradingagents/.tradingagents/db/tradingagents.db
After each publish:
gs://ta-artifacts-ta-henry-2026/reports/YYYY-MM-DD/summary.mdgs://ta-artifacts-ta-henry-2026/reports/YYYY-MM-DD/summary.jsongs://ta-artifacts-ta-henry-2026/snapshots/latest_positions.jsongs://ta-artifacts-ta-henry-2026/snapshots/latest_orders.jsongs://ta-artifacts-ta-henry-2026/snapshots/latest_run_summary.json- optional:
.../snapshots/latest_regime.json.../snapshots/latest_candidates.json
List recent published artifacts:
gcloud storage ls gs://ta-artifacts-ta-henry-2026/reports/
gcloud storage ls gs://ta-artifacts-ta-henry-2026/snapshots/Inspect latest run summary:
gcloud storage cat gs://ta-artifacts-ta-henry-2026/snapshots/latest_run_summary.jsonSSH when needed:
gcloud compute ssh ta-runner-01 --zone us-central1-a --project ta-henry-2026ruff check tradingagents/system tests
pytest -qyfinance safety behavior remains active:
- single-symbol history uses
Ticker.history(...) - batch path uses
yf.download(...)with per-symbol fallback + retries - run aborts before live LLM research when regime/shortlist data coverage is below thresholds
- symbols with critical missing history are skipped before research
This prevents token burn on materially impaired market data.
- yfinance coverage can be noisy/incomplete for some fields
- news/events/fundamentals are best-effort, not institutional-grade
- paper fills are low-frequency bar-based simulation
Intentionally deferred:
- live Futu OpenD connectivity
- real broker order routing
- live account credential and startup safety gates
The broker abstraction remains in place so live execution can be added without replacing research/risk/storage/reporting layers.