INNER CODE UNIT · Python

manage_strangle

ldt9/PyOptionTrader · models/futures/short_strangle.py:511

    def manage_strangle(self):
        if self.in_trade:  # We are in a trade with no open orders
            '''
            If we are in a trade, we want to poll the position and
            close it if it is 21 DTE or less, the bracket order will
            take care of the take profit and stop loss
            '''
            # get the days to expiration
            daysToexp = (self.nearestDTE - datetime.date.today()).days

            # get the market price of the combo order
            combobars = self.ib.reqHistoricalData(
                contract=self.strangle,
                endDateTime='',
                durationStr='60 s',
                barSizeSetting='1 secs',
                whatToShow='TRADES',
                useRTH=True,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…