Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smfGetYahooPortfolioView stopped returning data #27

Closed
ClimberMel opened this issue May 5, 2023 · 4 comments
Closed

smfGetYahooPortfolioView stopped returning data #27

ClimberMel opened this issue May 5, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ClimberMel
Copy link
Owner

ClimberMel commented May 5, 2023

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):

  • smfGetOptionExpirations (1)
  • smfGetOptionStrikes (3)
  • RCHGetYahooHistory2 (1)
  • smfGetYahooJSONField (1)
  • RCHGetYahooQuotes (2)
  • smfGetYahooHistory (1)
  • smfGetYahooHistoryCSV (2)
  • smfGetYahooPortfolioView (1)
  • RCHGetYahooQuotes-Function.htm (web documentation)
  • smf-elements-22.txt (elements file for module RCHGetElementNumber)

I think RCHGetYahooHistory2 is no longer in use. I should look at removing some of that deprecated code, but it will be a lot of work the way everything is so intertwined.

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 ClimberMel self-assigned this May 5, 2023
@ClimberMel ClimberMel added the bug Something isn't working label May 5, 2023
@ClimberMel
Copy link
Owner Author

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
Copy link
Owner Author

ClimberMel commented May 8, 2023

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 added a commit that referenced this issue May 8, 2023
ClimberMel added a commit that referenced this issue May 8, 2023
Correct version #
@ClimberMel
Copy link
Owner Author

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
Copy link
Owner Author

This was fixed in RCH_Stock_Market_Functions-3.0.2023.06.30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant