# williamdevena/rl_for_market_making_in_sports_trading architecture

> Architecture diagram of the GitHub repository williamdevena/rl_for_market_making_in_sports_trading, 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/williamdevena/rl_for_market_making_in_sports_trading
- Repository: https://github.com/williamdevena/rl_for_market_making_in_sports_trading

## Overview

This repository implements tennis-market-making experiments: a simulated tennis match supplies odds to a Gym trading environment, where RL agents learn market-making actions; separate experiments evaluate agents and report risk/performance metrics. The README also describes baseline-model experiments and data preparation/plotting utilities. The principal simulator-to-environment and training/evaluation relationships are shown where excerpts or the SOURCE INDEX support them; several evaluation entrypoints and data utilities were not sampled, so their internal connections are omitted.

Main entry points: [`training.py`](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/training.py) (RL training), [`environments/gym_env/sportsTradingEnvironment.py`](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/gym_env/sportsTradingEnvironment.py) (Sports trading environment), [`testing/testing.py`](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/testing/testing.py) (Evaluation engine), [`prices_simulation.py`](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/prices_simulation.py) (Price simulations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market_sim["Market simulation"]
  node_tennis_sim["Tennis simulator<br/>[tennisSimulator.py]"]
  node_price_demo["Price simulations"]
end

subgraph group_trading["Trading environment"]
  node_trade_env["Sports trading environment"]
end

subgraph group_agents["Agent experiments"]
  node_training["RL training<br/>[training.py]"]
  node_tb_callback["TensorBoard callback"]
  node_random_demo["Random-action simulation"]
  node_test_single["Single-event test"]
  node_test_multiple["Multiple-event test"]
  node_test_combinations["Parameter combinations"]
  node_test_correlations["State-action correlations"]
  node_test_engine["Evaluation engine<br/>[testing.py]"]
  node_model_weights["Trained model weights"]
end

subgraph group_analysis["Data and reporting"]
  node_data_processing["Data processing<br/>[data_processing.py]"]
  node_price_files["Betfair price-file utilities<br/>[pricefileutils.py]"]
  node_plotting["Plots and metrics<br/>[plotting.py]"]
  node_setup["Reproducibility setup<br/>[setup.py]"]
end

node_engineer(("Researcher"))

node_engineer -->|"runs training"| node_training
node_engineer -->|"runs test"| node_test_single
node_engineer -->|"runs test"| node_test_multiple
node_engineer -->|"runs test"| node_test_combinations
node_engineer -->|"runs test"| node_test_correlations
node_engineer -->|"runs simulation"| node_price_demo
node_engineer -->|"runs simulation"| node_random_demo
node_training -->|"loads parameters"| node_setup
node_training -->|"creates environment"| node_trade_env
node_training -->|"configures callback"| node_tb_callback
node_trade_env -->|"simulates match"| node_tennis_sim
node_price_demo -->|"simulates matches"| node_tennis_sim
node_random_demo -->|"runs actions"| node_trade_env
node_test_engine -->|"evaluates agent"| node_trade_env
node_test_engine -->|"plots results"| node_plotting
node_engineer -->|"prepares data"| node_data_processing
node_price_files -->|"reads price files"| node_price_files

click node_tennis_sim "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/tennis_simulator/tennisSimulator.py"
click node_price_demo "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/prices_simulation.py"
click node_trade_env "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/gym_env/sportsTradingEnvironment.py"
click node_training "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/training.py"
click node_tb_callback "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/gym_env/tensorboardCallback.py"
click node_random_demo "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/random_actions_simulation.py"
click node_test_single "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_single_event.py"
click node_test_multiple "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_multiple_events.py"
click node_test_combinations "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_all_combinations.py"
click node_test_correlations "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_correlation_state_actions.py"
click node_test_engine "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/testing/testing.py"
click node_model_weights "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/tree/main/model_weights"
click node_data_processing "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/src/data_processing.py"
click node_price_files "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/utils/pricefileutils.py"
click node_plotting "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/src/plotting.py"
click node_setup "https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/utils/setup.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_tennis_sim,node_price_demo toneBlue
class node_trade_env toneAmber
class node_training,node_tb_callback,node_random_demo,node_test_single,node_test_multiple,node_test_combinations,node_test_correlations,node_test_engine,node_model_weights toneMint
class node_data_processing,node_price_files,node_plotting,node_setup toneRose
class node_engineer toneIndigo
```

## Components

### Market simulation

- [Tennis simulator](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/tennis_simulator/tennisSimulator.py): `environments/tennis_simulator/tennisSimulator.py`
- [Price simulations](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/prices_simulation.py): `prices_simulation.py`

### Trading environment

- [Sports trading environment](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/gym_env/sportsTradingEnvironment.py): `environments/gym_env/sportsTradingEnvironment.py`

### Agent experiments

- [RL training](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/training.py): `training.py`
- [TensorBoard callback](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/environments/gym_env/tensorboardCallback.py): `environments/gym_env/tensorboardCallback.py`
- [Random-action simulation](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/random_actions_simulation.py): `random_actions_simulation.py`
- [Single-event test](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_single_event.py): `test_single_event.py`
- [Multiple-event test](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_multiple_events.py): `test_multiple_events.py`
- [Parameter combinations](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_all_combinations.py): `test_all_combinations.py`
- [State-action correlations](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/test_correlation_state_actions.py): `test_correlation_state_actions.py`
- [Evaluation engine](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/testing/testing.py): `testing/testing.py`
- [Trained model weights](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/tree/main/model_weights): `model_weights`

### Data and reporting

- [Data processing](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/src/data_processing.py): `src/data_processing.py`
- [Betfair price-file utilities](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/utils/pricefileutils.py): `utils/pricefileutils.py`
- [Plots and metrics](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/src/plotting.py): `src/plotting.py`
- [Reproducibility setup](https://github.com/williamdevena/rl_for_market_making_in_sports_trading/blob/main/utils/setup.py): `utils/setup.py`

### Other components

- **Researcher**

## Connections

- Researcher → RL training: runs training (evidence: `README.md`)
- Researcher → Single-event test: runs test (evidence: `README.md`)
- Researcher → Multiple-event test: runs test (evidence: `README.md`)
- Researcher → Parameter combinations: runs test (evidence: `README.md`)
- Researcher → State-action correlations: runs test (evidence: `README.md`)
- Researcher → Price simulations: runs simulation (evidence: `README.md`)
- Researcher → Random-action simulation: runs simulation (evidence: `README.md`)
- RL training → Reproducibility setup: loads parameters (evidence: `training.py`)
- RL training → Sports trading environment: creates environment (evidence: `training.py`)
- RL training → TensorBoard callback: configures callback (evidence: `training.py`)
- Sports trading environment → Tennis simulator: simulates match (evidence: `environments/gym_env/sportsTradingEnvironment.py`)
- Price simulations → Tennis simulator: simulates matches (evidence: `prices_simulation.py`)
- Random-action simulation → Sports trading environment: runs actions (evidence: `random_actions_simulation.py`)
- Evaluation engine → Sports trading environment: evaluates agent (evidence: `testing/testing.py`)
- Evaluation engine → Plots and metrics: plots results (evidence: `testing/testing.py`)
- Researcher → Data processing: prepares data (evidence: `README.md`)
- Betfair price-file utilities → Betfair price-file utilities: reads price files (evidence: `utils/pricefileutils.py`)
