I'm looking for a review on my code. I am also looking for ways to transform this function into something more Pythonic. I'm fairly new to Python, so any advice would be appreciated.
def get_rsi(self, period):
rsi = []
for i in xrange(1, len(self.hist_d) - period + 1):
gains = 0.0
losses = 0.0
for j in xrange(i, i + period):
diff = self.hist_d[j][2] - self.hist_d[j - 1][2]
if diff > 0:
gains += diff
elif diff < 0:
losses += abs(diff)
rsi.append(round(100 - (100 / (1 + gains / losses)), 2))
return rsi