# luckyone7777/llm-trading-lab architecture

> Architecture diagram of the GitHub repository luckyone7777/llm-trading-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luckyone7777/llm-trading-lab
- Repository: https://github.com/luckyone7777/llm-trading-lab

## Overview

LLM Trading Lab combines a documented live micro-cap trading experiment and its evaluation with a newer multi-model IPO experiment framework. The IPO workflow selects a cadence, prepares prompts and candidate data, obtains model-generated orders, validates buys, and delegates portfolio processing and persistence to LIBB. The README documents the historical experiment’s accounting, stop-loss, benchmark, and analytics capabilities. Some of those paths are represented by directories rather than sampled implementations, so their internal wiring is not inferred.

Main entry points: [`Experiments/multi_model_ipo/workflow.py`](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/workflow.py) (Cadence workflow), [`Experiments/multi_model_ipo/miscellaneous/order_verification.py`](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/order_verification.py) (Order verification), [`Experiments/multi_model_ipo/prompts`](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/multi_model_ipo/prompts) (Prompt modes), [`Experiments/multi_model_ipo/prompt_orchestration/main_functions.py`](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/main_functions.py) (IPO universe enrichment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ipo["IPO Experiment"]
  node_workflow["Cadence workflow<br/>[workflow.py]"]
  node_prompts["Prompt modes"]
  node_libb["LIBB portfolio engine"]
  node_orders["Order verification"]
  node_rejections["Rejection logging<br/>[csv_conversion.py]"]
  node_research["Research outputs"]
end

subgraph group_decision["Decision Inputs"]
  node_universe["IPO universe enrichment<br/>[main_functions.py]"]
  node_fetching["Market data fetching<br/>[fetching.py]"]
  node_utilities["Eligibility utilities<br/>[utilities.py]"]
  node_snapshot[("Snapshot cache")]
end

subgraph group_historical["Micro-Cap Record"]
  node_microengine["Live trading engine<br/>[trading_script.py]"]
  node_processing["Portfolio processing"]
  node_dailycsv[("Daily portfolio records<br/>[Daily Updates.csv]")]
  node_tradelog[("Trade log<br/>[Trade Log.csv]")]
  node_artifacts["Research and decisions"]
end

subgraph group_analysis["Performance Analysis"]
  node_evaluation["Research evaluation"]
  node_metrics["Portfolio metrics"]
  node_charts["Performance charts"]
end

node_operator(("Experiment operator"))
node_financialdata(("Financial data services"))
node_marketdata(("Market data services"))
node_benchmarks(("Market benchmarks"))

node_operator -->|"runs"| node_workflow
node_workflow -->|"selects mode"| node_prompts
node_prompts -->|"requests inputs"| node_universe
node_universe -->|"enriches candidates"| node_fetching
node_fetching -->|"fetches profiles"| node_financialdata
node_fetching -->|"fetches prices"| node_marketdata
node_universe -->|"validates eligibility"| node_utilities
node_prompts -->|"builds portfolio prompt"| node_libb
node_workflow -->|"processes portfolio"| node_libb
node_libb -->|"returns report"| node_workflow
node_workflow -->|"filters orders"| node_orders
node_orders -->|"checks order data"| node_financialdata
node_orders -->|"checks prices"| node_marketdata
node_orders -->|"reads and writes cache"| node_snapshot
node_workflow -->|"saves rejections"| node_rejections
node_workflow -->|"saves orders and analysis"| node_libb
node_libb -->|"persists outputs"| node_research
node_microengine -->|"records accounting"| node_dailycsv
node_microengine -->|"records trades"| node_tradelog
node_processing -->|"processes portfolio data"| node_dailycsv
node_artifacts -->|"documents experiment"| node_evaluation
node_dailycsv -->|"supplies portfolio data"| node_metrics
node_metrics -->|"provides analytics"| node_charts
node_charts -->|"compares performance"| node_benchmarks

click node_workflow "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/workflow.py"
click node_prompts "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/multi_model_ipo/prompts"
click node_orders "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/order_verification.py"
click node_rejections "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/csv_conversion.py"
click node_research "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/multi_model_ipo"
click node_universe "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/main_functions.py"
click node_fetching "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/fetching.py"
click node_utilities "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/utilities.py"
click node_snapshot "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/order_verification.py"
click node_microengine "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/scripts/processing/trading_script.py"
click node_processing "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/scripts/processing/ProcessPortfolio.py"
click node_dailycsv "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/csv_files/Daily%20Updates.csv"
click node_tradelog "https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/csv_files/Trade%20Log.csv"
click node_artifacts "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/collected_artifacts"
click node_evaluation "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/evaluation"
click node_metrics "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/scripts/metrics"
click node_charts "https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/graphing"

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_workflow,node_prompts,node_libb,node_orders,node_rejections,node_research toneBlue
class node_universe,node_fetching,node_utilities,node_snapshot toneAmber
class node_microengine,node_processing,node_dailycsv,node_tradelog,node_artifacts toneMint
class node_evaluation,node_metrics,node_charts toneRose
class node_operator,node_financialdata,node_marketdata,node_benchmarks toneIndigo
```

## Components

### IPO Experiment

- [Cadence workflow](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/workflow.py): `Experiments/multi_model_ipo/workflow.py`
- [Prompt modes](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/multi_model_ipo/prompts): `Experiments/multi_model_ipo/prompts`
- **LIBB portfolio engine**
- [Order verification](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/order_verification.py): `Experiments/multi_model_ipo/miscellaneous/order_verification.py`
- [Rejection logging](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/csv_conversion.py): `Experiments/multi_model_ipo/miscellaneous/csv_conversion.py`
- [Research outputs](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/multi_model_ipo): `Experiments/multi_model_ipo`

### Decision Inputs

- [IPO universe enrichment](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/main_functions.py): `Experiments/multi_model_ipo/prompt_orchestration/main_functions.py`
- [Market data fetching](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/fetching.py): `Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/fetching.py`
- [Eligibility utilities](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/utilities.py): `Experiments/multi_model_ipo/prompt_orchestration/get_prompt_data/utilities.py`
- [Snapshot cache](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/multi_model_ipo/miscellaneous/order_verification.py): `Experiments/multi_model_ipo/miscellaneous/order_verification.py`

### Micro-Cap Record

- [Live trading engine](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/scripts/processing/trading_script.py): `Experiments/chatgpt_micro-cap/scripts/processing/trading_script.py`
- [Portfolio processing](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/scripts/processing/ProcessPortfolio.py): `Experiments/chatgpt_micro-cap/scripts/processing/ProcessPortfolio.py`
- [Daily portfolio records](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/csv_files/Daily%20Updates.csv): `Experiments/chatgpt_micro-cap/csv_files/Daily Updates.csv`
- [Trade log](https://github.com/luckyone7777/llm-trading-lab/blob/main/Experiments/chatgpt_micro-cap/csv_files/Trade%20Log.csv): `Experiments/chatgpt_micro-cap/csv_files/Trade Log.csv`
- [Research and decisions](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/collected_artifacts): `Experiments/chatgpt_micro-cap/collected_artifacts`

### Performance Analysis

- [Research evaluation](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/evaluation): `Experiments/chatgpt_micro-cap/evaluation`
- [Portfolio metrics](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/scripts/metrics): `Experiments/chatgpt_micro-cap/scripts/metrics`
- [Performance charts](https://github.com/luckyone7777/llm-trading-lab/tree/main/Experiments/chatgpt_micro-cap/graphing): `Experiments/chatgpt_micro-cap/graphing`

### Other components

- **Experiment operator**
- **Financial data services**
- **Market data services**
- **Market benchmarks**

## Connections

- Experiment operator → Cadence workflow: runs
- Cadence workflow → Prompt modes: selects mode
- Prompt modes → IPO universe enrichment: requests inputs
- IPO universe enrichment → Market data fetching: enriches candidates
- Market data fetching → Financial data services: fetches profiles
- Market data fetching → Market data services: fetches prices
- IPO universe enrichment → Eligibility utilities: validates eligibility
- Prompt modes → LIBB portfolio engine: builds portfolio prompt
- Cadence workflow → LIBB portfolio engine: processes portfolio
- LIBB portfolio engine → Cadence workflow: returns report
- Cadence workflow → Order verification: filters orders
- Order verification → Financial data services: checks order data
- Order verification → Market data services: checks prices
- Order verification → Snapshot cache: reads and writes cache
- Cadence workflow → Rejection logging: saves rejections
- Cadence workflow → LIBB portfolio engine: saves orders and analysis
- LIBB portfolio engine → Research outputs: persists outputs
- Live trading engine → Daily portfolio records: records accounting
- Live trading engine → Trade log: records trades
- Portfolio processing → Daily portfolio records: processes portfolio data
- Research and decisions → Research evaluation: documents experiment
- Daily portfolio records → Portfolio metrics: supplies portfolio data
- Portfolio metrics → Performance charts: provides analytics
- Performance charts → Market benchmarks: compares performance
