Example #1
0
 def bollingerbands(self, k, price_type='close'):
     ave = np.mean(getattr(self, price_type))
     sd = np.std(getattr(self, price_type))
     upband = ave + (sd*k)
     lwband = ave - (sd*k)
     return _round(ave), _round(upband), _round(lwband)
Example #2
0
 def adjust_price_for_slippage(self, direction, price):
     direction_mod = -1 if direction in ('SELL','SHORT') else 1
     # print(self.MAX_SLIPPAGE)
     return _round(price * (1+self.MAX_SLIPPAGE*direction_mod))
Example #3
0
 def mavg(self, price_type='close'):
     return _round(np.mean(getattr(self, price_type)))