Skip to content

Commit

Permalink
* moningstar stopped working, see: pydata/pandas-datareader#557
Browse files Browse the repository at this point in the history
* refactoring, wip
  • Loading branch information
alessandrozamberletti committed Jul 31, 2018
1 parent d9084af commit 384e2ae
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
if resource.descriptor['datahub']['type'] == 'derived/csv':
sp500 = [s[0].encode('utf-8') for s in resource.read()]

stocks_num = 10
stocks_num = 1
stocks = random.sample(sp500, stocks_num)

# TODO: evaluate on different stocks to avoid fake results caused by similar time windows between train and test
Expand Down Expand Up @@ -46,6 +46,8 @@
print('Splitting data into time windows..')
X = []
y = []
X_test = []
y_test = []

if train_debug:
plt.ion()
Expand Down Expand Up @@ -78,8 +80,12 @@

current = scaler.fit_transform(current)
future = scaler.transform(future)
X.append(current.reshape(ssize, ssize, chns))
y.append(trend)
if stock in test_stocks:
X_test.append(current.reshape(ssize, ssize, chns))
y_test.append(trend)
else:
X.append(current.reshape(ssize, ssize, chns))
y.append(trend)

if train_debug:
f.suptitle('Chart&Visual Train Samples - SYMBOL:{0}'.format(stock))
Expand Down

0 comments on commit 384e2ae

Please sign in to comment.