jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.69k stars 459 forks source link

get_latest_price does not return overnight prices #425

Closed bartekpuzon closed 1 year ago

bartekpuzon commented 1 year ago

This will not return current price outside of the extended hours:

rs.stocks.get_latest_price('XXXX', includeExtendedHours=True)

I stepped through the program and it looks like the URL the function depends on: https://api.robinhood.com/quotes/, doesn't return the live 24/7 price in any of its fields.

How to get the current overnight stock price?

bartekpuzon commented 1 year ago

This does return more data (note id is stock id, not symbol)

 marketdata_quotes_url(id) + "?bounds=24_5"

I don't know yet if last_non_reg_trade_price or last_extended_hours_trade_price (from the result) should be used, but as of now (11pm on a Sunday) these two are always the same. I plan to get back to using get_latest_price outside of the night hours.