Contact

OPT_BARRIER in LibreOffice: Barrier Option Prices and Vega

Financial Intermediate LibreOffice Calc LibreOffice 4.0

Check LibreOffice OPT_BARRIER with eight option-model examples. Compare knock-in, knock-out and maturity monitoring, with a separately checked vega result.

Verification status: Seven ordinary prices and one vega expression recalculated through documented ODF identities in LibreOfficeDev 26.8.0.0.alpha0, headlessly. Exact identities, values and controls match independent model checks. Numerical helper unavailable; 26.8.1.1 source only, with no stable or GUI test. How formula examples are checked

Quick answer: =OPT_BARRIER(30;0.2;0.06;0;1;40;25;0;0;"c";"o";"c") returned 0.424281900453 in the checked development build. It matches the independent option-model calculation and the rounded official Help example.

Availability and version history

  • Introduced: LibreOffice 4.0, explicitly stated in function-specific Help.
  • Supported in: 26.8 Help and 26.8.1.1 registration; no retirement is established.
  • Scope: Desktop Calc’s Pricing add-in. English names are source-mapped to documented ODF service names.
  • Checked: October 14, 2026. Seven ordinary prices and one vega expression recalculated through documented ODF identities in LibreOfficeDev 26.8.0.0.alpha0, headlessly. Stable releases, GUI entry and 26.8.1.1 execution remain untested.

What OPT_BARRIER returns

OPT_BARRIER returns a barrier-option model value, or a selected price sensitivity when Greek is supplied. A knock-out option loses its ordinary payoff when the relevant barrier condition is triggered; a knock-in option acquires its ordinary payoff when that condition is triggered. The barrier-monitoring choice determines which event is being priced.

The checked formulas use one initially unhit barrier, positive time to maturity and zero rebate. They distinguish continuous monitoring from monitoring only at maturity. Those two conventions can give different prices even with identical numeric inputs; the final monitoring string is part of the contract, not a formatting choice. Function-specific Help.

Syntax and arguments

OPT_BARRIER(Spot; Volatility; Rate; ForeignRate; Maturity; Strike; LowerBarrier; UpperBarrier; Rebate; PutCall; InOut; BarrierMonitoring [; Greek])

The first twelve arguments are required. Spot is a positive underlying price, Volatility is a positive annual decimal volatility, Rate and ForeignRate are continuously compounded annual decimal rates, Maturity is a time in years, and Strike is the exercise price. The examples use positive strikes and horizons.

LowerBarrier and UpperBarrier are price levels; zero disables the corresponding barrier. Rebate is the documented maturity-payment parameter. Every example explicitly sets it to zero; nonzero-rebate behavior is not established here.

PutCall is "c" for call or "p" for put. InOut is "i" for knock-in or "o" for knock-out. BarrierMonitoring is "c" for continuous monitoring or "e" for maturity-only monitoring. The complete parser recognizes lowercase prefixes, but the documented single-letter codes make the intended choice clearest.

Greek is optional. Omission or "value", "v", "price" or "p" requests a price. The documented sensitivity codes are delta/d, gamma/g, theta/t, vega/e, volga/o, vanna/a, rho/r and rhof/f. Only the vega sensitivity example below was executed for this guide; the other sensitivity outputs were not tested. Complete wrapper.

Eight ordinary price and sensitivity examples

Each expression below was evaluated using its documented qualified ODF service identity. The table shows the corresponding English function spelling. The independent values were computed to 90 decimal digits and cross-checked by discounted-payoff integration or a five-point derivative of that independent integral; both columns are displayed to twelve decimal places. All inputs are illustrative model parameters.

