# timrivoli/stock-price-trade-analyzer architecture

> Architecture diagram of the GitHub repository timrivoli/stock-price-trade-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/timrivoli/stock-price-trade-analyzer
- Repository: https://github.com/timrivoli/stock-price-trade-analyzer

## Overview

Stock Price Trade Analyzer is a Python toolkit for historical market analysis, stock selection, strategy backtesting, and optional neural forecasting, with CSV and optional SQL Server persistence. The core workflow loads ticker history, derives indicators, applies analysis or trading logic, then produces performance records and charts. A separate updater maintains SQL-backed market data and derived trading analytics. The README documents additional database and selection capabilities beyond the sampled excerpts; their exact wiring is therefore shown conservatively.

Main entry points: [`_classes/Prices.py`](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Prices.py) (Price History), [`EvaluatePrices.py`](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/EvaluatePrices.py) (Price Analysis), [`database/PriceDatabaseUpdate.py`](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/PriceDatabaseUpdate.py) (Database Updater), [`_classes/DataIO.py`](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/DataIO.py) (Download & SQL I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market_data["Market Data"]
  node_prices["Price History<br/>[Prices.py]"]
  node_dataio["Download &amp; SQL I/O<br/>[DataIO.py]"]
end

subgraph group_analysis["Analysis &amp; Selection"]
  node_stats["Price Indicators<br/>[Prices.py]"]
  node_picker["Stock Selection<br/>[Selection.py]"]
  node_ticker_lists["Ticker Universes<br/>[TickerLists.py]"]
  node_events["Market Events<br/>[MarketEvents.py]"]
  node_price_examples["Price Analysis<br/>[EvaluatePrices.py]"]
  node_graphing["Charts<br/>[Graphing.py]"]
end

subgraph group_trading["Strategy Backtesting"]
  node_trading_examples["Backtest Examples"]
  node_seasonal["Seasonal Strategy"]
  node_portfolio["Portfolio Simulation<br/>[Trading.py]"]
  node_model_results["Trade Results<br/>[Trading.py]"]
end

subgraph group_prediction["Price Prediction"]
  node_prediction_train["Forecast Training<br/>[TrainPrices.py]"]
  node_prediction_model["Neural Forecasting"]
end

subgraph group_persistence["Persistence &amp; Updates"]
  node_csv[("CSV Cache")]
  node_updater["Database Updater"]
  node_sql_schema[("SQL Server Store<br/>[PTA_Generate.sql]")]
  node_seed_tickers["Seed Tickers<br/>[tickerlist.csv]"]
end

node_user(("Analyst"))
node_yahoo["Yahoo Finance"]

node_user -->|"runs analysis"| node_price_examples
node_user -->|"runs backtest"| node_trading_examples
node_price_examples -->|"loads history"| node_prices
node_prices -->|"downloads data"| node_dataio
node_dataio -->|"requests prices"| node_yahoo
node_prices -->|"caches history"| node_csv
node_price_examples -->|"calculates indicators"| node_stats
node_price_examples -->|"analyzes universe"| node_picker
node_ticker_lists -->|"supplies tickers"| node_picker
node_price_examples -->|"analyzes events"| node_events
node_price_examples -->|"plots analysis"| node_graphing
node_trading_examples -->|"runs strategy"| node_portfolio
node_seasonal -->|"runs strategy"| node_portfolio
node_portfolio -->|"uses price history"| node_prices
node_portfolio -->|"records trades"| node_model_results
node_trading_examples -->|"plots comparison"| node_graphing
node_user -->|"trains forecast"| node_prediction_train
node_prediction_train -->|"loads history"| node_prices
node_prediction_train -->|"trains model"| node_prediction_model
node_prices -.->|"delegates forecasts"| node_prediction_model
node_user -->|"starts refresh"| node_updater
node_updater -->|"downloads history"| node_prices
node_updater -->|"queries and writes"| node_dataio
node_dataio -->|"reads and writes"| node_sql_schema
node_updater -->|"seeds universe"| node_seed_tickers
node_updater -->|"refreshes picks"| node_picker

click node_prices "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Prices.py"
click node_dataio "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/DataIO.py"
click node_stats "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Prices.py"
click node_picker "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Selection.py"
click node_ticker_lists "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/TickerLists.py"
click node_events "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/MarketEvents.py"
click node_price_examples "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/EvaluatePrices.py"
click node_trading_examples "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/EvaluateTradeModels.py"
click node_seasonal "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/Seasonal_Trading.py"
click node_portfolio "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Trading.py"
click node_model_results "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Trading.py"
click node_graphing "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Graphing.py"
click node_prediction_train "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/TrainPrices.py"
click node_prediction_model "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/SeriesPrediction.py"
click node_updater "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/PriceDatabaseUpdate.py"
click node_sql_schema "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/PTA_Generate.sql"
click node_seed_tickers "https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/tickerlist.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prices,node_dataio toneBlue
class node_stats,node_picker,node_ticker_lists,node_events,node_price_examples,node_graphing toneAmber
class node_trading_examples,node_seasonal,node_portfolio,node_model_results toneMint
class node_prediction_train,node_prediction_model toneRose
class node_csv,node_updater,node_sql_schema,node_seed_tickers,node_user,node_yahoo toneIndigo
```

## Components

### Market Data

- [Price History](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Prices.py): `_classes/Prices.py`
- [Download & SQL I/O](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/DataIO.py): `_classes/DataIO.py`

### Analysis & Selection

- [Price Indicators](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Prices.py): `_classes/Prices.py`
- [Stock Selection](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Selection.py): `_classes/Selection.py`
- [Ticker Universes](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/TickerLists.py): `_classes/TickerLists.py`
- [Market Events](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/MarketEvents.py): `_classes/MarketEvents.py`
- [Price Analysis](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/EvaluatePrices.py): `EvaluatePrices.py`
- [Charts](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Graphing.py): `_classes/Graphing.py`

### Strategy Backtesting

- [Backtest Examples](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/EvaluateTradeModels.py): `EvaluateTradeModels.py`
- [Seasonal Strategy](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/Seasonal_Trading.py): `Seasonal_Trading.py`
- [Portfolio Simulation](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Trading.py): `_classes/Trading.py`
- [Trade Results](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/Trading.py): `_classes/Trading.py`

### Price Prediction

- [Forecast Training](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/TrainPrices.py): `TrainPrices.py`
- [Neural Forecasting](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/_classes/SeriesPrediction.py): `_classes/SeriesPrediction.py`

### Persistence & Updates

- **CSV Cache**
- [Database Updater](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/PriceDatabaseUpdate.py): `database/PriceDatabaseUpdate.py`
- [SQL Server Store](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/PTA_Generate.sql): `database/PTA_Generate.sql`
- [Seed Tickers](https://github.com/timrivoli/stock-price-trade-analyzer/blob/master/database/tickerlist.csv): `database/tickerlist.csv`

### Other components

- **Analyst**
- **Yahoo Finance**

## Connections

- Analyst → Price Analysis: runs analysis
- Analyst → Backtest Examples: runs backtest
- Price Analysis → Price History: loads history
- Price History → Download & SQL I/O: downloads data
- Download & SQL I/O → Yahoo Finance: requests prices
- Price History → CSV Cache: caches history
- Price Analysis → Price Indicators: calculates indicators
- Price Analysis → Stock Selection: analyzes universe
- Ticker Universes → Stock Selection: supplies tickers
- Price Analysis → Market Events: analyzes events
- Price Analysis → Charts: plots analysis
- Backtest Examples → Portfolio Simulation: runs strategy
- Seasonal Strategy → Portfolio Simulation: runs strategy
- Portfolio Simulation → Price History: uses price history
- Portfolio Simulation → Trade Results: records trades
- Backtest Examples → Charts: plots comparison
- Analyst → Forecast Training: trains forecast
- Forecast Training → Price History: loads history
- Forecast Training → Neural Forecasting: trains model
- Price History → Neural Forecasting: delegates forecasts
- Analyst → Database Updater: starts refresh
- Database Updater → Price History: downloads history
- Database Updater → Download & SQL I/O: queries and writes
- Download & SQL I/O → SQL Server Store: reads and writes
- Database Updater → Seed Tickers: seeds universe
- Database Updater → Stock Selection: refreshes picks
