Howdy, Stranger!

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

Retrieving quotes for Telus instead of AT&T

I am sure you have answered this before, but I couldn't find it by Searching. I have AT&T (NYSE) in my portfolio and have recently added Telus (TSX). In the Symbols list section of the script for I have them listed as:

T,2011-01-21,,N,N,,,
T.TO,2021-01-28,,N,N,,,

To keep them separate in the PS spreadsheet I use "US." as a preface to the symbol for US securities and "CA." for Canadian securities. So in the Symbol Rename section of the script I have:

T,US.T
T.TO,CA.T

For results, I get both _T_.txt and _T.TO_.txt files in the Quotes folder. I also get values for both US.T and CA.T in the quotes.csv file.

Unfortunately the values for both symbols are the same - the stock price for Telus???

Comments

  • First try to change order for symbol renaming:

    T.TO,CA.T
    T,US.T

    If that does not help, then can you please open script file spMakeAllDataFiles.ps1
    and check very end of the file, and make sure that rename lines are like this:
    
    # #######################################################################################
    # ######################## Symbol rename for Quotes.csv and Dividends.csv files
    # #######################################################################################
    $qFileName = $psDataFolder + "\Quotes.csv"; $dFileName = $psDataFolder + "\Dividends.csv"; $renameCount = 0;
    if ((Test-Path $qFileName) -and (Test-Path $dFileName)) {
        $listStart = $config.IndexOf(""); $listEnd = $config.IndexOf("");  
        if (!($listStart -eq -1 -or $listEnd -eq -1 -or $listStart+1 -ge $listEnd)) {
            $qFile = @(Get-Content -Path $qFileName); $dFile = @(Get-Content -Path $dFileName);
            $list = @($config | Select-Object -Index(($listStart+1)..($listEnd-1)));
            ForEach($line in $list) { 
                $a = $line.Split(",");
                if($a[0] -ne "" -and $a[0] -ne $null -and $a[1] -ne "" -and $a[1] -ne $null) {
                    $oldSymb = $colSep + $a[0].Replace("^","\^")+"$"; $newSymb = $colSep + $a[1]; $renameCount++; # adding $ to end to specify that change can be done just at the end of the line.
                    $qFile = $qFile -replace $oldSymb, $newSymb;
                    $dFile = $dFile -replace $oldSymb, $newSymb;
                } #if
            } #ForEach
            $qFile | Out-file $qFileName -Encoding OEM -Force;  
            $dFile | Out-file $dFileName -Encoding OEM -Force;  
        }
    }
    If lines look different, then you need to download latest script.
    Let me know if that does not help.
  • Not sure why, but I re-ran the scripts today - BEFORE making the changes you suggested - and it picked up the correct quotes. The only difference I can see is that when I ran it yesterday it was before the markets opened. Don't know if that is relevant or not. Will keep an eye on it for the next little while.
Sign In or Register to comment.