Formula Output Independent model reference LibreOfficeDev result
=OPT_BARRIER(30;0.2;0.06;0;1;40;25;0;0;"c";"o";"c") Price 0.424281900453 0.424281900453
=OPT_BARRIER(50;0.4;0.05;0;0.5;65;0;80;0;"p";"o";"c";"e") Vega 10.15845983991 10.15845983991
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;80;0;0;"c";"o";"c") Price 9.133306436498 9.133306436498
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;80;0;0;"c";"i";"c") Price 0.093699071656 0.093699071656
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;80;0;0;"c";"o";"e") Price 9.227005508154 9.227005508154
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;0;120;0;"c";"o";"e") Price 2.815865938221 2.815865938221
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;0;120;0;"c";"i";"e") Price 6.411139569933 6.411139569933
=OPT_BARRIER(100;0.2;0.05;0.02;1;100;0;120;0;"p";"o";"c") Price 6.099467318837 6.099467318837

Practical worksheet

For the continuous lower-barrier call, enter Spot 100, Volatility 0.2, Rate 0.05, ForeignRate 0.02, Maturity 1, Strike 100, LowerBarrier 80, UpperBarrier 0 and Rebate 0. With "c";"o";"c" as the three contract strings, the checked value is 9.133306436498. Changing only InOut to "i" gives 0.093699071656.

Their sum is 9.227005508154, the independent ordinary European call value for these inputs and zero rebate. This in/out decomposition is a useful model check. It is not a promise that the same unmodified identity applies with a nonzero rebate.

If only the maturity price is monitored at the lower barrier 80, the call’s positive payoff requires a final price above strike 100, which is already above that barrier. The checked knock-out value is therefore the ordinary call value 9.227005508154. Continuous monitoring can remove paths that previously fell to 80 and then recovered, explaining the smaller continuous knock-out price.

Advanced interpretation and independent checks

The independent reference calculation discounts a terminal payoff under a lognormal diffusion with log drift Rate − ForeignRate − Volatility²/2. For maturity-only monitoring, integrate the call or put payoff over the allowed final-price interval. For a single continuously monitored barrier, the calculation uses an absorbing-boundary density, subtracting the reflected paths that hit the barrier.

The upper-barrier maturity-only call rows split the ordinary call into two disjoint final-price events. The knock-out value is 2.815865938221, the knock-in value is 6.411139569933, and their unrounded sum is again 9.227005508154. This check combines payoff arithmetic and the monitoring convention; it is stronger than comparing a rounded result with a rounded vendor example alone.

The second table row ends with Greek "e", so 10.158459839910 is vega, not an option price. It is the model price derivative with respect to the decimal volatility input. Multiplying by a small volatility change gives a first-order estimate of the price change; it is not the exact change for a large move. The independent vega reference was also checked by a symmetric five-point difference of separately integrated prices.

Keep the output label alongside the formula. A column that mixes price and sensitivity results without naming the requested Greek is easy to misread, even when every formula evaluates successfully.

Boundaries and model assumptions

The complete wrapper rejects nonpositive Spot or Volatility, negative Maturity or Strike, invalid contract strings and an unrecognized Greek. It delegates the numerical calculation to bs::barrier and rejects a nonfinite returned value. The source exception does not by itself establish a particular worksheet error display.

The numerical helper was unavailable. Two active barriers, nonzero rebates, zero maturity, already-hit barriers, zero strikes, extreme parameters and the unlisted Greeks were not executed. Do not extend the ordinary examples into a claim that every contract configuration has been validated.

These are values within the stated pricing model, not live market quotations. Keep price units, continuously compounded rates, time units, rebate and monitoring convention explicit before comparing a result with another implementation or quoted instrument. Inspected wrapper.

Official evidence and checking scope

The saved application is LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5, on Linux. A stale cached control changed to 3 and an uncached control returned 7. Exact ODF identities, numeric result types and all sixteen price/sensitivity expressions were checked across the two related guides. Each guide’s claim covers its own eight examples. The 26.8.1.1 wrapper and input parsers were source-checked, but the underlying Black-Scholes numerical helper was unavailable. No direct English GUI entry, stable-release execution, market calibration or unlisted boundary case is claimed.