wilsonleong / PortfolioAnalytics

Portfolio Analytics
11 stars 1 forks source link

Bug: when period=3M start date falls on a Sunday, IRR % is wrong #49

Open wilsonleong opened 2 years ago

wilsonleong commented 2 years ago

Considerations:

wilsonleong commented 1 year ago

Incorrect starting cashflow value in IRR calculation on market holidays

For IRR calculation, when date range start date has no market data (weekend or market holiday), the "previous valuation" as of start date becomes 0 incorrectly, causing error in the IRR calculation.

Tactical fix by adjusting start date as Friday when it falls onto a Saturday or Sunday.

This still does not adjust for market holidays in HK or US. Proper fix should check for market holidays and try to get valuations for the previous business day.