Get maximum contracts allowed to trade
        baed on required margin per contract and
        current account balance (futures only)

        :Parameters:
            overnight : bool
                Calculate based on Overnight margin (set to ``False`` to use Intraday margin req.)

        :Retruns:
            contracts : int
                maximum contracts allowed to trade (returns ``None`` for non-futures)

def get_max_contracts_allowed(self, overnight=True):
        """ Get maximum contracts allowed to trade
        baed on required margin per contract and
        current account balance (futures only)

        :Parameters:
            overnight : bool
                Calculate based on Overnight margin (set to ``False`` to use Intraday margin req.)

        :Retruns:
            contracts : int
                maximum contracts allowed to trade (returns ``None`` for non-futures)
        """
        timeframe = 'overnight_initial' if overnight else 'intraday_initial'
        req_margin = self.get_margin_requirement()
        if req_margin[timeframe] is not None:
            if 'AvailableFunds' in self.parent.account:
                return int(math.floor(self.parent.account['AvailableFunds'
                                                          ] / req_margin[timeframe]))

        return None