Skip to content

Commit

Permalink
UPDATE: include all info about the option on the chain
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleehodges committed Apr 2, 2018
1 parent 3086f50 commit 3531a5e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Robinhood/Robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,15 @@ def get_options(self, instrument, expiration_dates, option_type):
Args: instrument id (str), list of expiration dates to filter on (YYYY-MM-DD), and whether or not its a 'put' or a 'call' option type (str).
Returns:
Options Contracts (List): a list (chain) of contract ids that can be queried for additional
information about that options contract.
Options Contracts (List): a list (chain) of contracts for a given underlying equity instrument
"""
if(type(expiration_dates) == list):
_expiration_dates_string = expiration_dates.join(",")
else:
_expiration_dates_string = expiration_dates
chain_id = self.get_url("{base}chains/?equity_instrument_ids={_instrument}".format(base=self.endpoints['options'], _instrument=instrument))["results"][0]["id"]
options_url = "{base}instruments/?chain_id={_chainid}&expiration_dates={_dates}&state=active&tradability=tradable&type={_type}".format(base=self.endpoints['options'], _chainid=chain_id, _dates=_expiration_dates_string, _type=option_type)
return [contract["id"] for contract in self.get_url(options_url)["results"]]
return [contract for contract in self.get_url(options_url)["results"]]


###########################################################################
Expand Down

0 comments on commit 3531a5e

Please sign in to comment.