# luckyone7777/chatgpt-micro-cap-experiment architecture

> Architecture diagram of the GitHub repository luckyone7777/chatgpt-micro-cap-experiment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luckyone7777/chatgpt-micro-cap-experiment
- Repository: https://github.com/luckyone7777/chatgpt-micro-cap-experiment

## Overview

##### Project type and purpose
- This is a Python-based data-pipeline/automation tool rather than a classic client-server “full-stack” app. It’s an experiment framework where a decision engine (ChatGPT) consumes market data each trading day, applies rules, emits trade instructions, logs them to CSV, and generates performance visualizations.

##### File structure
Top-level directories and files:
- Experiment Details – research artifacts, prompts, Q&A, disclaimers.
- Scripts and CSV Files – core scripts (Generate_Graph.py, Trading_Script.py) plus generated CSV logs (chatgpt_portfolio_update.csv, chatgpt_trade_log.csv).
- Start Your Own – a “template” copy of the core scripts and CSV files for bootstrapping a new experiment.
- Weekly Deep Research (MD/PDF) – weekly summary documents in Markdown and PDF.
- trading_script.py (root) – duplicate/entry-point for live trading logic.
- requirements.txt – Python dependencies (pandas, yfinance, matplotlib, OpenAI/ChatGPT SDK).

Architectural choices:
- Modular scripts separate data ingestion + decision logic (trading_script.py) from visualization (Generate_Graph.py).
- CSV files as simple persistent storage.
- “Start Your Own” directory as a scaffold for new experiments.

##### README for additional insights
- Tech stack: Python, pandas + yfinance (market data), Matplotlib (visuals), ChatGPT (trade decisions).
- Workflow: daily data feed → ChatGPT decision engine → strict stop-loss + trade generator → CSV log updates → weekly performance graphs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main Pipeline"
        Ingest["Data Ingestion Module\n(trading_script.py)"]:::blue
        Decision["Decision Engine\n(trading_script.py)"]:::green
        ChatGPT["ChatGPT API\n(JSON/HTTPS)"]:::green
        Exec["Execution & Persistence"]:::blue
        TradeLog[(chatgpt_trade_log.csv)]:::blue
        PortfolioLog[(chatgpt_portfolio_update.csv)]:::blue
        Visual["Visualization Module\n(Generate_Graph.py)"]:::orange
    end

    Ingest -->|"market data CSV"| Decision
    Decision -->|"prompts/responses\nJSON over HTTPS"| ChatGPT
    ChatGPT -->|"LLM response"| Decision
    Decision -->|"CSV write"| TradeLog
    Decision -->|"CSV write"| PortfolioLog
    TradeLog -->|"read CSV"| Visual
    PortfolioLog -->|"read CSV"| Visual

    subgraph "Documentation & Research"
        ExperDetails["Experiment Details\n(Prompts/Q&A/Disclaimers)"]:::gray
        WeeklyMD["Weekly Deep Research (MD)"]:::gray
        WeeklyPDF["Weekly Deep Research (PDF)"]:::gray
    end

    subgraph "Template: Start Your Own"
        T_Ingest["Trading_Script.py"]:::blue
        T_Visual["Generate_Graph.py"]:::orange
        T_TradeLog[(chatgpt_trade_log.csv)]:::blue
        T_PortfolioLog[(chatgpt_portfolio_update.csv)]:::blue
        T_Readme["README.md"]:::gray
    end

    T_Ingest --> T_Visual
    T_Ingest --> T_TradeLog
    T_Ingest --> T_PortfolioLog

    requirements["requirements.txt"]:::green

    %% Click Events
    click Ingest "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Scripts and CSV Files/Trading_Script.py"
    click Decision "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Scripts and CSV Files/Trading_Script.py"
    click TradeLog "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Scripts and CSV Files/chatgpt_trade_log.csv"
    click PortfolioLog "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Scripts and CSV Files/chatgpt_portfolio_update.csv"
    click Visual "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Scripts and CSV Files/Generate_Graph.py"
    click requirements "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/requirements.txt"
    click ExperDetails "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/tree/main/Experiment Details/"
    click WeeklyMD "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/tree/main/Weekly Deep Research (MD)/"
    click WeeklyPDF "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/tree/main/Weekly Deep Research (PDF)/"
    click T_Ingest "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Start Your Own/Trading_Script.py"
    click T_Visual "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Start Your Own/Generate_Graph.py"
    click T_TradeLog "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Start Your Own/chatgpt_trade_log.csv"
    click T_PortfolioLog "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Start Your Own/chatgpt_portfolio_update.csv"
    click T_Readme "https://github.com/luckyone7777/chatgpt-micro-cap-experiment/blob/main/Start Your Own/README.md"

    classDef blue fill:#D0E6FF,stroke:#333,stroke-width:1px;
    classDef green fill:#D0FFD6,stroke:#333,stroke-width:1px;
    classDef orange fill:#FFE0B2,stroke:#333,stroke-width:1px;
    classDef gray fill:#F0F0F0,stroke:#333,stroke-width:1px;
```
