|
Time Stamp Error - Yahoo Finance Data |
Posted by Ajmal on Jan-10-2010 22:32 |
|
Hello Sir, I am Ajmal from India,
We are working on your trail ruby on rails software sir, the latest edition for windows.
Sir we are able to retrive yahoo finance data by yahoofinance gem and want it to use for chart director as input.
The problamatic issue has been yahoo finance returns the data ie Date, Open, High, Low, Close, Volume, Adjusted Close time stamp as year/month/date format.
The chartDirector takes the input as getData(ticker, startDate, endDate, durationInDays, extraPoints)
But the start date and end data are not in date format. If we send the data we recieve from yahoo finance in date format, it is converted into some other format most like seconds, and charts are not displayed.
Is there a solution to send the data as date itself as we recieve from yahoo finance.?
We are awaiting your help in this regard, thanks. |
Re: Time Stamp Error - Yahoo Finance Data |
Posted by Ajmal on Jan-11-2010 16:04 |
|
Hello Peter, I am facing the same problem even after doing it...
I am giving you the code below which i am using..
Pls help us on the same, thanks.
Are we passing the data we recieve from Yahoo Finance in the correct way.....
If we use it as given here,
http://ruby-doc.org/core/classes/Time.html
We are getting an error.
The chart seems to end around november itself. The latest 2 months are not seen in graph itself. ?
-----------------------------------------
def getchart()
#This is the data in the sample code of finance2_controller
#timeStamps = rantable.getCol(0)
#highData = rantable.getCol(1)
# lowData = rantable.getCol(2)
# openData = rantable.getCol(3)
# closeData = rantable.getCol(4)
# volData = rantable.getCol(5)
@sym='RIL.BO'
@date=[]
@open=[]
@high=[]
@low=[]
@close=[]
@vol=[]
YahooFinance::get_historical_quotes_days(@sym, 130 ) do |row|
@splitted=row[0].split('-')
@date<< Date.new(@splitted[0].to_i, @splitted[1].to_i,@splitted[2].to_i)
@open<< row[1].to_i
@high<< row[2].to_i
@low<< row[3].to_i
@close<< row[4].to_i
@vol<< row[5].to_i
end
#Here we override the data
timeStamps=@date
highData =@high
lowData =@low
openData =@open
closeData =@close
volData =@vol |
Re: Time Stamp Error - Yahoo Finance Data |
Posted by Peter Kwan on Jan-11-2010 16:18 |
|
Hi Ajmal,
Please try to use Time, not Date. In Ruby, the standard class that represents an instance in date/time is "Time". The "Date" class is just a representation of a calendar, not an instance in date/time. Also, the Date class does not support hour, minute and seconds, and so is not suitable for charting purposes.
Hope this can help.
Regards
Peter Kwan |
|