pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
2.03k stars 300 forks source link

Data frequency check extended + correction #63

Closed ViktorMalesevic closed 6 years ago

ViktorMalesevic commented 6 years ago

Hello Jordan,

I had done a small mistake with the data checking, which made the calculus of "three_month" and "six_month" not running when the data is of a lower frequency than monthly (e.g. quarterly like in the following example). While logically the condition that has to be met is only that the minimum frequency is three month and six month respectively in those cases. And I extended these conditions to three_year, five_year and ten_year.

Output of lookback_returns before correction:

issue_with_data_checking

(Don't pay attention to 1w, wtd, and qtd figures. They are added in my local version but I didn't push them to github)

Here is the proposed correction.

Best regards,

Viktor