Trading TDA is an early ASB Solutions Group trading application built against the TD Ameritrade API — a predecessor of my current IBKR/Alpaca automation stack. It pulls portfolio and market data through tda-api, lands it in Google BigQuery, and runs time-series forecasting over it.
The concepts
The pipeline has three stages:
- Authenticate and ingest — OAuth against the TDA API (
authenticate.py), thenimport-portfolio.pyexports portfolio data as per-ticker CSVs - Warehouse — the CSVs load into a BigQuery
trading.trading_datatable withbq load --autodetect, giving SQL analytics over the whole portfolio history - Forecast —
arima.pyfits ARIMA models (viastatsmodels) across the portfolio, with a debug mode and per-portfolio selection, pluspandas_taand matplotlib for indicators and charts
How to run it
Configuration lives in a local setup.py with the TDA API key, redirect URI, and a token path — the README is emphatic that the OAuth token file stays private. A startup script creates a virtualenv, sets SETUPTOOLS_USE_DISTUTILS=stdlib (needed at the time for the dependency chain), installs requirements, and assumes gcloud and bq are configured:
virtualenv my-venv && source my-venv/bin/activate
pip install -r Requirements.txt
python authenticate.py
python import-portfolio.py
python arima.py y ALL
Worth noting historically: the TD Ameritrade API this was built on has since been retired following the Schwab migration, so the repo stands as an archived snapshot of that era — the ideas (broker API → warehouse → forecast) carried forward into my later trading projects.
Language: Python Source code: github.com/ASB-Solutions-Group-Inc/trading-tda