+ Reply to Thread
Results 1 to 7 of 7

AlphaVantage Quote Retrieval

  1. #1
    Registered User
    Join Date
    11-06-2017
    Location
    Florida
    MS-Off Ver
    2007
    Posts
    15

    AlphaVantage Quote Retrieval

    So I'm trying to pull closing stock quotes from Alpha Vantage which seems pretty simple. They provide nice API examples. The problem is that my VBA code fails with:

    VBAErrorMsg.png

    Cut down to a minimum toy example the code below is what I'm trying to do. You'll note that for debug purposes, at one point I save my "qurl" query out to the query sheet. And if I copy/paste that URL into a web browser it works fine so I'm assuming there is no problem in the URL itself, but with the VBA call for the data. Yet the code always crashes pointing to the "Refresh" line. (Changing it to "true" doesn't help - that keeps it from crashing but it spins its wheels indefinitely then.)

    Any suggestions to make this run? Thanks.

    Bill

    Please Login or Register  to view this content.
    Last edited by Thales42; 11-07-2017 at 12:20 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: AlphaVantage Quote Retrieval

    Here is an alternative way to get stock prices

    https://office-watch.com/2016/excel-...oogle-finance/
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: AlphaVantage Quote Retrieval

    I'm also looking for a way to use Alpha Vantage as described in the original post. I got the same error message, which I think indicates that it cannot be done. There are a few reasons I don't want to use Google.

    I'll post here if I find a solution, but I may end up downloading the csv file, opening the new file, connecting to a database with VBA, transfering the data, and deleting the recently-downloaded file.

    Yahoo cut us off from their API and I'm concerned Google will do the same. I think Alpha Vantage will be more reliable over a longer period of time.
    <---If my answer helped, please click *

  4. #4
    Registered User
    Join Date
    11-06-2017
    Location
    Florida
    MS-Off Ver
    2007
    Posts
    15

    Re: AlphaVantage Quote Retrieval

    The AlphaQuote batch API works quite well now. Here's the crucial code snippet, where "Tickers" is a comma delimited text string:

    Please Login or Register  to view this content.
    The problem with AlphaVantage that I've found though, is that it gives back the wrong value for Visa (V). I request maybe 15 symbols with "V" in the middle and all the others are correct, but not "V". I've contacted them about this but all I get back is crickets chirping.

    And the problem with using the Google API is that while it does work, if you search their web sites enough you'll find that API has been depricated and supposed to be deleted already. I presume they're "encouraging" everyone to use Google Sheets instead of Excel.

  5. #5
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: AlphaVantage Quote Retrieval

    I've seen that code before --- I think it's applicable to json outputs, correct? I tried the following and got no results.
    Please Login or Register  to view this content.
    ...where BuildURLfromAPIParameters is a function that returned a URL (I tested to verify it returns the proper URL).

    I also tried .Open "GET", BuildURLfromAPIParameters("BA", DailyAdjusted), False (changing the last boolean argument).

    How can I dump several historical values into excel?

  6. #6
    Registered User
    Join Date
    11-06-2017
    Location
    Florida
    MS-Off Ver
    2007
    Posts
    15

    Re: AlphaVantage Quote Retrieval

    I haven't made any efforts with their historical quotes yet. All I really know is that the code I use works for daily batch quotes. The one thing I see lacking in your code is the line:
    Resp = xmlHTTP.responseText
    This retrieves a long comma delimited text string into "Resp" which contains all the requested data. And then I just parse out that data as necessary.

  7. #7
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: AlphaVantage Quote Retrieval

    Thanks. I am following WiseOwl tutorials on Youtube and I'll post any meaningful results.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code to save form as a specific name based on value in cell
    By bduncan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2017, 02:33 PM
  2. Replies: 1
    Last Post: 07-14-2016, 02:23 PM
  3. [SOLVED] How to find and replace hidden single quote ? (This sign is single quote: ')
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2014, 03:48 PM
  4. Conditional Retrieval
    By okl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-07-2010, 09:05 AM
  5. ESSBASE Retrieval using VBA
    By okelly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2007, 10:33 AM
  6. MAC Retrieval
    By sparx in forum Excel General
    Replies: 0
    Last Post: 03-19-2006, 04:51 PM
  7. Data Retrieval
    By bach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2005, 10:43 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1