dedwards25 / Python_Option_Pricing

An libary to price financial options written in Python. Includes: Black Scholes, Black 76, Implied Volatility, American, European, Asian, Spread Options
MIT License
647 stars 124 forks source link

A typo (not an error) that may cause inconsistency. #5

Closed Ross-Li closed 2 years ago

Ross-Li commented 2 years ago

In the GBS Greeks testing section, there are 2 testings whose input options have time to maturity of 2

assert_close(_gbs('c', 100, 100, 2, 0.05, 0.05, 0.25)[4], 50.7636345571413)
assert_close(_gbs('p', 100, 100, 2, 0.05, 0.05, 0.25)[4], 50.7636345571413)

while other testing options have time to maturity of 1

assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[0], 5.68695251984796)
assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[1], 0.50404947485)
assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[2], 0.025227988795588)
assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[3], -2.55380111351125)
...
assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[0], 5.68695251984796)
assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[1], -0.447179949651)
assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[2], 0.025227988795588)
assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[3], -2.55380111351125)

This is not an error, but it may cause a bit of inconsistency. You might want to change it.

dedwards25 commented 2 years ago

This is intentional. In the testing section, I want to ensure that each input gets tested with multiple values. For example, I want to identify if the formulas work with different maturities including maturities not equal to 1.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Ross-Li @.> Sent: Monday, June 13, 2022 10:24:26 AM To: dedwards25/Python_Option_Pricing @.> Cc: Subscribed @.***> Subject: [dedwards25/Python_Option_Pricing] A typo (not an error) that may cause inconsistency. (Issue #5)

In the GBS Greeks testing section, there are 2 testings whose input options have time to maturity of 2

assert_close(_gbs('c', 100, 100, 2, 0.05, 0.05, 0.25)[4], 50.7636345571413) assert_close(_gbs('p', 100, 100, 2, 0.05, 0.05, 0.25)[4], 50.7636345571413)

while other testing options have time to maturity of 1

assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[0], 5.68695251984796) assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[1], 0.50404947485) assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[2], 0.025227988795588) assert_close(_gbs('c', 100, 100, 1, 0.05, 0, 0.15)[3], -2.55380111351125) ... assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[0], 5.68695251984796) assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[1], -0.447179949651) assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[2], 0.025227988795588) assert_close(_gbs('p', 100, 100, 1, 0.05, 0, 0.15)[3], -2.55380111351125)

This is not an error, but it may cause a bit of inconsistency. You might want to change it.

— Reply to this email directly, view it on GitHubhttps://github.com/dedwards25/Python_Option_Pricing/issues/5, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AE36L54G6YG4QBUUAIWEELDVO5ABVANCNFSM5YUNEWLQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Ross-Li commented 2 years ago

Got it, thanks for the reply! You may close this issue now.