示例#1
0
    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(endpoints.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
示例#2
0
 def options_owned(self):
     options = self.get_url(endpoints.options_base() + "positions/?nonzero=true")
     options = options["results"]
     return options