domokane / FinancePy

A Python Finance Library that focuses on the pricing and risk-management of Financial Derivatives, including fixed-income, equity, FX and credit derivatives.
GNU General Public License v3.0
2.16k stars 322 forks source link

Changed 'Date' type to float type in parameters of barrier option pricing functions. #184

Closed gpelleri closed 1 year ago

gpelleri commented 1 year ago

Hello Sir I added a to_float method in the Date class, to allow acess to the already existing (private) parameter _excel_date , which is a float. I'm using this method whenever we're calling the barrier options pricing functions to pass floats instead of Date. Let me know if this is fine,

Gautier

domokane commented 1 year ago

The date should be passed as a time in years. See other functions.

gpelleri commented 1 year ago

I'm not sure to get what you want, do you have any example since i'm unsure about what to look for ? Like is it a matter of changing type (using datetime ?) or do you rather want to pass a single argument called "maturity" , which be will the time to expiry in years and get rid of valuation_date & expiry_date ?

domokane commented 1 year ago

The date should be passed as a time in years. So you pass in (date - valuationDate) / DaysInYears. The argument should not depend on knowledge of the internal implementation of the date class.

See other functions.