To understand and experiment with the models implemented in LOBFrame, you can refer to the following resources:
Model Implementations within the Repository:
The primary resource is the code itself. You can find the implementation of each model in the models directory:
- AxialLob:
./repos/LOBFrame/models/AxialLob/axiallob.py - This model utilizes Gated Axial Attention. You might want to research "Axial Attention" for a deeper understanding of the architecture.
- CNN1:
./repos/LOBFrame/models/CNN1/cnn1.py - This is a convolutional neural network architecture. Standard resources on CNNs for time series data would be beneficial.
- CNN2:
./repos/LOBFrame/models/CNN2/cnn2.py - Another convolutional neural network, potentially inspired by the paper mentioned in the code's comments regarding stationary limit order book features.
- DeepLob:
./repos/LOBFrame/models/DeepLob/deeplob.py - This model's architecture is detailed in the paper "Deep Limit Order Book Forecasting".
- DLA:
./repos/LOBFrame/models/DLA/DLA.py - The code implements a model using attention mechanisms and GRUs. Examining the forward pass in the code will be helpful to understand its structure.
- iTransformer:
./repos/LOBFrame/models/iTransformer/itransformer.py - This is an adaptation of the Transformer architecture, likely tailored for time series data by transposing the input. You can research "Invariant Transformer" architectures for time series.
- LobTransformer:
./repos/LOBFrame/models/LobTransformer/lobtransformer.py - This model combines convolutional layers with a Transformer encoder. Studying the code will reveal the specific structure.
- BiNBTabl & BiNCTabl:
- BiNBTabl:
./repos/LOBFrame/models/TABL/bin_tabl.py
- BiNCTabl:
./repos/LOBFrame/models/TABL/bin_tabl.py
- BiN Layer:
./repos/LOBFrame/models/TABL/bin_nn.py
- TABL Layer:
./repos/LOBFrame/models/TABL/tabl_layer.py
- BL Layer:
./repos/LOBFrame/models/TABL/bl_layer.py
These models are built using custom layers: BiN, BL_layer, and TABL_layer. You'll need to examine the code for each of these layers to understand how they function and how BiNBTabl and BiNCTabl are constructed.
- HLOB (CompleteHCNN):
./repos/LOBFrame/models/CompleteHCNN/complete_hcnn.py - This model is described in the paper "HLOB -- Information Persistence and Structure in Limit Order Books". Understanding the concept of homological structures in LOBs will be key to understanding this model.
Research Papers:
The README.md file provides links to the research papers that introduced some of these models:
General Deep Learning Resources:
For the more standard architectures, you can refer to general deep learning resources:
- Convolutional Neural Networks (CNNs): Numerous tutorials and courses are available online explaining CNN architectures, their building blocks (convolutional layers, pooling layers, activation functions), and their applications in time series analysis.
- Transformers: The original paper "Attention is All You Need" is a fundamental resource for understanding the Transformer architecture and the attention mechanism.
- Recurrent Neural Networks (RNNs) and LSTMs/GRUs: For models like DLA and the LSTM component in DeepLOB, understanding RNNs, Long Short-Term Memory networks (LSTMs), and Gated Recurrent Units (GRUs) will be helpful.
How to Start Playing Around:
- Start with the simpler models: Begin by examining the code for
CNN1 or CNN2 as these are more straightforward CNN architectures.
- Read the corresponding papers: For
DeepLOB and HLOB, read the linked research papers to understand the motivation and design choices behind these models.
- Understand the building blocks: If you're unfamiliar with Transformers or Axial Attention, start by learning the fundamentals of these components before diving into the
LobTransformer, iTransformer, or AxialLob code.
- Experiment with hyperparameters: Once you understand the basic structure of a model, you can start modifying hyperparameters like the number of layers, the size of the hidden units, learning rates, etc., by adjusting the parameters in the
main.py or directly within the model's __init__ method.
- Integrate new models: The
README.md mentions the framework's flexibility in integrating new models. Studying the existing model implementations will give you a template for how to structure your own models within the LOBFrame framework.
- Utilize the provided scripts: The
main.py script provides the entry point for training, evaluation, and backtesting. Understand how to use this script to run experiments with different models and configurations.
By exploring the code, reading the relevant research papers, and utilizing general deep learning resources, you will gain a strong understanding of the models implemented in LOBFrame and be well-equipped to experiment with them. Remember to consult the README.md for instructions on setting up the environment and running experiments.