## 4 Stock Price Prediction Model Methodology and Research Design
### Data Preparation
#### 4.2.2 Feature Selection  
As elucidated by [PERSON] et al. [37], limit orders at deeper levels are deemed less relevant to price movements. Consequently, it is a common practice to restrict the analysis to the first 10 levels of the limit order book, as demonstrated in the works by [PERSON] et al. [35] and [PERSON] et al. [10]. This same approach was applied in the current work. We experimented with including additional LOB levels and more transactions but found no significant improvement in model performance. Including too many inputs can overwhelm the model and degrade performance due to increased noise and redundancy in the data.  
As confirmed by [PERSON] et al. [15] and through our own experiments, OF data offer additional insights and can enhance the model's predictive capability by tracking the actual trades executed by market participants. However, to ensure consistency and feasibility in input data tensors for the neural network, it was necessary to limit the number of OF transactions added to the feature space at each timestamp. The alternative, allowing for a variable number of transactions at each timestamp, would result in input data tensors with variable shapes, rendering them incompatible with the neural network. Preliminary analysis revealed that the majority of limit order book timestamps exhibit fewer than 10 OF transactions occurring since the previous timestamp. Consequently, this number was chosen as a practical limit. We acknowledge that further research on this matter could be beneficial.  
Thus, at each training iteration, input data are represented by data tensors of shape [100, 70]. In these R100 \(\times\) R70 tensors, R100 corresponds to the 100 most recent timestamps, R[1-40] pertain to the limit order book features, namely price and volume data for the 10 best bids and the 10 best asks, resulting in 40 features, and R[41-70] represent the order flow features--price, volume, and direction (buy/sell)--for the 10 latest transactions at each limit order book timestamp, contributing 3 \(\times\) 10 = 30 features.  
The LOBSTER dataset has a slightly different representation of the order flow. It has only one order between each consequent LOB timestamp, but in addition to the direction, price, and volume, it also contains event types:  
1. Submission of a new limit order;
2. Cancellation (partial deletion of a limit order);
3. Deletion (total deletion of a limit order);
4. Execution of a visible limit order;  
Figure 7: Google stock price. Source: LOBSTER/NASDAQ.  
Execution of a hidden limit order;
* Cross-trade, e.g., auction trade;
* Trading halt indicator.  
For the experiments with the LOBSTER data, input data are represented by tensors of shape [100; 44]. In these R100 \(\times\) R44 tensors, R100 corresponds to the 100 most recent timestamps, and R[1-40] relate to the limit order book features, namely price and volume data for the 10 best bids and the 10 best asks, resulting in 40 features. The rest, R[41; 42; 43; 44], represent the order flow features: price, volume, direction (buy/sell), and event type for the latest transaction at each limit order book timestamp.  
The input representation was a key factor in the model's strong predictive power. By incorporating both LOB and OF data, as well as their temporal characteristics, the model was able to capture diverse patterns from these different but complementary sources of market information. This allowed it to outperform models using only LOB or static input representations. The hierarchical feature-learning architecture was also important for extracting meaningful patterns from this representation.