Go to Repository

Neural Network on Bitcoin OHLC second data

Table of Contents

Neural Network Integration

To effectively model complex financial dynamics, a neural network can be designed to process input data derived from the Jump-Diffusion Stochastic Differential Equation (SDE). This neural network leverages features extracted from the SDE (such as drift, volatility, jump intensity, and jump sizes) to predict and refine asset price movements. By feeding the network with real-time OHLC (Open, High, Low, Close) data and initial parameter estimates, the model dynamically adjusts to market conditions. The network continuously learns to optimize its predictions by minimizing the discrepancy between simulated price paths and actual market data, offering an adaptive solution for forecasting and risk analysis in volatile markets.

Figure 1: Neural network structure visualisation.

Jump Diffusion Process with Dynamic Scaling

The stochastic differential equation (SDE) for the asset price \( S_t \) is given by:

\[ dS_t = \mu S_t \, dt + \sigma S_t \, D_t + S_{t^-} (J - 1) \, dN_t \]

In the stochastic differential equation (SDE) \( dS_t = \mu S_t \, dt + \sigma S_t \, D_t + S_{t^-} (J - 1) \, dN_t \), each term models a distinct component of the asset price dynamics. The term \( \mu S_t \, dt \) represents the deterministic drift, where \( \mu \) is the constant drift rate reflecting the expected return of the asset over time. The second term, \( \sigma S_t \, D_t \), captures the continuous stochastic volatility, with \( \sigma \) as the baseline volatility and \( D_t \) as the dynamic scaling factor that adjusts volatility during periods of market instability, particularly after jumps. The final term, \( S_{t^-} (J - 1) \, dN_t \), models sudden and discrete jumps in the asset price. Here, \( N_t \) is a Poisson process with intensity \( \lambda \) that determines the random occurrence of jumps, and \( J \) is a random variable representing the proportional size of these jumps. The notation \( S_{t^-} \) denotes the asset price immediately before a jump occurs, ensuring that the jump is applied instantaneously. Together, these components allow the model to capture both the continuous fluctuations and abrupt changes in asset prices, providing a comprehensive framework for modeling financial markets with jump risk.

Dynamic Scaling Factor

\[ D_t = \left(1 + (\theta - 1) I_t\right) dW_t \]

where \( \theta \) is the volatility scaling factor applied during jumps, and \( I_t \) is an indicator function:

\[ I_t = \begin{cases} 1, & \text{if a jump occurs and Close/Open} \neq 1 \\ 0, & \text{if Close/Open} = 1 \end{cases} \]

When a jump occurs, \( I_t = 1 \), and the volatility is scaled by \( \theta \). This scaled volatility persists until the price stabilizes, i.e., when the ratio \( \text{Close/Open} = 1 \), after which \( D_t \) reverts to normal Brownian motion.

Application of Itô's Lemma

Applying Itô's Lemma to \( X_t = \ln S_t \):

\[ \begin{align*} dX_t &= \left(\mu - \frac{1}{2} \sigma^2 (1 + (\theta - 1) I_t)^2\right) dt + \sigma (1 + (\theta - 1) I_t) dW_t + \ln(J) \, dN_t\\[2mm] X_t &= \ln S_0 + \left(\mu - \frac{1}{2} \sigma^2 - \lambda \kappa\right)t + \sigma \int_0^t (1 + (\theta - 1) I_s) \, dW_s + \sum_{i=1}^{N_t} \ln(J_i) \end{align*} \]

Correction

It is important to accurately represent the time interval over which the dynamic scaling factor \( D_t \) influences the diffusion component of the asset price. Originally, the integral of the diffusion term was taken from 0 to \( t \), which does not correctly capture the behavior of \( D_t \). Since \( D_t \) should only apply the scaling factor \( \theta \) from the moment a jump occurs until the market stabilizes (i.e., when the ratio of Close/Open returns to 1), the limits of integration must be adjusted. Let \( \tau \) denote the time at which a jump occurs and \( t^* \) denote the first time after the jump when Close/Open equals 1. The corrected form of the diffusion component is expressed as:

\[ \sigma \int_{\tau}^{t^*} \left(1 + (\theta - 1) I_s\right) \, dW_s \]

This adjustment ensures that the volatility scaling is only active during the relevant period of market instability, starting from the jump and ending when the asset price stabilizes. This refined modeling more accurately reflects the transient impact of jumps on market volatility.

Conclusion

The neural network model, trained on features derived from the Jump-Diffusion Stochastic Differential Equation (SDE), demonstrates strong performance as evidenced by the rapid decline in training, validation, and evaluation losses. This consistent improvement highlights the model's ability to accurately capture and predict complex asset price dynamics. Ongoing refinements and further testing will be conducted to ensure robustness and scalability. The comprehensive results and analysis will be published in future updates, providing deeper insights into the model's effectiveness in financial forecasting.

Figure 2: Neural network training loss visualization.

References

Omole, O., & Enke, D. (2024). Deep learning for Bitcoin price direction prediction: models and trading strategies empirically compared. Financial Innovation. Retrieved from https://jfin-swufe.springeropen.com/articles/10.1186/s40854-024-00643-1

Qiang, Z., & Shen, J. (2021). Bitcoin High-Frequency Trend Prediction with Convolutional and Recurrent Neural Networks. Stanford University Project Report. Retrieved from https://cs230.stanford.edu/projects_winter_2021/reports/70308950.pdf