# sphinx811004/finworld architecture

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

- Interactive diagram: https://gitdiagram.com/sphinx811004/finworld
- Repository: https://github.com/sphinx811004/finworld

## Overview

FinWorld is an end-to-end financial AI research platform. Its main workflow acquires market and text data, preprocesses it into task-ready datasets, then trains and evaluates forecasting, trading, portfolio, and financial-language systems. The graph also shows the agent/tool and model-provider capabilities documented by the README. Most connections reflect README-level architecture rather than inspected call sites; the sampled excerpts directly support only the LiteLLM provider’s use of its base and message manager.

Main entry points: [`finworld/data`](https://github.com/sphinx811004/finworld/tree/main/finworld/data) (Task datasets), [`finworld/trainer/rl/ppo_trading_trainer.py`](https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/rl/ppo_trading_trainer.py) (Trading), [`finworld/agent/agent`](https://github.com/sphinx811004/finworld/tree/main/finworld/agent/agent) (Finance and research agents), [`finworld/trainer/time/forecasting.py`](https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/time/forecasting.py) (Forecasting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Financial data"]
  node_download["Market downloaders"]
  node_processor["Data processors"]
  node_alpha["Alpha158 factors<br/>[alpha158.py]"]
  node_datasets["Task datasets"]
end

subgraph group_tasks["Financial tasks"]
  node_forecast["Forecasting<br/>[forecasting.py]"]
  node_trading["Trading"]
  node_portfolio["Portfolio management"]
  node_environment["LLM trading environment"]
  node_eval["Evaluation metrics"]
end

subgraph group_models["Models and training"]
  node_model["Forecasting architectures"]
  node_rlmodels["RL actor-critic"]
  node_llmprovider["LLM providers<br/>[base.py]"]
  node_litellm["LiteLLM adapter<br/>[litellm.py]"]
  node_messages["Message formatting<br/>[message_manager.py]"]
end

subgraph group_agents["LLM agents"]
  node_agents["Finance and research agents"]
  node_tools["Agent tools"]
  node_mcp["MCP integration"]
  node_finreasoner["FinReasoner data<br/>[data_process.py]"]
end

subgraph group_platform["Shared platform"]
  node_config["Experiment configuration<br/>[config.py]"]
  node_registry["Component registry<br/>[registry.py]"]
  node_calendar["Market calendars<br/>[manager.py]"]
  node_tracking["Experiment tracking<br/>[logger.py]"]
  node_verl["Distributed RL training<br/>[fsdp_workers.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"acquires data"| node_download
node_download -->|"supplies raw data"| node_processor
node_processor -->|"engineers features"| node_alpha
node_processor -->|"prepares datasets"| node_datasets
node_alpha -->|"adds factors"| node_datasets
node_datasets -->|"feeds training"| node_forecast
node_datasets -->|"feeds training"| node_trading
node_datasets -->|"feeds training"| node_portfolio
node_datasets -.->|"provides market data"| node_environment
node_forecast -->|"trains models"| node_model
node_trading -->|"trains policies"| node_rlmodels
node_portfolio -->|"trains policies"| node_rlmodels
node_environment -.->|"simulates actions"| node_trading
node_forecast -->|"evaluates forecasts"| node_eval
node_trading -->|"evaluates returns"| node_eval
node_portfolio -->|"evaluates returns"| node_eval
node_researcher -.->|"invokes agents"| node_agents
node_agents -->|"uses tools"| node_tools
node_agents -.->|"requests completions"| node_llmprovider
node_finreasoner -->|"supports training"| node_agents
node_litellm -->|"extends provider"| node_llmprovider
node_litellm -->|"formats messages"| node_messages
node_agents -.->|"optional tool bridge"| node_mcp
node_config -.->|"configures components"| node_registry
node_calendar -.->|"supplies trading days"| node_datasets
node_forecast -.->|"logs experiments"| node_tracking
node_trading -.->|"uses distributed training"| node_verl

click node_download "https://github.com/sphinx811004/finworld/tree/main/finworld/downloader"
click node_processor "https://github.com/sphinx811004/finworld/tree/main/finworld/processor"
click node_alpha "https://github.com/sphinx811004/finworld/blob/main/finworld/factor/alpha158.py"
click node_datasets "https://github.com/sphinx811004/finworld/tree/main/finworld/data"
click node_forecast "https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/time/forecasting.py"
click node_trading "https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/rl/ppo_trading_trainer.py"
click node_portfolio "https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/rl/ppo_portfolio_trainer.py"
click node_environment "https://github.com/sphinx811004/finworld/blob/main/finworld/environment/environment_llm_trading.py"
click node_eval "https://github.com/sphinx811004/finworld/tree/main/finworld/evaluator"
click node_model "https://github.com/sphinx811004/finworld/tree/main/finworld/models"
click node_rlmodels "https://github.com/sphinx811004/finworld/tree/main/finworld/models/rl"
click node_llmprovider "https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/base.py"
click node_litellm "https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/litellm.py"
click node_messages "https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/message_manager.py"
click node_agents "https://github.com/sphinx811004/finworld/tree/main/finworld/agent/agent"
click node_tools "https://github.com/sphinx811004/finworld/tree/main/finworld/tools"
click node_mcp "https://github.com/sphinx811004/finworld/tree/main/finworld/mcp"
click node_finreasoner "https://github.com/sphinx811004/finworld/blob/main/configs/finreasoner/data_process.py"
click node_config "https://github.com/sphinx811004/finworld/blob/main/finworld/config/config.py"
click node_registry "https://github.com/sphinx811004/finworld/blob/main/finworld/registry.py"
click node_calendar "https://github.com/sphinx811004/finworld/blob/main/finworld/calendar/manager.py"
click node_tracking "https://github.com/sphinx811004/finworld/blob/main/finworld/log/logger.py"
click node_verl "https://github.com/sphinx811004/finworld/blob/main/libs/verl/verl/workers/fsdp_workers.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_download,node_processor,node_alpha,node_datasets toneBlue
class node_forecast,node_trading,node_portfolio,node_environment,node_eval toneAmber
class node_model,node_rlmodels,node_llmprovider,node_litellm,node_messages toneMint
class node_agents,node_tools,node_mcp,node_finreasoner toneRose
class node_config,node_registry,node_calendar,node_tracking,node_verl,node_researcher toneIndigo
```

## Components

### Financial data

- [Market downloaders](https://github.com/sphinx811004/finworld/tree/main/finworld/downloader): `finworld/downloader`
- [Data processors](https://github.com/sphinx811004/finworld/tree/main/finworld/processor): `finworld/processor`
- [Alpha158 factors](https://github.com/sphinx811004/finworld/blob/main/finworld/factor/alpha158.py): `finworld/factor/alpha158.py`
- [Task datasets](https://github.com/sphinx811004/finworld/tree/main/finworld/data): `finworld/data`

### Financial tasks

- [Forecasting](https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/time/forecasting.py): `finworld/trainer/time/forecasting.py`
- [Trading](https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/rl/ppo_trading_trainer.py): `finworld/trainer/rl/ppo_trading_trainer.py`
- [Portfolio management](https://github.com/sphinx811004/finworld/blob/main/finworld/trainer/rl/ppo_portfolio_trainer.py): `finworld/trainer/rl/ppo_portfolio_trainer.py`
- [LLM trading environment](https://github.com/sphinx811004/finworld/blob/main/finworld/environment/environment_llm_trading.py): `finworld/environment/environment_llm_trading.py`
- [Evaluation metrics](https://github.com/sphinx811004/finworld/tree/main/finworld/evaluator): `finworld/evaluator`

### Models and training

- [Forecasting architectures](https://github.com/sphinx811004/finworld/tree/main/finworld/models): `finworld/models`
- [RL actor-critic](https://github.com/sphinx811004/finworld/tree/main/finworld/models/rl): `finworld/models/rl`
- [LLM providers](https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/base.py): `finworld/models/llm_provider/base.py`
- [LiteLLM adapter](https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/litellm.py): `finworld/models/llm_provider/litellm.py`
- [Message formatting](https://github.com/sphinx811004/finworld/blob/main/finworld/models/llm_provider/message_manager.py): `finworld/models/llm_provider/message_manager.py`

### LLM agents

- [Finance and research agents](https://github.com/sphinx811004/finworld/tree/main/finworld/agent/agent): `finworld/agent/agent`
- [Agent tools](https://github.com/sphinx811004/finworld/tree/main/finworld/tools): `finworld/tools`
- [MCP integration](https://github.com/sphinx811004/finworld/tree/main/finworld/mcp): `finworld/mcp`
- [FinReasoner data](https://github.com/sphinx811004/finworld/blob/main/configs/finreasoner/data_process.py): `configs/finreasoner/data_process.py`

### Shared platform

- [Experiment configuration](https://github.com/sphinx811004/finworld/blob/main/finworld/config/config.py): `finworld/config/config.py`
- [Component registry](https://github.com/sphinx811004/finworld/blob/main/finworld/registry.py): `finworld/registry.py`
- [Market calendars](https://github.com/sphinx811004/finworld/blob/main/finworld/calendar/manager.py): `finworld/calendar/manager.py`
- [Experiment tracking](https://github.com/sphinx811004/finworld/blob/main/finworld/log/logger.py): `finworld/log/logger.py`
- [Distributed RL training](https://github.com/sphinx811004/finworld/blob/main/libs/verl/verl/workers/fsdp_workers.py): `libs/verl/verl/workers/fsdp_workers.py`

### Other components

- **Researcher**

## Connections

- Researcher → Market downloaders: acquires data (evidence: `README.md`)
- Market downloaders → Data processors: supplies raw data (evidence: `README.md`)
- Data processors → Alpha158 factors: engineers features (evidence: `README.md`)
- Data processors → Task datasets: prepares datasets (evidence: `README.md`)
- Alpha158 factors → Task datasets: adds factors (evidence: `README.md`)
- Task datasets → Forecasting: feeds training (evidence: `README.md`)
- Task datasets → Trading: feeds training (evidence: `README.md`)
- Task datasets → Portfolio management: feeds training (evidence: `README.md`)
- Task datasets → LLM trading environment: provides market data
- Forecasting → Forecasting architectures: trains models (evidence: `README.md`)
- Trading → RL actor-critic: trains policies (evidence: `README.md`)
- Portfolio management → RL actor-critic: trains policies (evidence: `README.md`)
- LLM trading environment → Trading: simulates actions
- Forecasting → Evaluation metrics: evaluates forecasts (evidence: `README.md`)
- Trading → Evaluation metrics: evaluates returns (evidence: `README.md`)
- Portfolio management → Evaluation metrics: evaluates returns (evidence: `README.md`)
- Researcher → Finance and research agents: invokes agents
- Finance and research agents → Agent tools: uses tools (evidence: `README.md`)
- Finance and research agents → LLM providers: requests completions
- FinReasoner data → Finance and research agents: supports training (evidence: `README.md`)
- LiteLLM adapter → LLM providers: extends provider (evidence: `finworld/models/llm_provider/litellm.py`)
- LiteLLM adapter → Message formatting: formats messages (evidence: `finworld/models/llm_provider/litellm.py`)
- Finance and research agents → MCP integration: optional tool bridge
- Experiment configuration → Component registry: configures components
- Market calendars → Task datasets: supplies trading days
- Forecasting → Experiment tracking: logs experiments
- Trading → Distributed RL training: uses distributed training
