Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Yahoo Historical Not Working (or I broke something)

Hello,

This morning I downloaded the new Yahoo intraday exchange rate and quotes ps1 files and replaced the existing ones. I ran the update but now the Yahoo historical is failing.



And from the log: (all holdings have the same message)

Symbol: CGR.TO. Next date: 2024-04-17. Quote file: C:\Users\danmo\OneDrive\Documents\Investment Information\PortfolioSlicer\Quotes\_CGR.TO_.txt
Requesting url: https://query1.finance.yahoo.com/v7/finance/download/CGR.TO?period1=1713312000&period2=1713345101&interval=1d&events=history&crumb=
CGR.TO - Not Found (web err)

Comments

  • The error is in psMakeAllDataFiles.ps1 file line 85 and it is related to adding exchange intraday rates. Can you please go to CurrExchIntreaDay folder and remove all files from there and re-run script.
    Can you please open Quotes\_CGR.TO_.txt file and see for what date there is already quote in there (last line).
  • I deleted YahooCurrExchIntraday.txt (which contained nothing) from the folder as directed. I reran the script and got same error.

    The last quote for CGR_TO was 2024-04-016 (yesterday)
  • As you already have 2024-04-16 data for CGR.TO in the file, Yahoo historical load will not find any quotes, so your message "Not Found (Web err)" is normal. Eventually, during one run it will find new quote and will put it with date 2024-04-17 into the file and then again will return "not found" until some time tomorrow night.

    But you still need to address the issue with psMakeAllDataFiles.ps1 script line 85.
    Can you please post here how many files you have in CurrExchIntraDay folder and the content of each file.
  • When I looked the first time, and when I look now, there is only 1 file in CurrExchIntraDay folder, it is today's date, it is 0kb, and there is no text in the file.
  • Hi @dmorley64 ,

    Thank you for reporting this.

    There was a bug in GetExchRates-YahooIntraday.ps1 - when the intra-day currency exchange file is empty, you will get error in psMakeAllDataFiles.ps1 file line 85. This update to the same GetExchRates-YahooIntraday.ps1 and GetQuotes-YahooIntraday.ps1 scripts will delete files with size 0.

    Updated scripts can be downloaded here or from updated download page.
  • Awesome, thanks, tested the new scripts and all is working again!
  • any updated script for us poor souls still using 2.x ???
  • Same updated 2 scripts will work with version 2.x
  • Work like a charm, thanks Vidas!
  • Receiving this error this morning, no change on my end:

    D:\Investing\v24\Data>echo off
    09:07:38 Script: Yahoo Historical . Quotes Requested/Succeed/Failed/Rows: 7/7/0/0. Duration: 30 sec.
    Get-Item : Cannot find path 'D:\Investing\v24\Data\QuotesIntraDay\YahooIntraday.txt' because it does not exist.
    At D:\Investing\v24\Data\Scripts\GetQuotes-YahooIntraday.ps1:52 char:7
    + $fc = Get-Item -Path $quoteIDFile; if ($fc.Length -eq 0) {Remove-Item ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (D:\Investing\v2...hooIntraday.txt:String) [Get-Item], ItemNotFoundE
    xception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

    Remove-Item : Cannot find path 'D:\Investing\v24\Data\QuotesIntraDay\YahooIntraday.txt' because it does not exist.
    At D:\Investing\v24\Data\Scripts\GetQuotes-YahooIntraday.ps1:52 char:59
    + ... IDFile; if ($fc.Length -eq 0) {Remove-Item -Path $quoteIDFile;} # Rem ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (D:\Investing\v2...hooIntraday.txt:String) [Remove-Item], ItemNotFou
    ndException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
  • magically fixed itself!
  • There is a bug in that code, but not critical bug - you can ignore it for now. I already fixed that on master code. When intraday file is not available, you will get that message ItemNotFoundException. Just ignore it for now.
Sign In or Register to comment.