Enabling Intraday Date Resolution in QuantLib Option Models
Summary
The document addresses whether QuantLib can model option value changes at finer than daily time intervals on the final trading day before expiry. It says intraday date resolution is possible, but requires rebuilding both the C++ library and its Python wrappers with high-resolution date support enabled. On Windows, this involves changing a user configuration header; on other systems, the build must use an intraday configuration option.
With that setting, the library uses Boost date support and can in principle represent time down to microseconds. The answer cautions that day-count conventions may not all handle this resolution correctly: Actual/360, Actual/365, and Actual/Actual are expected to support it, but should be checked. Because intraday mode is not the default and receives less testing, results may be affected by convention-specific issues or less mature support. The document explains a configuration route rather than demonstrating an option-pricing example or validating model accuracy near expiry.
Key ideas
- Intraday date resolution in QuantLib requires rebuilding the library and Python wrappers.
- The build configuration enables high-resolution dates through platform-specific settings.
- The resulting date support can in principle reach microsecond granularity.
- Day-count convention support may vary, and the less-tested configuration warrants verification.
Tags
Full text
# Quantlib - model changes in option value on day of expiry # Quantlib - model changes in option value on day of expiry I'm trying to model option value changes during the progression of the last trading day before expiry. All option pricing Quantlib examples that I've seen work with day-level granularity. I'm wondering if Quantlib can support a finer granularity in its models, and if so, how this might be set up? Thanks in advance. N.B. I'm using the Python wrapper for Quantlib at this time. ## Answer by Luigi Ballabio (score 2, accepted) https://quant.stackexchange.com/a/40163 It's possible, but you'll need to recompile both the C++ library and the Python wrappers. On Windows, you'll have to edit `ql/userconfig.hpp` and uncomment the line ``` //# define QL_HIGH_RESOLUTION_DATE ``` On other systems, you'll have to pass the flag `--enable-intraday` when you call `./configure`. This will cause the library to use the Boost.Date library internally, giving you (in principle) microsecond granularity. I'm not sure that all day-count conventions support this. Act/360, Act/365 and Act/Act should, but keep your eyes open for problems. This configuration is not the default, and thus is less tested.
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.