# pklavc/autotrader architecture

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

- Interactive diagram: https://gitdiagram.com/pklavc/autotrader
- Repository: https://github.com/pklavc/autotrader

## Overview

Autotrader is a daily market-research and guarded paper-trading platform: completed market data feeds forecasts, risk-constrained targets, and next-session execution with persistent accounting and learning. The README also documents a separate guarded broker lane and private fleet lane. The repository includes a substantial AudaceFi integration for strategy research and guarded execution, plus optional crypto research. Some integration subsystems are represented from the source index and README-level scope; their internal wiring is not inferred where excerpts do not show it.

Main entry points: [`autotrader/run.py`](https://github.com/pklavc/autotrader/blob/main/autotrader/run.py) (Daily run), [`integrations/audacefi/live_decision.py`](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/live_decision.py) (Live decision), [`integrations/audacefi/adaptive_learning.py`](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/adaptive_learning.py) (Adaptive learning), [`integrations/audacefi/history_job.py`](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/history_job.py) (History job)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_research["Market research"]
  node_daily_run["Daily run<br/>[run.py]"]
  node_config["Strategy config<br/>[config.py]"]
  node_calendar["Market calendar<br/>[calendar.py]"]
  node_market_data["Market data<br/>[data.py]"]
  node_universe["Universe discovery<br/>[discovery.py]"]
  node_universe_rules["Universe rules<br/>[universe.py]"]
  node_forecast["Kronos forecast<br/>[forecast.py]"]
  node_targeting["Risk-ranked targets<br/>[portfolio.py]"]
  node_price_audit["Price verification<br/>[eulerpool.py]"]
end

subgraph group_paper["Paper portfolio"]
  node_paper_ledger[("Paper ledger<br/>[paper.py]")]
  node_paper_report["Signal report<br/>[run.py]"]
end

subgraph group_execution["Broker and fleet"]
  node_broker_run["Broker plan runner<br/>[broker_run.py]"]
  node_broker["Broker adapter<br/>[broker.py]"]
  node_broker_service{{"Alpaca paper"}}
  node_fleet_worker["Fleet worker<br/>[index.js]"]
  node_fleet_core["Fleet job core<br/>[core.js]"]
end

subgraph group_audace["AudaceFi integration"]
  node_audace_live["Live decision<br/>[live_decision.py]"]
  node_audace_signal["Intraday signals<br/>[intraday_signal.py]"]
  node_audace_strategy["League strategy<br/>[league_strategy.py]"]
  node_audace_adaptive["Adaptive learning"]
  node_audace_feedback["Adaptive feedback"]
  node_audace_history["History research"]
  node_audace_history_job["History job<br/>[history_job.py]"]
  node_audace_universe["Token research"]
  node_direct_pilot["Direct pilot<br/>[direct-pilot.mjs]"]
  node_direct_client["Direct client<br/>[direct-client.mjs]"]
  node_wallet_signer["Wallet signer<br/>[wallet-signer.mjs]"]
  node_crypto_research["Crypto research<br/>[crypto_research.py]"]
end

subgraph group_learning["Research feedback"]
  node_learning[("Outcome learning<br/>[learning.py]")]
end

node_owner(("Owner"))

node_owner -->|"starts"| node_daily_run
node_daily_run -->|"loads"| node_config
node_daily_run -->|"checks session"| node_calendar
node_daily_run -->|"loads history"| node_market_data
node_daily_run -->|"discovers assets"| node_universe
node_daily_run -->|"selects symbols"| node_universe_rules
node_daily_run -->|"requests forecasts"| node_forecast
node_forecast -->|"gets sessions"| node_calendar
node_daily_run -->|"ranks forecasts"| node_targeting
node_daily_run -->|"applies trades"| node_paper_ledger
node_targeting -.->|"sets targets"| node_paper_ledger
node_daily_run -->|"updates outcomes"| node_learning
node_learning -->|"adjusts ranking"| node_targeting
node_daily_run -.->|"writes report"| node_paper_report
node_daily_run -->|"verifies prices"| node_price_audit
node_paper_report -.->|"plans execution"| node_broker_run
node_broker_run -->|"dispatches orders"| node_broker
node_broker -.->|"submits orders"| node_broker_service
node_paper_report -.->|"queues account jobs"| node_fleet_worker
node_fleet_worker -->|"delegates jobs"| node_fleet_core
node_audace_history_job -->|"runs research"| node_audace_history
node_audace_history_job -->|"uses probe"| node_audace_live
node_audace_history_job -->|"uses learning"| node_audace_adaptive
node_audace_live -->|"uses strategy"| node_audace_strategy
node_audace_live -->|"uses adaptation"| node_audace_adaptive
node_audace_live -->|"uses feedback"| node_audace_feedback
node_audace_live -->|"uses signals"| node_audace_signal
node_audace_adaptive -->|"evaluates variants"| node_audace_strategy
node_direct_pilot -->|"calls client"| node_direct_client
node_direct_pilot -->|"uses signer"| node_wallet_signer
node_direct_pilot -->|"uses decisions"| node_audace_live
node_audace_universe -->|"uses learning"| node_audace_adaptive
node_audace_universe -->|"uses strategy"| node_audace_strategy
node_audace_universe -->|"uses signals"| node_audace_signal
node_crypto_research -->|"loads price history"| node_market_data
node_crypto_research -->|"extends forecasts"| node_forecast

click node_daily_run "https://github.com/pklavc/autotrader/blob/main/autotrader/run.py"
click node_config "https://github.com/pklavc/autotrader/blob/main/autotrader/config.py"
click node_calendar "https://github.com/pklavc/autotrader/blob/main/autotrader/calendar.py"
click node_market_data "https://github.com/pklavc/autotrader/blob/main/autotrader/data.py"
click node_universe "https://github.com/pklavc/autotrader/blob/main/autotrader/discovery.py"
click node_universe_rules "https://github.com/pklavc/autotrader/blob/main/autotrader/universe.py"
click node_forecast "https://github.com/pklavc/autotrader/blob/main/autotrader/forecast.py"
click node_targeting "https://github.com/pklavc/autotrader/blob/main/autotrader/portfolio.py"
click node_paper_ledger "https://github.com/pklavc/autotrader/blob/main/autotrader/paper.py"
click node_paper_report "https://github.com/pklavc/autotrader/blob/main/autotrader/run.py"
click node_learning "https://github.com/pklavc/autotrader/blob/main/autotrader/learning.py"
click node_price_audit "https://github.com/pklavc/autotrader/blob/main/autotrader/eulerpool.py"
click node_broker_run "https://github.com/pklavc/autotrader/blob/main/autotrader/broker_run.py"
click node_broker "https://github.com/pklavc/autotrader/blob/main/autotrader/broker.py"
click node_fleet_worker "https://github.com/pklavc/autotrader/blob/main/fleet-worker/src/index.js"
click node_fleet_core "https://github.com/pklavc/autotrader/blob/main/fleet-worker/src/core.js"
click node_audace_live "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/live_decision.py"
click node_audace_signal "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/intraday_signal.py"
click node_audace_strategy "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/league_strategy.py"
click node_audace_adaptive "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/adaptive_learning.py"
click node_audace_feedback "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/adaptive_feedback.py"
click node_audace_history "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/history_research.py"
click node_audace_history_job "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/history_job.py"
click node_audace_universe "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/universe_research.py"
click node_direct_pilot "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/direct-pilot.mjs"
click node_direct_client "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/direct-client.mjs"
click node_wallet_signer "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/wallet-signer.mjs"
click node_crypto_research "https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/crypto_research.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_daily_run,node_config,node_calendar,node_market_data,node_universe,node_universe_rules,node_forecast,node_targeting,node_price_audit toneBlue
class node_paper_ledger,node_paper_report toneAmber
class node_broker_run,node_broker,node_broker_service,node_fleet_worker,node_fleet_core toneMint
class node_audace_live,node_audace_signal,node_audace_strategy,node_audace_adaptive,node_audace_feedback,node_audace_history,node_audace_history_job,node_audace_universe,node_direct_pilot,node_direct_client,node_wallet_signer,node_crypto_research toneRose
class node_learning,node_owner toneIndigo
```

## Components

### Market research

- [Daily run](https://github.com/pklavc/autotrader/blob/main/autotrader/run.py): `autotrader/run.py`
- [Strategy config](https://github.com/pklavc/autotrader/blob/main/autotrader/config.py): `autotrader/config.py`
- [Market calendar](https://github.com/pklavc/autotrader/blob/main/autotrader/calendar.py): `autotrader/calendar.py`
- [Market data](https://github.com/pklavc/autotrader/blob/main/autotrader/data.py): `autotrader/data.py`
- [Universe discovery](https://github.com/pklavc/autotrader/blob/main/autotrader/discovery.py): `autotrader/discovery.py`
- [Universe rules](https://github.com/pklavc/autotrader/blob/main/autotrader/universe.py): `autotrader/universe.py`
- [Kronos forecast](https://github.com/pklavc/autotrader/blob/main/autotrader/forecast.py): `autotrader/forecast.py`
- [Risk-ranked targets](https://github.com/pklavc/autotrader/blob/main/autotrader/portfolio.py): `autotrader/portfolio.py`
- [Price verification](https://github.com/pklavc/autotrader/blob/main/autotrader/eulerpool.py): `autotrader/eulerpool.py`

### Paper portfolio

- [Paper ledger](https://github.com/pklavc/autotrader/blob/main/autotrader/paper.py): `autotrader/paper.py`
- [Signal report](https://github.com/pklavc/autotrader/blob/main/autotrader/run.py): `autotrader/run.py`

### Broker and fleet

- [Broker plan runner](https://github.com/pklavc/autotrader/blob/main/autotrader/broker_run.py): `autotrader/broker_run.py`
- [Broker adapter](https://github.com/pklavc/autotrader/blob/main/autotrader/broker.py): `autotrader/broker.py`
- **Alpaca paper**
- [Fleet worker](https://github.com/pklavc/autotrader/blob/main/fleet-worker/src/index.js): `fleet-worker/src/index.js`
- [Fleet job core](https://github.com/pklavc/autotrader/blob/main/fleet-worker/src/core.js): `fleet-worker/src/core.js`

### AudaceFi integration

- [Live decision](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/live_decision.py): `integrations/audacefi/live_decision.py`
- [Intraday signals](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/intraday_signal.py): `integrations/audacefi/intraday_signal.py`
- [League strategy](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/league_strategy.py): `integrations/audacefi/league_strategy.py`
- [Adaptive learning](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/adaptive_learning.py): `integrations/audacefi/adaptive_learning.py`
- [Adaptive feedback](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/adaptive_feedback.py): `integrations/audacefi/adaptive_feedback.py`
- [History research](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/history_research.py): `integrations/audacefi/history_research.py`
- [History job](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/history_job.py): `integrations/audacefi/history_job.py`
- [Token research](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/universe_research.py): `integrations/audacefi/universe_research.py`
- [Direct pilot](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/direct-pilot.mjs): `integrations/audacefi/direct-pilot.mjs`
- [Direct client](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/direct-client.mjs): `integrations/audacefi/direct-client.mjs`
- [Wallet signer](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/wallet-signer.mjs): `integrations/audacefi/wallet-signer.mjs`
- [Crypto research](https://github.com/pklavc/autotrader/blob/main/integrations/audacefi/crypto_research.py): `integrations/audacefi/crypto_research.py`

### Research feedback

- [Outcome learning](https://github.com/pklavc/autotrader/blob/main/autotrader/learning.py): `autotrader/learning.py`

### Other components

- **Owner**

## Connections

- Owner → Daily run: starts
- Daily run → Strategy config: loads (evidence: `autotrader/run.py`)
- Daily run → Market calendar: checks session (evidence: `autotrader/run.py`)
- Daily run → Market data: loads history (evidence: `autotrader/run.py`)
- Daily run → Universe discovery: discovers assets (evidence: `autotrader/run.py`)
- Daily run → Universe rules: selects symbols (evidence: `autotrader/run.py`)
- Daily run → Kronos forecast: requests forecasts (evidence: `autotrader/run.py`)
- Kronos forecast → Market calendar: gets sessions (evidence: `autotrader/forecast.py`)
- Daily run → Risk-ranked targets: ranks forecasts (evidence: `autotrader/run.py`)
- Daily run → Paper ledger: applies trades (evidence: `autotrader/run.py`)
- Risk-ranked targets → Paper ledger: sets targets (evidence: `autotrader/paper.py`)
- Daily run → Outcome learning: updates outcomes (evidence: `autotrader/run.py`)
- Outcome learning → Risk-ranked targets: adjusts ranking (evidence: `autotrader/learning.py`)
- Daily run → Signal report: writes report (evidence: `autotrader/run.py`)
- Daily run → Price verification: verifies prices (evidence: `autotrader/run.py`)
- Signal report → Broker plan runner: plans execution
- Broker plan runner → Broker adapter: dispatches orders (evidence: `autotrader/broker_run.py`)
- Broker adapter → Alpaca paper: submits orders
- Signal report → Fleet worker: queues account jobs
- Fleet worker → Fleet job core: delegates jobs (evidence: `fleet-worker/src/index.js`)
- History job → History research: runs research (evidence: `integrations/audacefi/history_job.py`)
- History job → Live decision: uses probe (evidence: `integrations/audacefi/history_job.py`)
- History job → Adaptive learning: uses learning (evidence: `integrations/audacefi/history_job.py`)
- Live decision → League strategy: uses strategy (evidence: `integrations/audacefi/live_decision.py`)
- Live decision → Adaptive learning: uses adaptation (evidence: `integrations/audacefi/live_decision.py`)
- Live decision → Adaptive feedback: uses feedback (evidence: `integrations/audacefi/live_decision.py`)
- Live decision → Intraday signals: uses signals (evidence: `integrations/audacefi/live_decision.py`)
- Adaptive learning → League strategy: evaluates variants (evidence: `integrations/audacefi/adaptive_learning.py`)
- Direct pilot → Direct client: calls client (evidence: `integrations/audacefi/direct-pilot.mjs`)
- Direct pilot → Wallet signer: uses signer (evidence: `integrations/audacefi/direct-pilot.mjs`)
- Direct pilot → Live decision: uses decisions (evidence: `integrations/audacefi/direct-pilot.mjs`)
- Token research → Adaptive learning: uses learning (evidence: `integrations/audacefi/universe_research.py`)
- Token research → League strategy: uses strategy (evidence: `integrations/audacefi/universe_research.py`)
- Token research → Intraday signals: uses signals (evidence: `integrations/audacefi/universe_research.py`)
- Crypto research → Market data: loads price history (evidence: `integrations/audacefi/crypto_research.py`)
- Crypto research → Kronos forecast: extends forecasts (evidence: `integrations/audacefi/crypto_research.py`)
