# udayjain2102/papertrading-model- architecture

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

- Interactive diagram: https://gitdiagram.com/udayjain2102/papertrading-model-
- Repository: https://github.com/udayjain2102/papertrading-model-

## Overview

Robinhood Agentic Trading is a read-only US-equities research and paper-trading system. Its scheduled workflow refreshes market bars, advances independent forward records for rule-based and optional LLM decisions, runs a separately guardrailed mock-broker paper tick, and renders a dashboard. Offline paper-trade runs and vectorized backtests support strategy research; scorecards and robust statistics grade results. The graph reflects README-described capabilities where source was not sampled; links for those areas are limited to documented relationships.

Main entry points: [`src/rhagent/forward.py`](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/forward.py) (Forward records), [`scripts/paper_cron.sh`](https://github.com/udayjain2102/papertrading-model-/blob/main/scripts/paper_cron.sh) (Daily workflow), [`src/rhagent/papertrade.py`](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/papertrade.py) (Event-driven runs), [`src/rhagent/refresh.py`](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/refresh.py) (Bar refresh)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Market data"]
  node_refresh["Bar refresh<br/>[refresh.py]"]
  node_yahoo["Yahoo prices"]
  node_mcp["Robinhood MCP<br/>[mcp_session.py]"]
  node_cache[("Price cache")]
  node_data["Bar access<br/>[data.py]"]
end

subgraph group_decision["Decisions and paper execution"]
  node_forward["Forward records<br/>[forward.py]"]
  node_engine["Decision engines<br/>[engine.py]"]
  node_strategies["Rule strategies"]
  node_nvidia["NVIDIA API"]
  node_overlay["Position overlays<br/>[overlay.py]"]
  node_records[("Forward state")]
  node_paper_run["Guarded paper tick<br/>[paper_run.py]"]
  node_guardrails["Safety checks<br/>[guardrails.py]"]
  node_executor["Order executor<br/>[executor.py]"]
  node_broker["Mock broker<br/>[broker.py]"]
end

subgraph group_research["Research and evaluation"]
  node_papertrade["Event-driven runs<br/>[papertrade.py]"]
  node_backtest["Vector backtest<br/>[backtest.py]"]
  node_evaluation["Run scorecards<br/>[evaluate.py]"]
  node_robust["Robust statistics<br/>[evaluate_robust.py]"]
  node_memory["Agent memory<br/>[memory.py]"]
end

subgraph group_operations["Scheduled operations"]
  node_cron["Daily workflow<br/>[paper_cron.sh]"]
  node_dashboard["Dashboard renderer<br/>[make_dashboard.py]"]
  node_dashboard_out["Dashboard output"]
end

node_schedule(("Scheduled runner"))

node_schedule -->|"starts"| node_cron
node_cron -->|"runs refresh"| node_refresh
node_refresh -.->|"fetches bars"| node_yahoo
node_refresh -.->|"fetches bars"| node_mcp
node_refresh -->|"updates cache"| node_cache
node_cron -->|"ticks records"| node_forward
node_forward -->|"loads bars"| node_data
node_data -->|"reads cache"| node_cache
node_forward -->|"requests decisions"| node_engine
node_engine -->|"adapts rules"| node_strategies
node_engine -.->|"requests verdicts"| node_nvidia
node_forward -->|"applies gate"| node_overlay
node_forward -->|"appends results"| node_records
node_cron -->|"runs paper tick"| node_paper_run
node_paper_run -->|"checks safety"| node_guardrails
node_paper_run -->|"submits order"| node_executor
node_executor -->|"validates order"| node_guardrails
node_executor -->|"places mock order"| node_broker
node_cron -->|"renders view"| node_dashboard
node_dashboard -->|"reads records"| node_records
node_dashboard -->|"writes page"| node_dashboard_out
node_papertrade -->|"loads bars"| node_data
node_papertrade -->|"requests decisions"| node_engine
node_papertrade -->|"applies overlay"| node_overlay
node_papertrade -->|"uses return logic"| node_backtest
node_evaluation -->|"reuses metrics"| node_backtest
node_robust -->|"loads runs"| node_evaluation
node_forward -->|"uses lessons"| node_memory

click node_cron "https://github.com/udayjain2102/papertrading-model-/blob/main/scripts/paper_cron.sh"
click node_refresh "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/refresh.py"
click node_mcp "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/mcp_session.py"
click node_data "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/data.py"
click node_forward "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/forward.py"
click node_engine "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/engine.py"
click node_strategies "https://github.com/udayjain2102/papertrading-model-/tree/main/src/rhagent/strategies"
click node_overlay "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/overlay.py"
click node_paper_run "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/paper_run.py"
click node_guardrails "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/guardrails.py"
click node_executor "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/executor.py"
click node_broker "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/broker.py"
click node_papertrade "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/papertrade.py"
click node_backtest "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/backtest.py"
click node_evaluation "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/evaluate.py"
click node_robust "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/evaluate_robust.py"
click node_memory "https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/memory.py"
click node_dashboard "https://github.com/udayjain2102/papertrading-model-/blob/main/scripts/make_dashboard.py"

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_refresh,node_yahoo,node_mcp,node_cache,node_data toneBlue
class node_forward,node_engine,node_strategies,node_nvidia,node_overlay,node_records,node_paper_run,node_guardrails,node_executor,node_broker toneAmber
class node_papertrade,node_backtest,node_evaluation,node_robust,node_memory toneMint
class node_cron,node_dashboard,node_dashboard_out toneRose
class node_schedule toneIndigo
```

## Components

### Market data

- [Bar refresh](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/refresh.py): `src/rhagent/refresh.py`
- **Yahoo prices**
- [Robinhood MCP](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/mcp_session.py): `src/rhagent/mcp_session.py`
- **Price cache**
- [Bar access](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/data.py): `src/rhagent/data.py`

### Decisions and paper execution

- [Forward records](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/forward.py): `src/rhagent/forward.py`
- [Decision engines](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/engine.py): `src/rhagent/engine.py`
- [Rule strategies](https://github.com/udayjain2102/papertrading-model-/tree/main/src/rhagent/strategies): `src/rhagent/strategies`
- **NVIDIA API**
- [Position overlays](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/overlay.py): `src/rhagent/overlay.py`
- **Forward state**
- [Guarded paper tick](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/paper_run.py): `src/rhagent/paper_run.py`
- [Safety checks](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/guardrails.py): `src/rhagent/guardrails.py`
- [Order executor](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/executor.py): `src/rhagent/executor.py`
- [Mock broker](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/broker.py): `src/rhagent/broker.py`

### Research and evaluation

- [Event-driven runs](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/papertrade.py): `src/rhagent/papertrade.py`
- [Vector backtest](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/backtest.py): `src/rhagent/backtest.py`
- [Run scorecards](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/evaluate.py): `src/rhagent/evaluate.py`
- [Robust statistics](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/evaluate_robust.py): `src/rhagent/evaluate_robust.py`
- [Agent memory](https://github.com/udayjain2102/papertrading-model-/blob/main/src/rhagent/memory.py): `src/rhagent/memory.py`

### Scheduled operations

- [Daily workflow](https://github.com/udayjain2102/papertrading-model-/blob/main/scripts/paper_cron.sh): `scripts/paper_cron.sh`
- [Dashboard renderer](https://github.com/udayjain2102/papertrading-model-/blob/main/scripts/make_dashboard.py): `scripts/make_dashboard.py`
- **Dashboard output**

### Other components

- **Scheduled runner**

## Connections

- Scheduled runner → Daily workflow: starts
- Daily workflow → Bar refresh: runs refresh
- Bar refresh → Yahoo prices: fetches bars
- Bar refresh → Robinhood MCP: fetches bars
- Bar refresh → Price cache: updates cache
- Daily workflow → Forward records: ticks records
- Forward records → Bar access: loads bars
- Bar access → Price cache: reads cache
- Forward records → Decision engines: requests decisions
- Decision engines → Rule strategies: adapts rules
- Decision engines → NVIDIA API: requests verdicts
- Forward records → Position overlays: applies gate
- Forward records → Forward state: appends results
- Daily workflow → Guarded paper tick: runs paper tick
- Guarded paper tick → Safety checks: checks safety
- Guarded paper tick → Order executor: submits order
- Order executor → Safety checks: validates order
- Order executor → Mock broker: places mock order
- Daily workflow → Dashboard renderer: renders view
- Dashboard renderer → Forward state: reads records
- Dashboard renderer → Dashboard output: writes page
- Event-driven runs → Bar access: loads bars
- Event-driven runs → Decision engines: requests decisions
- Event-driven runs → Position overlays: applies overlay
- Event-driven runs → Vector backtest: uses return logic
- Run scorecards → Vector backtest: reuses metrics
- Robust statistics → Run scorecards: loads runs
- Forward records → Agent memory: uses lessons
