Closed brandonros closed 1 year ago
My library is agnostic to time. If vol and discount rate is calculated using 365 day convention then the time should use a 365 day convention.
My library, by itself, is intentionally un-opinionated on how to actually calculate the parameters used in the Black Scholes model. A substantial amount of scaffolding is needed to wrap my library into something useable "in production".
As an example, see https://github.com/lballabio/QuantLib. Quantlib provides the "base calculator" here: https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackcalculator.cpp. But they provide many options for the day conventions: https://github.com/lballabio/QuantLib/tree/f47242c966d191e1b542162b1f2d726615bdba89/ql/time/daycounters.
One of Quantlib's examples uses the 365 day convention (https://github.com/lballabio/QuantLib/blob/master/Examples/EquityOption/EquityOption.cpp), though they could have chosen a 252 day convention as well.
Thanks.
// Black-Scholes for European
// semi-analytic Heston for European
// semi-analytic Bates for European
// Barone-Adesi and Whaley approximation for American
// Bjerksund and Stensland approximation for American
// QD+ fixed-point engine for American
// Integral
// Finite differences
// Binomial method: Jarrow-Rudd
// Binomial method: Additive equiprobabilities
// Binomial method: Binomial Trigeorgis
// Binomial method: Binomial Tian
// Binomial method: Binomial Leisen-Reimer
// Binomial method: Binomial Joshi
// Monte Carlo Method: MC (crude)
// Monte Carlo Method: QMC (Sobol)
// Monte Carlo Method: MC (Longstaff Schwartz)
Do we know what brokerages are using method calculation wise, or can we reverse engineer the two unknown variables (time to expire, risk free rate) from implied vol + the Greeks they provide?
A substantial amount of scaffolding is needed to wrap my library into something useable "in production".
Could you expand on this a bit? I looked at the EquityOption example (thanks for that) but I'm not quite sure what's missing from your repo other than maybe dividend yield?
Most online calculators will be using straight Black Scholes, unless they say otherwise.
My library is very similar to the blackcalculator.cpp from Quantlib. By scaffolding I mean all the other things Quantlib has that I (intentionally) don't have: things like zero-rate curve construction, the date conventions, etc. Most online calculators do not document how they treat dates, weekends, holidays, etc.
Not to mention how option or stock prices are calculated...eg last trade price, or mid point of bid and ask (which I assume is what most calculators use).
zero-rate curve construction
can this be overly simplified by just using the 10y as the risk free rate?
I’m with you on last trade vs mark price but does that really make a difference during regular trading hours for something as liquid as SPY/SPX?
I’ll do a writeup on how far off some calculations are if that’s cool with you “expected vs actual” where actual is the # most people see online.
If none of this interests you by all means I’ll stop wasting your time. You’ve been very helpful and kind so far.
There are many ways to define the input parameters. There are conventions for how to define them: eg midpoint of bid ask, or 252 days in a year. Consistency of convention is what is important. Again, that's outside the scope of this repo.
What do you mean my "most people"? All the calculators online should be using the same mathematical logic; the difference is in the "conventions".
https://github.com/ronniec95/black_scholes/blob/92b4f0a7543e5802c2645c7e2c19f1154815e892/src/bs_f32x8_.rs#L762
I'm not smart enough to understand if the math for
maturity
between this library andronniec95/black_scholes
are the same but, to clarify, this repo expects maturity asdays_to_expiration / 365 days a year
and notdays_to_expiration / 252 trading days a year
, right?What about for example:
Is the expiration date
expiration
orlastTradeDate
? Or does none of this really matter because they are American style options instead of European?Option style / maturity?
Option style / dividend?
Not sure if dividend matters only on a certain style of option (American vs European) / if it affects the greeks since it has to be priced in even if the option isn't close to the ex-dividend date expiration wise?
Just thinking outloud/being nitpicky in the quest of making the greeks more "accurate" to the real world (aka how TD Ameritrade/other platforms price options for trading basically)