def less_than_N_hours_of_trading_left_for_contract(
            self,
            contract_object: futuresContract,
            N_hours: float = 1.0) -> bool:
        trading_hours = self.get_trading_hours_for_contract(contract_object)
        trading_hours_checker = manyTradingStartAndEndDateTimes(trading_hours)

        return trading_hours_checker.less_than_N_hours_left(N_hours=N_hours)
Beispiel #2
0
    def is_contract_okay_to_trade(self,
                                  futures_contract: futuresContract) -> bool:
        new_log = futures_contract.log(self.log)
        trading_hours = self.get_trading_hours_for_contract(futures_contract)
        if trading_hours is missing_contract:
            new_log.critical(
                "Error! Cannot find active contract! Expired? interactive_update_roll_status.py not executed?"
            )
            return False

        trading_hours_checker = manyTradingStartAndEndDateTimes(trading_hours)
        return trading_hours_checker.okay_to_trade_now()
    def is_contract_okay_to_trade(self,
                                  futures_contract: futuresContract) -> bool:
        trading_hours = self.get_trading_hours_for_contract(futures_contract)
        trading_hours_checker = manyTradingStartAndEndDateTimes(trading_hours)

        return trading_hours_checker.okay_to_trade_now()
    def less_than_one_hour_of_trading_leg_for_contract(self, contract_object: futuresContract) -> bool:
        trading_hours = self.get_trading_hours_for_contract(contract_object)
        trading_hours_checker = manyTradingStartAndEndDateTimes(trading_hours)

        return trading_hours_checker.less_than_one_hour_left()