Howdy, Stranger!

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

Exchange BOC error

I get the following error now when running the scripts.


  • The new updated script is available for download:
    For existing users simply extract files from that compressed file into separate location and then copy the file GetExchRates-YahooIntraday to your script location

    Thank you to Maxim for the very fast update!
  • Thank you and thanks to Maxim. I still get the same error after the GetExchRates-Boc script is run.
  • Gbiasini,

    I just checked and new script did fix the problems I have. Can you please make sure that script GetExchRates-YahooIntraday has Jan 18, 2023 date?
    In your reported screenshot, "ExchRate Boc" succeeded and error was in GetExchRates-YahooIntraday script - script name with error is in your provided red error text:

  • Hi Vidas,

    Just like the version of GetExchRates-YahooIntraday in Scripts version 2.4.17, it has a date of January 26, 2022.

  • Hi,

    I checked again and I do not see any issues with 2.4.17 scripts - it has Get-ExchRates-YahooIntraday script with Jan 18, 2023 date. Please try again - download to separate folder and check files inside the zip file - there should be updated file inside.
  • I use the GetExchRates-BoC.ps1 script for exchange rates. My "CAD_USD.txt" and "USD_CAD.txt" data files seem to put new exchannge rates on 2 lines. Here is a screen cap of the portion of the "psCheckFiles.txt" log file showing the error.

    I have had this issue with both v 2.4.16 and 2.4.17 of the scripts. A manual workaround has been to delete the carriage return using NotePad and rerun just the "CreateFilesUpdatePSData.bat" batch file.
  • gsbaker,

    Please review your exchange rate files in the folder CurrExch.
    each exchange rate should be a line per day, as here:

    If you have some values split in two rows, then delete these rows.

    When was the last time you successfully run this GetExchRates-BOC.ps1 script?
    I would try to switch using ECB script, that is lines in .bat file should be:
    - Add REM in as the first symbols in the line that calls GetExchRates-BoC.ps1 script. This will comment out this line and will not execute.
    - instead use ECB script:

    REM powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-BoC.ps1
    powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-ECB.ps1

  • My recollection is that the last time I successfully ran the Exchange Rate scripts was prior to applying the fix to the error message noted above by GBiasini. I just tried running ONLY the BoC script just now (by "REM" ing out all of the other lines in the UpdatePSData.bat file (using a renamed copy and after backing up all of the previous exchange rate text files of course). So the only script file that ran was the GetExchRates-BoC.ps1. Here is an image of the BAT file I ran.

    Here is what the new lines look like in the CAD_USD.txt file (this is the same in the USD_CAD.txt file as well):

    My work-around has been to delete the CR character so that each day is only on one line and then running just the CreateFilesUpdatePSData.bat file to recreate the .CSV data files. This work around seems to work Ok and generate the correct CSV files.

    Incidentally I have been using the BoC exchange rates because that is the same data source as the financial software I use ("Moneydance") so it makes reconciling investment holdings easier. I have noticed some differences between the BoC rates and the ECG rates in the past.

Sign In or Register to comment.