'max_leverage is the gross leverage in decimal form. For example,
2, limits an algorithm to trading at most double the account value.'

def __init__(self, max_leverage):

    super(MaxLeverage, self).__init__(max_leverage=max_leverage)
    self.max_leverage = max_leverage
    if (max_leverage is None):
        raise ValueError('Must    supply    max_leverage')
    if (max_leverage < 0):
        raise ValueError('max_leverage    must    be    positive')
