- Solve real problems with our hands-on interface
- Progress from basic puts and calls to advanced strategies

Posted July 7, 2026 at 12:12 pm
The article “Differential Machine Learning with Twin Networks in R: Forecasting Bitcoin with Volatility Proxies” was originally posted on DataGeeek blog.
Differential Machine Learning (DML), as introduced in the recent arXiv paper (Differential Machine Learning for 0DTE Options with Stochastic Volatility and Jumps), extends supervised learning by incorporating not only function values but also their derivatives. In financial contexts, this often means sensitivities such as Greeks. However, when direct derivatives are unavailable, we can approximate market dynamics using volatility indicators.
In this project, we adapt DML to Bitcoin price forecasting. Instead of derivatives, we use RSI, MACD, and Bollinger Bands as proxies for volatility. These indicators capture momentum, trend strength, and price dispersion, providing a practical way to embed uncertainty into the learning process. To implement this, we design a twin-network architecture in Keras: one network learns price dynamics from time-based features, while the other learns volatility signals. Finally, we combine them via a stacking ensemble to achieve robust forecasts with confidence intervals.
These indicators act as empirical substitutes for theoretical derivatives. While DML in its pure form requires sensitivities, in practice, these volatility proxies provide similar information about how prices respond to market forces.
The idea is to separate the learning tasks:
Once both networks are trained, their predictions are combined using a linear regression meta-model. This stacking ensemble learns the optimal weighting between the primary and auxiliary outputs. The result is a forecast that integrates both trend and volatility signals, significantly improving accuracy compared to either network alone.

Source: DataGeeek
yardstick package.This demonstrates the power of combining price and volatility signals in a unified framework.
To quantify uncertainty, we compute residual-based confidence intervals around the point forecasts:

This approach uses the standard deviation of training residuals to generate 95% confidence bands. It provides interpretable uncertainty estimates without requiring explicit probabilistic modeling.
The forecasts are visualized with ggplot2:

Source: DataGeeek
This design clearly communicates both the central forecast and the uncertainty range. The chart you will include at the end of the blog shows exactly this: a red forecast line, black actuals, and a grey confidence band, illustrating how the ensemble integrates volatility information into predictive intervals.

Source: Yahoo Finance
Keras3 is the modern R interface to the Keras deep learning library, built on top of TensorFlow. It allows R users to define, train, and evaluate neural networks with concise syntax while leveraging TensorFlow’s computational power. Unlike earlier versions, Keras3 is fully aligned with TensorFlow 2.x, ensuring long-term support and compatibility.
In our workflow, Keras3 was the backbone for implementing the twin-network architecture:

Source: DataGeeek
Keras3 bridges the gap between R’s tidyverse/tidymodels ecosystem and modern deep learning:
recipes, timetk).By using Keras3:
This demonstrates how Keras3 empowers R users to implement advanced architectures like twin networks, making Differential Machine Learning concepts practical in financial forecasting.
This case study demonstrates how Differential Machine Learning concepts can be adapted for financial forecasting in R:
By combining academic ideas with reproducible R workflows, we can build robust forecasting pipelines that bridge theory and practice.
Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from DataGeeek and is being posted with its permission. The views expressed in this material are solely those of the author and/or DataGeeek and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.
The third-party code discussed within this article is not investment or trading advice, and is for proof-of-concept, educational, and illustrative purposes only. IBKR makes no representations or warranty regarding its accuracy or completeness. Users are solely responsible for conducting their own independent testing and due diligence before applying any code or concepts in a live or production environment
Trading Bitcoin involves significant risk. Bitcoin prices can be highly volatile and may fluctuate rapidly, potentially resulting in substantial losses. Because Bitcoin operates on a decentralized blockchain, network congestion or technical issues may occasionally delay transaction settlement. Regulatory frameworks for digital assets are still evolving and could impact availability, liquidity, or pricing. When trading through Interactive Brokers, execution and custody are facilitated by regulated partners such as Paxos or Zero Hash; however, these arrangements do not eliminate the possibility of operational or counterparty risk.
Trading in digital assets, including cryptocurrencies, is especially risky and is only for individuals with a high risk tolerance and the financial ability to sustain losses. Eligibility to trade in digital asset products may vary based on jurisdiction.
Join The Conversation
For specific platform feedback and suggestions, please submit it directly to our team using these instructions.
If you have an account-specific question or concern, please reach out to Client Services.
We encourage you to look through our FAQs before posting. Your question may already be covered!