Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

real_time values are not shown #23

Closed
piratmc opened this issue Apr 14, 2015 · 4 comments
Closed

real_time values are not shown #23

piratmc opened this issue Apr 14, 2015 · 4 comments

Comments

@piratmc
Copy link

piratmc commented Apr 14, 2015

Hi
currentTradingSession = StockQuote::Stock.quote(tickers[n])

I'm testing live currentTradingSession.ask_realtime and other real_time values are returned as NilClass.
Other non real_time values are properly returned as Float but seems like 20 minutes behind compared to actual prices.
Is this a known issue and a limitation of gem/API or am I doing something wrong?
Thank you!

@tyrauber
Copy link
Owner

@piratmc Looking at an aapl quote after trading hours I notice that ask_realtime is nil. Perhaps, those values are only available while the market is open? Or it may no longer be available through the yahoo api.

Unfortunately, the delay is a function of the Yahoo API. Originally the gem used the google finance api, before it was deprecated, which seemed to be 'more real-time'. In my experience, the closest I have been able to get to 'real-time' is with the TradeKing API (https://github.com/tyrauber/tradeking).

@piratmc
Copy link
Author

piratmc commented Apr 14, 2015

Thank you for reply.
I was checking values DURING trading session so expected Float but not Nil’s for real-time values.
If you have time to check out if these numbers still available via yahoo API’s that would be great. Perhaps it’s just na name change or small things like that causes the return to be Nil during open trading session.
Regardless, thanks work your work.
And thanks for a link.

On Apr 14, 2015, at 3:51 PM, Ty Rauber notifications@github.com wrote:

@piratmc https://github.com/piratmc Looking at an aapl quote after trading hours I notice that ask_realtime is nil. Perhaps, those values are only available while the market is open? Or it may no longer be available through the yahoo api.

Unfortunately, the delay is a function of the Yahoo API. Originally the gem used the google finance api, before it was deprecated, which seemed to be 'more real-time'. In my experience, the closest I have been able to get to 'real-time' is with the TradeKing API (https://github.com/tyrauber/tradeking https://github.com/tyrauber/tradeking).


Reply to this email directly or view it on GitHub #23 (comment).

@tyrauber
Copy link
Owner

@piratmc Unfortunately, it is not an attribute change or parsing issue. The raw data includes null for those values in the response. I have no idea why.

Query:

https://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.finance.quotes%20WHERE%20symbol%20IN%20(%27AAPL%27)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=

Response:

   {"query":{"count":1,"created":"2015-04-14T23:17:39Z","lang":"en-US","diagnostics":{"url":[{"execution-start-time":"0","execution-stop-time":"1","execution-time":"1","content":"http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml"},{"execution-start-time":"7","execution-stop-time":"12","execution-time":"5","content":"http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=AAPL"}],"publiclyCallable":"true","cache":{"execution-start-time":"5","execution-stop-time":"6","execution-time":"1","method":"GET","type":"MEMCACHED","content":"5d1e1de680846a307c9874dc3d6878dc"},"query":{"execution-start-time":"6","execution-stop-time":"13","execution-time":"7","params":"{url=[http://download.finance.yahoo.com/d/quotes.csv?f=aa2bb2b3b4cc1c3c4c6c8dd1d2ee1e7e8e9ghjkg1g3g4g5g6ii5j1j3j4j5j6k1k2k4k5ll1l2l3mm2m3m4m5m6m7m8nn4opp1p2p5p6qrr1r2r5r6r7ss1s7t1t7t8vv1v7ww1w4xy&s=AAPL]}","content":"select * from csv where url=@url and columns='Ask,AverageDailyVolume,Bid,AskRealtime,BidRealtime,BookValue,Change&PercentChange,Change,Commission,Currency,ChangeRealtime,AfterHoursChangeRealtime,DividendShare,LastTradeDate,TradeDate,EarningsShare,ErrorIndicationreturnedforsymbolchangedinvalid,EPSEstimateCurrentYear,EPSEstimateNextYear,EPSEstimateNextQuarter,DaysLow,DaysHigh,YearLow,YearHigh,HoldingsGainPercent,AnnualizedGain,HoldingsGain,HoldingsGainPercentRealtime,HoldingsGainRealtime,MoreInfo,OrderBookRealtime,MarketCapitalization,MarketCapRealtime,EBITDA,ChangeFromYearLow,PercentChangeFromYearLow,LastTradeRealtimeWithTime,ChangePercentRealtime,ChangeFromYearHigh,PercebtChangeFromYearHigh,LastTradeWithTime,LastTradePriceOnly,HighLimit,LowLimit,DaysRange,DaysRangeRealtime,FiftydayMovingAverage,TwoHundreddayMovingAverage,ChangeFromTwoHundreddayMovingAverage,PercentChangeFromTwoHundreddayMovingAverage,ChangeFromFiftydayMovingAverage,PercentChangeFromFiftydayMovingAverage,Name,Notes,Open,PreviousClose,PricePaid,ChangeinPercent,PriceSales,PriceBook,ExDividendDate,PERatio,DividendPayDate,PERatioRealtime,PEGRatio,PriceEPSEstimateCurrentYear,PriceEPSEstimateNextYear,Symbol,SharesOwned,ShortRatio,LastTradeTime,TickerTrend,OneyrTargetPrice,Volume,HoldingsValue,HoldingsValueRealtime,YearRange,DaysValueChange,DaysValueChangeRealtime,StockExchange,DividendYield'"},"javascript":{"execution-start-time":"4","execution-stop-time":"23","execution-time":"18","instructions-used":"64823","table-name":"yahoo.finance.quotes"},"user-time":"24","service-time":"7","build-version":"0.2.75"},"results":{"quote":{"symbol":"AAPL","Ask":"126.37","AverageDailyVolume":"56031500","Bid":"126.35","AskRealtime":null,"BidRealtime":null,"BookValue":"21.17","Change_PercentChange":"-0.55 - -0.43%","Change":"-0.55","Commission":null,"Currency":"USD","ChangeRealtime":null,"AfterHoursChangeRealtime":null,"DividendShare":"1.88","LastTradeDate":"4/14/2015","TradeDate":null,"EarningsShare":"7.39","ErrorIndicationreturnedforsymbolchangedinvalid":null,"EPSEstimateCurrentYear":"8.66","EPSEstimateNextYear":"9.40","EPSEstimateNextQuarter":"1.67","DaysLow":"125.91","DaysHigh":"127.29","YearLow":"73.05","YearHigh":"133.60","HoldingsGainPercent":null,"AnnualizedGain":null,"HoldingsGain":null,"HoldingsGainPercentRealtime":null,"HoldingsGainRealtime":null,"MoreInfo":null,"OrderBookRealtime":null,"MarketCapitalization":"735.67B","MarketCapRealtime":null,"EBITDA":"67.66B","ChangeFromYearLow":"53.25","PercentChangeFromYearLow":"+72.90%","LastTradeRealtimeWithTime":null,"ChangePercentRealtime":null,"ChangeFromYearHigh":"-7.30","PercebtChangeFromYearHigh":"-5.46%","LastTradeWithTime":"4:00pm - <b>126.30</b>","LastTradePriceOnly":"126.30","HighLimit":null,"LowLimit":null,"DaysRange":"125.91 - 127.29","DaysRangeRealtime":null,"FiftydayMovingAverage":"126.66","TwoHundreddayMovingAverage":"115.02","ChangeFromTwoHundreddayMovingAverage":"11.28","PercentChangeFromTwoHundreddayMovingAverage":"+9.81%","ChangeFromFiftydayMovingAverage":"-0.36","PercentChangeFromFiftydayMovingAverage":"-0.29%","Name":"Apple Inc.","Notes":null,"Open":"127.09","PreviousClose":"126.85","PricePaid":null,"ChangeinPercent":"-0.43%","PriceSales":"3.70","PriceBook":"5.99","ExDividendDate":"2/5/2015","PERatio":"17.10","DividendPayDate":"2/12/2015","PERatioRealtime":null,"PEGRatio":"1.09","PriceEPSEstimateCurrentYear":"14.57","PriceEPSEstimateNextYear":"13.44","Symbol":"AAPL","SharesOwned":null,"ShortRatio":"1.30","LastTradeTime":"4:00pm","TickerTrend":null,"OneyrTargetPrice":"139.72","Volume":"25502351","HoldingsValue":null,"HoldingsValueRealtime":null,"YearRange":"73.05 - 133.60","DaysValueChange":null,"DaysValueChangeRealtime":null,"StockExchange":"NMS","DividendYield":"1.50","PercentChange":"-0.43%"}}}}

@tyrauber
Copy link
Owner

@piratmc I am going to close this for now, but let me know if the above is not correct or you think there is something we could be doing differently here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants