Price Equity Options and Forwards
Updated
Problem statement
Price a European equity option and an equity forward using the Black–Scholes–Merton model with continuous dividends. The equity has spot price spot, dividend yield dividendYield and volatility volatility. Both contracts use strike and the same maturity.
Rates and volatility are decimal annual values. Set T = days / 365.0. The flag isCall selects a call when true and a put when false.
Return [optionPrice, delta, gamma, forwardValue]. Use the following rules:
- Let
d1 = (ln(spot / strike) + (rate - dividendYield + volatility^2 / 2) * T) / (volatility * sqrt(T))andd2 = d1 - volatility * sqrt(T). - With standard normal cumulative distribution
N, the call price isC(S) = S * exp(-dividendYield * T) * N(d1) - strike * exp(-rate * T) * N(d2). The put price isP(S) = C(S) - S * exp(-dividendYield * T) + strike * exp(-rate * T). - For the selected option price function
V, useh = 0.001 * spot,delta = (V(spot + h) - V(spot - h)) / (2 * h)andgamma = (V(spot + h) - 2 * V(spot) + V(spot - h)) / h^2. Keep every other input fixed. - The forward value is the discounted value of a long contract:
spot * exp(-dividendYield * T) - strike * exp(-rate * T). It is not the fair delivery price.
The pricing fields correspond to Equity, EquityOption and EquityForward records; the callable exposes their fields directly. Helper records and pricing functions may be used inside the solution. Each returned value is compared with relative-or-absolute tolerance 10^-5.
Function
priceEquityDerivatives(spot: double, dividendYield: double, volatility: double, strike: double, days: int, rate: double, isCall: boolean) → double[]Examples
Example 1
spot = 100dividendYield = 0.02volatility = 0.2strike = 100days = 365rate = 0.05isCall = truereturn = [9.227005508154036,0.5868504354913995,0.018950550824570197,2.896924880604143]The maturity is one year. The call price is about 9.22701 and the long forward value is about 2.89692. Delta and gamma use the stated central differences with h = 0.1.
Example 2
spot = 100dividendYield = 0.02volatility = 0.2strike = 100days = 365rate = 0.05isCall = falsereturn = [6.3300806275499255,-0.39334823781530304,0.018950550821728026,2.896924880604143]Only the option direction changes. Put–call parity gives a put price of about 6.33008; the forward value is unchanged.
Example 3
spot = 80dividendYield = 0.03volatility = 0.35strike = 110days = 730rate = 0.04isCall = falsereturn = [33.35008645412415,-0.6016793325425596,0.008907158173254714,-26.201635415790047]The maturity is two years. All three option evaluations keep the strike, rates and maturity fixed while bumping only the spot.
Constraints
- Both spot and strike are between 1 and 10000, inclusive.
- The dividend yield and interest rate are between 0.0001 and 1, inclusive.
- Volatility is between 0.01 and 2, inclusive.
- Days is an integer from 1 through 3650.
- isCall is true for a call and false for a put.
More LSEG Online Assessment questions
- Count Times Using at Most Two DigitsOA · Seen Jul 2025
- Maximum Sum of Exactly Three Non-Adjacent ElementsOA · Seen Jul 2025
- Maximum Word Count in a SentenceOA · Seen Jul 2025
- Minimum Digit Swaps for the Smallest DifferenceOA · Seen Jul 2025
- Smallest String After at Most One DeletionOA · Seen Jul 2025
- Delete One Digit 5 to Maximize the NumberOA · Seen Feb 2025
- Three-Part Partition with Minimum Largest RangeOA · Seen Feb 2025
- Transform a String with at Most One OperationOA · Seen Feb 2025
- Maximum Sum of Non-Adjacent ElementsOA · Seen Sep 2024
- Return the Sentence with the Most WordsOA · Seen Sep 2024
Similar questions at other companies
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Bold Play to Reach a GoalSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Repeated Mirror XORMathWorks · OAMathWorks interview questions
- Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
- Find Total CostJP Morgan Chase · OAJP Morgan Chase interview questions
- Macaron Order PriceOpenAI · OAOpenAI interview questions
- Daily Settlement for Long and Short PositionsBelvedere Trading · OA
- Last Object Exit TimeIBM · OAIBM interview questions
- Debug the Risk-Limit QuoterMillennium · OAMillennium interview questions
- Prime Factor VisitationMaven Securities · OAMaven Securities interview questions