# jwallbridge/translob architecture

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

- Interactive diagram: https://gitdiagram.com/jwallbridge/translob
- Repository: https://github.com/jwallbridge/translob

## Overview

TransLOB is research code for predicting future limit-order-book price movements with a CNN followed by a Transformer. The README describes the product workflow, but the repository contains layer/function implementations rather than a runnable data, training, or inference pipeline. Accordingly, the graph shows the documented model stages and the Transformer’s implemented attention block without implying an executable end-to-end assembly; the README’s FI-2010 data and prediction-label details are represented as context, not as implemented ingestion or labeling components.

Main entry points: [`python/LobFeatures.py`](https://github.com/jwallbridge/translob/blob/master/python/LobFeatures.py) (CNN Feature Extraction), [`python/LobTransformer.py`](https://github.com/jwallbridge/translob/blob/master/python/LobTransformer.py) (Transformer Block), [`python/LobPosition.py`](https://github.com/jwallbridge/translob/blob/master/python/LobPosition.py) (Position Encoding), [`python/LobAttention.py`](https://github.com/jwallbridge/translob/blob/master/python/LobAttention.py) (Self-Attention)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_features["LOB Features"]
  node_cnn["CNN Feature Extraction<br/>[LobFeatures.py]"]
  node_causal_conv["Causal Convolution<br/>[LobFeatures.py]"]
end

subgraph group_transformer["Transformer Layers"]
  node_position["Position Encoding<br/>[LobPosition.py]"]
  node_transformer_block["Transformer Block<br/>[LobTransformer.py]"]
  node_attention["Self-Attention<br/>[LobAttention.py]"]
end

subgraph group_context["Prediction Context"]
  node_lob_input["LOB Snapshots"]
  node_price_movement["Price Movement Prediction"]
end

node_researcher(("Researcher"))

node_researcher -.->|"provides snapshots"| node_lob_input
node_lob_input -->|"extracts features"| node_cnn
node_cnn -.->|"feeds Transformer"| node_transformer_block
node_cnn -.->|"adds position encoding"| node_position
node_transformer_block -->|"uses attention"| node_attention
node_transformer_block -.->|"predicts movements"| node_price_movement
node_researcher -.->|"seeks prediction"| node_price_movement

click node_cnn "https://github.com/jwallbridge/translob/blob/master/python/LobFeatures.py"
click node_causal_conv "https://github.com/jwallbridge/translob/blob/master/python/LobFeatures.py"
click node_position "https://github.com/jwallbridge/translob/blob/master/python/LobPosition.py"
click node_transformer_block "https://github.com/jwallbridge/translob/blob/master/python/LobTransformer.py"
click node_attention "https://github.com/jwallbridge/translob/blob/master/python/LobAttention.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_cnn,node_causal_conv toneBlue
class node_position,node_transformer_block,node_attention toneAmber
class node_lob_input,node_price_movement toneMint
class node_researcher toneIndigo
```

## Components

### LOB Features

- [CNN Feature Extraction](https://github.com/jwallbridge/translob/blob/master/python/LobFeatures.py): `python/LobFeatures.py`
- [Causal Convolution](https://github.com/jwallbridge/translob/blob/master/python/LobFeatures.py): `python/LobFeatures.py`

### Transformer Layers

- [Position Encoding](https://github.com/jwallbridge/translob/blob/master/python/LobPosition.py): `python/LobPosition.py`
- [Transformer Block](https://github.com/jwallbridge/translob/blob/master/python/LobTransformer.py): `python/LobTransformer.py`
- [Self-Attention](https://github.com/jwallbridge/translob/blob/master/python/LobAttention.py): `python/LobAttention.py`

### Prediction Context

- **LOB Snapshots**
- **Price Movement Prediction**

### Other components

- **Researcher**

## Connections

- Researcher → LOB Snapshots: provides snapshots (evidence: `README.md`)
- LOB Snapshots → CNN Feature Extraction: extracts features (evidence: `README.md`)
- CNN Feature Extraction → Transformer Block: feeds Transformer (evidence: `README.md`)
- CNN Feature Extraction → Position Encoding: adds position encoding (evidence: `README.md`)
- Transformer Block → Self-Attention: uses attention (evidence: `python/LobTransformer.py`)
- Transformer Block → Price Movement Prediction: predicts movements (evidence: `README.md`)
- Researcher → Price Movement Prediction: seeks prediction (evidence: `README.md`)
