Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I Have the code below to load the current stock price and date and time of the load. How do I get the daily high price?
[Stock]:
LOAD
@1 as Symbol,
@2 as Price,
@3 as Date,
@4 as Time
FROM
[http://download.finance.yahoo.com/d/quotes.csv?s=RAVN&f=sl1d1t1]
(txt, codepage is 1252, explicit labels, delimiter is ',', msq);
Maybe you can parse in the html tables that you can find on the stock chart pages, something like
LOAD //@1,
@2 as DailyRange
FROM
[http://finance.yahoo.com/q/bc?s=RAVN+Basic+Chart]
(html, codepage is 1252, explicit labels, table is @11)
where recno()=1;
This will give you the range, maybe you can find the daily high or just separate it from the string.
This load seems to only return one line, is this by intention? Do you concatenate the data over a period of time or do you perform an incremental load?
I assume you somehow get a complete list of stock values over time, multiple lines per date. You could probably do a group by load like
LOAD
Symbol, Date, max(Price) as DailyHighPrice resident Stock group by Symbol, Date;
This gives me one line. All I want is that one company stock price at last load of the document nad the data and time of it. I was wondering if anyone else had done something similar and was able to get the stock price high for the day as like @5. Only @1-4 give anything though, so I'm not sure if this can be done with the current code.
So you are asking more for a help with the yahoo API than for help with QV, right?
I have done something similar in the past, but I used the historical data to get a list of daily high stock values, something like
http://ichart.finance.yahoo.com/table.csv?s=RAVN&d=4&e=7&f=2012&g=d&a=2&b=17&c=1992&ignore=.csv
Yes Swuehl, that is true. I have load the hisortical data in the past and could just do something like that and pick the daily high price. Just wondering if there was an easier way that someone had already done.
An easier way than just using the ready-to-use table? Not sure if I understand...
If you query the current price in your load, you would need to catch the moment of the daily high price, thus I don't think this is feasible using QV (and why do so, if you get the data for free the next day?).
The boss requested to be able to see the current day's high price to go along with what we already have in daily current price.
Maybe you can parse in the html tables that you can find on the stock chart pages, something like
LOAD //@1,
@2 as DailyRange
FROM
[http://finance.yahoo.com/q/bc?s=RAVN+Basic+Chart]
(html, codepage is 1252, explicit labels, table is @11)
where recno()=1;
This will give you the range, maybe you can find the daily high or just separate it from the string.
[RavenStock2]:
LOAD //@1,
@2 as DailyRange
FROM
[http://finance.yahoo.com/q/bc?s=RAVN+Basic+Chart]
(html, codepage is 1252, explicit labels, table is @11)
where recno()=1;
Sorry to bother you swuehl, but this morning this line of code failed to work. Can you help me? Something probably changed on the webpage.
Just copied the piece of code and reloaded.
Worked fine for me (DailyRange: 71.90 - 72.00)
Have you retried (Maybe a temporary site down time occurred)? Any other error messages?