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 stopped returning data #27

Closed ClimberMel closed 1 year ago

ClimberMel commented 1 year ago

Many of the users in https://groups.google.com/g/smf-addin reported yesterday that there were issues with the smfGetYahooPortfolioView module.

One user noted that if the v7 in the URL = "https://query1.finance.yahoo.com/v7/finance/quote" was changed to v6 it works.

The v7 is used in 14 occurrences throughout the code base and in the following modules (occurrences):

Once I check these modules to see if the change in URL should be done for all, I will create a new add-in version and upload it to the website

ClimberMel commented 1 year ago

My ramblings while working on this... test smfGetYahooPortfolioView

call to smfGetYahooPortfolioView

Interesting, there are 2 calls to RCHGetWebData

Before call sData = "", sURL = "", iPOS1 = "", iPtr = 0

sItems = "0115871718192021005152030413222380333482" sTickers = "AAPL,MMM,AMZN,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX" sFieldList = "regularMarketPrice,regularMarketTime,regularMarketChange,regularMarketOpen,regularMarketDayHigh,regularMarketDayLow,regularMarketVolume,regularMarketPreviousClose,regularMarketChangePercent,shortName,bid,ask,exDividendDate,dividendsPerShare,dividendYiel" sURL = "https://query1.finance.yahoo.com/v7/finance/quote?fields=" & sFieldList & "&formatted=false&symbols=" & Replace(sTickers, ",XXXXX", "")

sURL = "https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice,regularMarketTime,regularMarketChange,regularMarketOpen,regularMarketDayHigh,regularMarketDayLow,regularMarketVolume,regularMarketPreviousClose,regularMarketChangePercent,shortN" iPtr = 1 sData = RCHGetWebData(sURL, iPtr, 6000) In function RCHGetWebData s1 = smfGetWebPage(pURL, pUseIE, 0)

pURL = "https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice,regularMarketTime,regularMarketChange,regularMarketOpen,regularMarketDayHigh,regularMarketDayLow,regularMarketVolume,regularMarketPreviousClose,regularMarketChangePercent,shortN"

Calls RCHGetURLData Case Else: RCHGetURLData = RCHGetURLData1(pURL, "GET") ' XMLHTTP Get

Calls RCHGetURLData1

The sURL is "https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice,regularMarketOpen,regularMarketDayHigh,regularMarketDayLow&formatted=false&symbols=AAPL,MSFT" The json still says error
code "Unauthorized" description "Invalid Crumb"

If I change the v7 to v6 it returns data...

So I check Yahoo Portfolio and the Export button uses the following: https://query1.finance.yahoo.com/v6/finance/portfolio/download?userId=SP3UDYTOUCQC3RFQZI7YFAV5OQ&pfId=p_1

ClimberMel commented 1 year ago

Create new XLA version number 3.0.2023.05.09 to contain fix. Files changes: smfGetYahooPortfolio.bas change v7 to v6 in sURL modGetElementNumber.bas update change log and version number smfUtilities.bas added notes regarding oHTTP.ReadyState in RCHGetURLData1

ClimberMel commented 1 year ago

Progress update: I have created most of the Items from smfGetYahooPortfolioView as elements 1 - 91 in smf-elements-1.txt. I have added a fix to smfGetYahooJSONData to handle unquoted numbers that are not in raw or fmt subs. To call the new format, use num.

ClimberMel commented 1 year ago

This was fixed in RCH_Stock_Market_Functions-3.0.2023.06.30