ClimberMel / SMF_Add-in

Stock Market Functions for Excel using VBA
https://climbermel.github.io/SMF_Add-in/
14 stars 5 forks source link

smfGetYahooPortfolioView possible incorrect data returned #9

Closed ClimberMel closed 1 year ago

ClimberMel commented 1 year ago

I've just tried version 02.09 but it seems to produce incorrect results. For example here is a formula I am using to calculate the avg. annual return for VTSAX for the past 10 years:

 =(@smfGetYahooPortfolioView("VTSAX","15",,0)/@smfGetYahooHistory("VTSAX","2013-02-07","2013-02-08", "w","C",0,0))^(1/10)-1

It evaluates to 10.2% but it should produce 12.3% instead (checking against Morningstar and another financial information website).

Any thoughts?

Marek

ClimberMel commented 1 year ago

image

ClimberMel commented 1 year ago

I thought it was pulling adj close in the other routines, so I will have to check why it isn't when called from this module.

ClimberMel commented 1 year ago

While investigating this module, I did note that smfGetPortfolioView makes multiple calls to Yahoo to get the data one ticker at a time. The sURL that is created gets a json file for the entire request. I need to check if it is actually retrieving the data again, or using cached data as some of the modules are able to do. If it is using cached data, that is fine if it just loops through the results:0 through xx

ClimberMel commented 1 year ago

This is appears related to the mix up over the C = adjusted close and U = unadjusted close issue with smfGetYahooHistory since Marek's formula also called smfGetYahooHistory. There is no issue currently with smfGetYahooHistory.