Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear QV developers,
I am new to QV but I am still trying to get this to work. I have loaded current quote data using the URL string from Yahoo finance stock website.
http://download.finance.yahoo.com/d/quotes.csv?s=AAPL&f=sl1d1d2t1c1p2ohgvjkrdej&e=.csv
The I can load all the neccessary data for APPL into QV - example uploaded below.
But now to to the hard part, I want to load historical data for several stocks.
Unfortunately you can not use a simple URL string as above for more then 1 stock at a time. But only for 1 stock at a time.
Example:
http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=00&b=1&c=2012&d=08&e=2&f=2012&g=d&ignore=.csv
So now I am wondering how I can code it in order to load current data as well as historical data.
The current data is not to hard to load for 1 stock, the linking issue with the historical data can be based on SYMBOL = stock name, in our case: AAPL.
But how can I load the historical data for let us say 5 different stocks, not just 1. You would basically need 5 different URLs, and maybe use wildcards inside the URL in QV so you load historical data using a FOR statement and just chaning the SYMBOL in the URL for fetching the historical quote data from the server?
Appreciate your kind help!
You are right.
You can create inline table with parameters (StockNames for example with field StockName).
Then assign your URL to a variable (for example URLBase).
Parameterize it with 'Dollar-Sign Expansion with Parameters' (look at help).
Then use FOR:
for i=1 to NoOfRows('StockNames')
LET CurrentStock = FieldValue('StockName', i);
LOAD
CurrentStock as StockName,
...
FROM
[$(URLBase(CurrentStock))]
(html, ...)
Next i;
You are right.
You can create inline table with parameters (StockNames for example with field StockName).
Then assign your URL to a variable (for example URLBase).
Parameterize it with 'Dollar-Sign Expansion with Parameters' (look at help).
Then use FOR:
for i=1 to NoOfRows('StockNames')
LET CurrentStock = FieldValue('StockName', i);
LOAD
CurrentStock as StockName,
...
FROM
[$(URLBase(CurrentStock))]
(html, ...)
Next i;
Thank you for your quick help! Worked perfectly!