robinhood-unofficial / pyrh

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

Option Support, Function not working #314

Open leoi137 opened 6 months ago

leoi137 commented 6 months ago

Checklist

Description

Getting the option chain is broken when calling rh.get_options() and rh.get_option_marketdata(). It also doesn't seem the Option Support branch was merged.

Steps/Code to Reproduce

rh.get_options("AAPL", expiration_dates=["2024-02-02"], option_type="call")

and

chain_id = rh.get_option_chainid("AAPL") rh.get_option_marketdata(chain_id)

Results

File ~/Library/Mobile Documents/com~apple~CloudDocs/Documents/trading/py_research/py_research/lib/python3.11/site-packages/pyrh/urls.py:174, in build_chain(instrument_id) 160 def build_chain(instrument_id: str) -> URL: 161 """Build the query for a particular options chain. 162 163 # TODO: this isn't best practice (...) 171 172 """ 173 return ( ... 726 ) 727 seg = seg if encoded else self._PATH_QUOTER(seg) 728 if "/" in seg:

ValueError: Appending path '/' starting from slash is forbidden

Versions

macOS-14.1.2-arm64-arm-64bit Python 3.11.4 (v3.11.4:d2340ef257, Jun 6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)] pyrh 2.1.2