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 458 forks source link

Issue with newer version and get_stock_historicals #138

Open 2018kguo opened 4 years ago

2018kguo commented 4 years ago

On version 1.0.0.7, I am able to use the following code to successfully grab historical data for a given stockTicker like "ATVI"

history = r.get_historicals(stockTicker,span='year',bounds='regular')

A few minutes ago, I tried upgrading to 1.2.2, and since get_historicals became obsolete, I changed this to

history = r.get_stock_historicals(stockTicker,span='year',bounds='regular')

and am getting this error:

400 Client Error: Bad Request for url: https://api.robinhood.com/quotes/historicals/?symbols=ATVI&interval=hour&span=year&bounds=regular

Someone else pointed this out to me on a project I have that I wrote using robin_stocks https://github.com/2018kguo/RobinhoodBot/issues/14 Perhaps the request URL ended up being changed somehow between the two versions?

arieldavenport commented 4 years ago

I have the same issue.

sachdved commented 4 years ago

I get the same API error and I found it depends on the argument interval.

with interval=5minute, span=day, week work, no span>week works with interval=10minute, span=day, week work, no span>week works

DIFFERENT FROM API ERROR: with interval=hour, span=day, I get no ticker working, but that might be because I'm trying at 10:30AM EST

with interval=hour, span=week, month, and 3month work, span>3month doesn't work with interval=day, span=day doesn't work with interval=day, span=week, month, 3month, year, and 5year all work with interval=week, span=month, 3month, year, and 5year all work, span<month doesn't work

Seems like one needs an exception for the interval/span combos to accommodate... I can try coding one up

AnabetsyR commented 3 years ago

Has anybody come up with a fix for this?

alexanderchang1 commented 3 years ago

Bump.

daniel-am commented 3 years ago

Try setting the interval when calling the function. I set it to day instead of the default hour and it worked.