(self, index)
return round(start_position * (1 + settings.INTERVAL) ** index, self.instrument['tickLog'])
Given an index (1, -1, 2, -2, etc.) return the price for that side of the book.
           Negative is a buy, positive is a sell.
Given an index (1, -1, 2, -2, etc.) return the price for that side of the book.
           Negative is a buy, positive is a sell.
Given an index ( 1 - 1 2 - 2 etc . ) return the price for that side of the book . Negative is a buy positive is a sell .
def get_price_offset(self, index):
        """Given an index (1, -1, 2, -2, etc.) return the price for that side of the book.
           Negative is a buy, positive is a sell."""
        # Maintain existing spreads for max profit
        if settings.MAINTAIN_SPREADS:
            start_position = self.start_position_buy if index < 0 else self.start_position_sell
            # First positions (index 1, -1) should start right at start_position, others should branch from there
            index = index + 1 if index < 0 else index - 1
        else:
            # Offset mode: ticker comes from a reference exchange and we define an offset.
            start_position = self.start_position_buy if index < 0 else self.start_position_sell

            # If we're attempting to sell, but our sell price is actually lower than the buy,
            # move over to the sell side.
            if index > 0 and start_position < self.start_position_buy:
                start_position = self.start_position_sell
            # Same for buys.
            if index < 0 and start_position > self.start_position_sell:
                start_position = self.start_position_buy

        return round(start_position * (1 + settings.INTERVAL) ** index, self.instrument['tickLog'])
def get_price_offset ( self , index ) : # Maintain existing spreads for max profit if settings . MAINTAIN_SPREADS : start_position = self . start_position_buy if index < 0 else self . start_position_sell # First positions (index 1, -1) should start right at start_position, others should branch from there index = index + 1 if index < 0 else index - 1 else : # Offset mode: ticker comes from a reference exchange and we define an offset. start_position = self . start_position_buy if index < 0 else self . start_position_sell # If we're attempting to sell, but our sell price is actually lower than the buy, # move over to the sell side. if index > 0 and start_position < self . start_position_buy : start_position = self . start_position_sell # Same for buys. if index < 0 and start_position > self . start_position_sell : start_position = self . start_position_buy return round ( start_position * ( 1 + settings . INTERVAL ) ** index , self . instrument [ 'tickLog' ] )