Skip to content
All library documents

Approaches to Backtesting Delta-Hedged Options Strategies in R

Article Quant Q&A · Author: Alex

Summary

The document surveys possible tools and workarounds for backtesting options strategies in R when portfolios require delta hedging and periodic rebalancing. One answer points to blotter, while cautioning that it is not specifically designed for options. Another suggests using QuantLib to calculate option deltas, aggregating them into portfolio delta, and applying hedge rules at fixed intervals or when delta moves outside chosen bands.

The responses also note that professional options backtests are often built in-house or handled with commercial software. A separate approach uses publicly available implied volatility as a proxy for option prices when historical option quotes are difficult or expensive to obtain, with a referenced example implementation. These are practical starting points rather than a tested comparison of packages. A volatility proxy may not reproduce executable prices, and the document does not specify assumptions for transaction costs, volatility changes, exercise, or hedge execution, all of which can affect backtest results.

Key ideas

  • Blotter is suggested as a general R trading framework, though it is not options-focused.
  • QuantLib can supply option deltas that can be aggregated into portfolio exposure for hedge rules.
  • Delta hedging can be scheduled at discrete intervals or triggered when exposure crosses bands.
  • Public implied volatility can serve as a proxy for option prices when historical quotes are unavailable.
  • The recommendations do not compare tools or specify key assumptions such as costs and execution.

Tags

Full text
# backtesting options strategies in R


# backtesting options strategies in R












I would like to backtest an options strategy in R. I require the ability to delta hedge and rebalance to options in the portfolio at different frequencies (daily, monthly,etc.) What packages are the correct ones to use for this purpose? (I have seen the R Finance task view but there is a lot there)

## Answer by Brian B (score 3, accepted)

https://quant.stackexchange.com/a/7953

Assuming you already have a way to obtain hedge ratios and the like, your best available choice is probably blotter (used to be just quantstrat). You will find that it isn't necessarily oriented toward options.

Generally for options backtesting, pros end up making their own or buying commercial software. There are tons of commercial providers, but I don't know anyone who has investigated the top candidates.

## Answer by cdcaveman (score 2)

https://quant.stackexchange.com/a/7945

My first thought would be to use quantlib package to get the delta values and comply those to get a position delta. Then use rules based on delta values to hedge. Use discrete time adjustments or use delta bands.

## Answer by vonjd (score 0)

https://quant.stackexchange.com/a/63385

I just published a blog post on how to backtest options strategies with R: Backtesting Options Strategies with R

In the post, I provide the fully documented R code for your own experiments. The "trick" is to use the often publicly available implied volatility as a proxy for option prices (which are often hard to come by and/or very expensive).

For details please consult the post.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.