def get_option_chainid(self, symbol): stock_info = self.get_url(self.endpoints["instruments"] + "?symbol=" + symbol) stock_id = stock_info["results"][0]["id"] params = {} params["equity_instrument_ids"] = stock_id chains = self.get_url(urls.options_base() + "chains/", params=params) chains = chains["results"] chain_id = None for chain in chains: if chain["can_open_position"]: chain_id = chain["id"] return chain_id
def options_owned(self): options = self.get_url(urls.options_base() + "positions/?nonzero=true") options = options["results"] return options