Data sources for Currency Exchange data

Note - this page describes the behavior of the PowerShell scripts that were created by Maxim specifically for Portfolio Slicer. We adding documentation about Maxim's script behavior after realizing that they are used by the majority of Portfolio Slicer users.

General information

If in your portfolio all symbols have the same currency, then you do not need any currency exchange information and you can safely ignore this page. But if your portfolio has symbols with more than one currency or even if you want to compare your portfolio performance to index that is tracked in difference currency, then you need to have currency exchange data.

Configuring what source to use for currency exchange data

In the psConfig.txt file there is just one section “Currency” where you can list currency codes you want to get exchange rates for.

The same section is used by all currency exchange data scripts.

To choose what data source you want to use for your currency exchange data, you will need to edit UpdatePSData.bat file. If you will look at your .bat file, you will see the lines for Currency exchange extract look something like this:

REM powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-BoC.ps1
REM powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-ECB.ps1
powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-Stooq.ps1
powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-YahooIntraday.ps1
When .bat file has “REM ” at the start, these lines are treated as comments.

If you want to change your currency exchange data source to EBC, you would comment out other scripts and would enable script for ECB:

REM powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-BoC.ps1
powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-ECB.ps1
REM powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-Stooq.ps1
powershell -ExecutionPolicy Bypass .\Scripts\GetExchRates-YahooIntraday.ps1
In above code we removed “REM ” for script GetExchRates-ECB.ps1 and added “REM ” to the start of the script GetExchRates-Stooq.ps1.

Note - you should always leave script GetExchRates-YahooIntraday.ps1 as this script gets just intraday quotes if they are available.

Currency Exchange data source - Stooq

Stooq is one of the best sources for currency exchange data. Visit website and in the search box enter “currency from code” and “currency to code”, for example “CADUSD” and then press on the “Kwotuj” button.

If you will see webpage with currency exchange information, that means stooq is good data source for currency exchange data.

You can also use web address to request exchange rates between currency pairs for specific period:

Currency Exchange data source - European Central Bank (ECB)

European Central Bank (EBC) provides currency Exchange data that can be downloaded from this link: At the point of writing this page ECB supports following currencies: USD, JPY, BGN, CYP, CZK, DKK, EEK, GBP, HUF, LTL, LVL, MTL, PLN, ROL, RON, SEK, SIT, SKK, CHF, ISK, NOK, HRK, RUB, TRL, TRY, AUD, BRL, CAD, CNY, HKD, IDR, INR, KRW, MXN, MYR, NZD, PHP, SGD, THB, ZAR, ILS.

Currency Exchange data source Intraday - Yahoo Finance

Yahoo Finance website does not provide historical currency exchange data, but it is a good source for intraday currency exchange rate data. To check if currency exchange is available between your used pairs of currency, please visit the website and in the search box enter codes for “currency from code”, “currency to code” and “=X”, for example: “CADUSD=X” or “USDEUR=X”. If you will see a web page with the exchange rate, that means you will be able to use Yahoo Finance as your source for intraday currency exchange rates.

Currency Exchange data source - Bank of Canada (BoC)

Bank of Canada (BoC)provides currency exchange rates for following currencies: AUD, BRL, CNY, EUR, HKD, INR, IDR, JPY, MYR, MXN, NZD, NOK, PEN, RUB, SAR, SGD, ZAR, KRW, SEK, CHF, TWD, THB, TRY, GBP, USD, VND. But in 2017 BoC changed their data structures and stopped providing currency exchange data for years before 2017, so BoC is not recommended data source for currency exchange unless you just need data from 2017.