Skip to content
All library documents

Pricing Windowed Barrier Options with QuantLib-Python

Article Quant Q&A · Author: Nikita

Summary

The document addresses how to configure a barrier option whose barrier is active only during a specified portion of the option's life. The accepted response points to QuantLib-Python's partial-time barrier option class, which is intended for windowed barriers. This offers a direct alternative to the standard barrier option interface when the start and end dates of barrier monitoring matter.

A second response proposes implementing custom payoff classes and applying barrier logic only to selected observations or dates. That approach gives more control but requires the user to build and maintain the relevant payoff behavior. The discussion is brief and does not provide constructor details, supported barrier conventions, pricing examples, or validation against a model. Users should consult the class documentation and confirm that its timing conventions match the intended monitoring window.

Key ideas

  • QuantLib-Python provides a partial-time barrier option class for barriers active over a window.
  • A standard barrier option interface may not expose monitoring start and end dates.
  • Custom payoff classes can implement barrier activation over selected dates or data points.
  • The discussion does not specify constructor arguments or validate pricing behavior.

Tags

Full text
# Configuring barrier option in Quantlib-Python


# Configuring barrier option in Quantlib-Python












Is there a possibility to configure the period the barrier is active, using Quantlib for python? Namely to set up the start and the end dates we compare the spot vs the barrier.

If we look at quantlib-python-docs (https://quantlib-python-docs.readthedocs.io/en/latest/instruments/options.html?highlight=BarrierOption#ql.BarrierOption), the ql.BarrierOption class constructor seems not to have such a possibility. Should we use another class?

Any help is appreciated.

## Answer by user35980 (score 1)

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

I think what you're looking for is the `ql.PartialTimeBarrierOption` class which prices windowed barriers.

## Answer by eruiz (score 0)

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

I would make your own payoff classes for the different types of Barrier Options. Then when you calculate the payoff you can specify which data to run or when to start the barrier payoff. Working on a similar homework now

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.