Security Price Loader, a suggestion for improvement

sprimost's Avatar

sprimost

09 Jan, 2018 12:39 AM

I have been using this extension for over 2 months now and it is great. Yes, it was a pain to configure Yahoo finance with a list of my stocks for the first time. And, it is a bit of a drag to go there each evening to download the quotes (using the export "button"). But I found out that this can really be simplified. So can I suggest an improvement to the extension?

It seems that Yahoo can not control the restriction for the download totally. If you invoke the following URL, you will get the latest (as far as Yahoo is concerned) stock quotes:

https://query1.finance.yahoo.com/v6/finance/portfolio/download?userId=<your encrypted userID pr "handle"&pfId=pf_3

It works no matter if you refresh the screen to see the quotes or you invoke it from a browser!

So, would you add an option to enter this string and invoke a browser call (in LINUX it is curl), to a file, and then fill in the file in the initial load screen? It might be difficult for a less technical person to do without explicit instructions but it is the safest and most straight-forward way of doing this in one step. i will be most happy to demonstrate with a screen capture.

I did research whether MD can execute a command from inside it's "shell" (does not seem so) or that it can run an extension (yes, but it won't save the result). So an alternate would be an extension to run a command, run an extension, and cause it to save the result?

  1. 1 Posted by Mike Bray on 09 Jan, 2018 01:34 PM

    Mike Bray's Avatar

    Thanks for the suggestion. I have had a quick look. First thing, where do you get your encrypted userid from? I can see you can extract it from the 'export' option but we will need an easy way to get it.
    Secondly, the URL you gave seems to tail off at the end, I am not sure where the userid ends and the rest of the URL continues. Please clarify.

    I have now problem with adding the option to my extension though it would be for US users only as many GB stocks have no prices.
    If you could give the steps you took to get to this I will have a look.

  2. 2 Posted by sprimost on 11 Jan, 2018 11:56 PM

    sprimost's Avatar

    The encrypted userid is assigned by Yahoo as a function of the person's userID and password. I verified that it is the same over multiple login's and logout's. On the Firefox browser, I hover over the "export" link and copy link location. For my testing, and use, I open up a separate tab, paste the link in, and enter to return to the location (or refresh). It does save the quotes in a csv file (quotes(x).csv if quotes.csv exist).

    Note that since URL's are stateless (going from 1 page to another page requires that information be save, like a cookie, or within the URL parameters, like this!

    The URL that I used is the following:

    https://query1.finance.yahoo.com/v6/finance/portfolio
    /download?userId=xxxxxxxxxxxxxxxxxxxxxxxTBI&pfId=pf_3

    So, here are the steps:
    (1) As noted in previous postings, set up your list of stocks in a portfolio. You will need a userID and password.
    (2) For the first time, check the quotes for each of the stocks set up so that you know that you have the correct ticker.
    (3) You try the export and look at the csv file to make sure it is correct for your extension. (just because I am cautious about my "production data"
    (4) Try copying the link location to another browser tab and performing the same action as described above. It will prompt you for the save of quote.csv.
    (5) I remember the version number of the previous file and use the extension.

    I hope this explains how I did this "google-hack"....

  3. 3 Posted by Mike Bray on 12 Jan, 2018 08:42 AM

    Mike Bray's Avatar

    Thanks for the info. This is how I did it to test your request. I was hoping for a more elegant way of obtaining the encrypted user id. I will investigate further and let you know.

  4. 4 Posted by sprimost on 12 Jan, 2018 04:11 PM

    sprimost's Avatar

    There are a couple of other ways to get this field, actually known as a "handle". It is an internal to Yahoo field done as a security "feature". But without logging in somewhere within its number of services, you don't get it available. I haven't checked if there is a cookie that has it been set (usually if you allow the connection to stay open for 2 weeks) but even if that is the case, the data is encrypted. I quickly checked and did not find any, but I will do some research also.

  5. System closed this discussion on 13 Apr, 2018 04:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac