- cleaned up
- added GD50 and GD200 git-svn-id: http://moon:8086/svn/projects/Stock@360 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -90,12 +90,13 @@ class Stock(object):
|
||||
|
||||
def statistics(self):
|
||||
N = len(self.data['index'])
|
||||
self.data['ema'] = exponential_moving_average(self.data['close'], alpha=self.params['ema_alpha'])
|
||||
self.data['sma'] = moving_average(self.data['close'], window_days=self.params['sma_days'])
|
||||
self.data['ema'] = exponential_moving_average(self.data['close'], alpha=0.75)
|
||||
self.data['GD200'] = moving_average(self.data['close'], window_days=200)
|
||||
self.data['GD50'] = moving_average(self.data['close'], window_days=50)
|
||||
self.data['close_n'] = normalize(self.data['close'])
|
||||
self.data['macd'] = macd(self.data['close_n'])
|
||||
self.data['min'] = moving_min(self.data['close_n'], window_days=self.params['q_days'])
|
||||
self.data['max'] = moving_max(self.data['close_n'], window_days=self.params['q_days'])
|
||||
self.data['min'] = moving_min(self.data['close_n'], window_days=self.params['q_range_days'])
|
||||
self.data['max'] = moving_max(self.data['close_n'], window_days=self.params['q_range_days'])
|
||||
|
||||
self.data['Qmin'] = self.data['close_n'] - self.data['min']
|
||||
self.data['Qmax'] = self.data['close_n'] - self.data['max']
|
||||
@@ -172,8 +173,7 @@ class Stock(object):
|
||||
plt.grid()
|
||||
|
||||
subplot_id += 1
|
||||
# self.__plot(self.boll, ['lower', 'mid', 'upper'])
|
||||
self.__plot(subplot_id, self.data, ['Qmin', 'Qmax'])
|
||||
self.__plot(subplot_id, self.data, ['close', 'GD50', 'GD200'])
|
||||
plt.legend()
|
||||
plt.grid()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user