robinhood-unofficial / pyrh

Python Framework to make trades with the unofficial Robinhood API
https://pyrh.readthedocs.io/en/latest/
MIT License
1.78k stars 603 forks source link

TypeError unsupported operand types for URL and str #229

Closed samueleishion closed 4 years ago

samueleishion commented 4 years ago

Checklist

Description

pyrh fails to return a result when calling function get_historical_quotes

Steps/Code to Reproduce

stock = 'MSFT'
history = robinhood.get_historical_quotes(stock, '5minute', 'week')

Results

Expected: historical data Actual: Error on the following line (https://github.com/robinhood-unofficial/pyrh/blob/master/pyrh/robinhood.py#L197) that reads

TypeError: unsupported operand type(s) for +: 'URL' and 'str'
Screen Shot 2020-04-23 at 11 10 14 PM

Versions

>>> import platform; print(platform.platform())
Darwin-19.2.0-x86_64-i386-64bit
>>> import sys; print("Python", sys.version)
Python 3.7.6 (default, Dec 30 2019, 19:38:26) 
[Clang 11.0.0 (clang-1100.0.33.16)]
>>> import pyrh; print("pyrh", pyrh.__version__)
pyrh 2.0
adithyabsk commented 4 years ago

@samueleishion That likely is a bug, we're in the middle of major re-factor and contributions are welcome.

samueleishion commented 4 years ago

Suggested change: Replace these lines https://github.com/robinhood-unofficial/pyrh/blob/master/pyrh/robinhood.py#L188-L198 with the following:

historicals = (urls.HISTORICALS.with_query([
        ('symbols', ",".join(stock).upper()),
        ('interval', interval),
        ('span', span),
        ('bounds', bounds.name.lower())
]))
samueleishion commented 4 years ago

@adithyabsk just saw your reply... are you taking PRs?

adithyabsk commented 4 years ago

@samueleishion yep

samueleishion commented 4 years ago

@adithyabsk branch off and into master?

adithyabsk commented 4 years ago

Yep, just fork the project and commit to master and create a PR (so you're not blocked)

samueleishion commented 4 years ago

Hey @adithyabsk I've created a PR but it seems to fail when running on Python 3.7.6 with a relatively vague error... any thoughts? https://github.com/robinhood-unofficial/pyrh/pull/230

adithyabsk commented 4 years ago

@samueleishion I commented on the PR