- buy_BTFD: added params
- stock::fetch: support slice by date if loaded from file git-svn-id: http://moon:8086/svn/projects/Stock@334 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -72,11 +72,18 @@ class Stock(object):
|
||||
hdf = pd.HDFStore(filename, 'r')
|
||||
|
||||
data = hdf[self.symbol] * self.currency_corr
|
||||
N = len(data.index)
|
||||
self.data['index'] = np.array(data.index[0:N])
|
||||
self.data['close'] = np.array(data['close'][0:N])
|
||||
self.data['high'] = np.array(data['high'][0:N])
|
||||
self.data['low'] = np.array(data['low'][0:N])
|
||||
start_pos = 0
|
||||
end_pos = 0
|
||||
|
||||
for index in data.index:
|
||||
end_pos += 1
|
||||
if str(end) in index:
|
||||
break
|
||||
|
||||
self.data['index'] = np.array(data.index[start_pos:end_pos])
|
||||
self.data['close'] = np.array(data['close'][start_pos:end_pos])
|
||||
self.data['high'] = np.array(data['high'][start_pos:end_pos])
|
||||
self.data['low'] = np.array(data['low'][start_pos:end_pos])
|
||||
|
||||
hdf.close()
|
||||
|
||||
@@ -113,7 +120,7 @@ class Stock(object):
|
||||
self.data['macd_fdd'] = np.transpose(yf_dd)
|
||||
|
||||
def analyze(self, buy_callback, range_days):
|
||||
return agent.buy_BTFD(self.symbol, self.data, marker_key='close_n', cand_window=5, range_days=range_days, buy_callback=buy_callback)
|
||||
return agent.buy_BTFD(self.symbol, self.data, params=self.params['btfd'], marker_key='close_n', range_days=range_days, buy_callback=buy_callback)
|
||||
|
||||
@staticmethod
|
||||
def has_candidate(data, key):
|
||||
|
||||
Reference in New Issue
Block a user