Team Ai
Modelpublic

ParallelLLC/algorithmic_trading

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
27likes32downloads
AGENTIC_SYSTEM_V1.md131 linesDownload Raw Back to docs
1# Algorithmic Trading2 3FinRL reinforcement-learning trading with Alpaca execution, plus Yahoo Finance OHLCV as the default public tape. Parallel LLC.4 5This is **research and paper-trading infrastructure**. Live capital requires a separate evaluation contract, feature-parity tests, and a rewritten execution path. Do not treat `paper_trading: false` as a promotion gate.6 7---8 9## 1. Title and Summary10 11**Algorithmic Trading**  12Ingest OHLCV, compute indicators or train a FinRL policy, size orders under position and drawdown caps, route to paper or live Alpaca.13 14GitHub `main` is the FinRL / Docker / Streamlit tree plus algotrader 2.0. `dev` is the integration branch. Yahoo is the default `data_source.type`.15 16**Design themes**17 18* Four ingest paths: CSV replay, synthetic GBM, Alpaca REST, Yahoo (`yfinance>=1.0`)19* FinRL policies (PPO, A2C, DDPG, TD3) on a Gymnasium-style environment20* Alpaca for authenticated market data and order routing (paper by default)21* Yahoo for delayed public bars when no broker key is available22* Secrets from environment (`ALPACA_API_KEY`, `ALPACA_SECRET_KEY`), never committed23* Tests and Docker/CI as already present on this tree24 25---26 27## 2. Concepts and Methods28 29### Market data30 31| Source | When to use | Failure modes |32| ------ | ----------- | ------------- |33| **CSV** | Offline replay; default in `config.yaml` | Missing path or OHLCV columns → `None` |34| **Synthetic** | Unit tests and demos | GBM is not tradable edge |35| **Alpaca** | Authenticated bars and live/paper orders | Auth, feed, and rate-limit failures |36| **Yahoo** | Real Close without a broker account | Unofficial API, ~15 min delay, interval lookback caps (1m ≈ 7 days). Pin `yfinance>=1.0`; 0.2.x fails against the current chart API |37 38`load_data` dispatches on `data_source.type`. Existing `alpaca` / `csv` / `synthetic` branches are unchanged.39 40### Strategy and FinRL41 42* `StrategyAgent`: SMA, RSI, Bollinger, MACD on Close; teaching rule, not an alpha claim43* `FinRLAgent`: PPO / A2C / DDPG / TD3 via Stable-Baselines3; persist under `models/`44* `ExecutionAgent` / `AlpacaBroker`: paper simulation or Alpaca market/limit orders45 46Backtests in this repo are in-sample passes unless you add a purged walk-forward yourself. Leakage is the null hypothesis.47 48---49 50## 3. Stack51 52| Layer | Tools |53| ----- | ----- |54| Language | Python 3.11 (CI); 3.8+ stated for local |55| RL | FinRL / Stable-Baselines3, Gym/Gymnasium, PyTorch |56| Broker | alpaca-py |57| Market data | Alpaca REST; yfinance ≥ 1.0 (Yahoo) |58| Tabular | pandas, NumPy, scikit-learn |59| UI | Streamlit, Dash, Jupyter widgets |60| Deploy | Docker Compose, GitHub Actions |61| Tests | pytest, pytest-cov |62 63---64 65## 4. Structure66 67```68algorithmic_trading/69├── agentic_ai_system/     # ingest, strategy, FinRL, Alpaca, Yahoo70├── ui/                    # Streamlit, Dash, Jupyter, WebSocket71├── tests/72├── models/                # trained artifacts (gitignored bodies)73├── data/                  # generated CSV (gitignored)74├── scripts/               # Docker / deploy helpers75├── .github/workflows/     # CI/CD, release, backtesting76├── config.yaml77├── requirements.txt78├── Dockerfile79└── docker-compose*.yml80```81 82Branch policy: **`main`** (protected) and **`dev`** only. Do not re-enable Dependabot or the Monday `dependency-updates` workflow; those created extra branches.83 84---85 86## 5. Quick start87 88```bash89git clone https://github.com/ParallelLLC/algorithmic_trading.git90cd algorithmic_trading91python -m venv .venv && source .venv/bin/activate92pip install -r requirements.txt93cp .env.example .env   # Alpaca keys if using alpaca ingest or orders94```95 96Default ingest is CSV. For Yahoo daily bars without a broker:97 98```yaml99data_source:100  type: 'yahoo'101trading:102  symbol: 'AAPL'103  timeframe: '1d'104```105 106```bash107python demo.py108python -m agentic_ai_system.main --mode backtest --start-date 2024-01-01 --end-date 2024-12-31109pytest tests/ -q110```111 112UI launchers and Docker are documented in `UI_SETUP.md` and `DOCKER_HUB_SETUP.md`. Paper-trade before live. Yahoo is not a SIP tape.113 114---115 116## 6. Configuration (additive Yahoo keys)117 118| Key | Meaning |119| --- | ------- |120| `data_source.type` | `csv` \| `synthetic` \| `alpaca` \| `yahoo` |121| `yahoo.start_date` / `end_date` | Historical window; clamped per Yahoo interval limits |122| `yahoo.auto_adjust` | Passed to `yfinance` |123| `execution.broker_api` | `paper` \| `alpaca_paper` \| `alpaca_live` |124| `finrl.algorithm` | PPO, A2C, DDPG, TD3 |125 126---127 128**License:** Apache License 2.0  129**Organization:** [Parallel LLC](https://github.com/ParallelLLC)  130**Repository:** <https://github.com/ParallelLLC/algorithmic_trading>131