Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running portfolio_manager.py #11

Closed
edoreld opened this issue Sep 11, 2020 · 8 comments
Closed

Error when running portfolio_manager.py #11

edoreld opened this issue Sep 11, 2020 · 8 comments

Comments

@edoreld
Copy link

edoreld commented Sep 11, 2020

With the most recent code, I run the following command:

python3 portfolio_manager.py --is_test 1 --future_bars 90 --data_granularity_minutes 3600 --history_to_use all --apply_noise_filtering 1 --market_index QQQ --only_long 1 --eigen_portfolio_number 3 --stocks_file_path stocks/stocks.txt

Previously, this worked. Now, I get an error:

Traceback (most recent call last):
  File "portfolio_manager.py", line 37, in <module>
    main()
  File "portfolio_manager.py", line 33, in main
    eiten.run_strategies()
  File "/Users/jmartinezlago/eiten/eiten.py", line 107, in run_strategies
    historical_price_info, future_prices, symbol_names, predicted_return_vectors, returns_matrix, returns_matrix_percentages = self.load_data()
  File "/Users/jmartinezlago/eiten/eiten.py", line 95, in load_data
    self.data_dictionary[symbol]["historical_prices"])
KeyError: 'historical_prices'
@tradytics
Copy link
Owner

Let me test this today and get back. Maybe a PR broke something.

@clairvoyant
Copy link

It seems the returned keys in the self.dataEngine.collect_data_for_all_tickers
are 'historical' and 'future' not 'historical_prices' and 'future_prices'

symbol=AAPL
data= {'historical': Date Open High Low Close Volume
1 2015-09-15 28.982500 29.132500 28.605000 29.070000 173364800
2 2015-09-16 29.062500 29.135000 28.860001 29.102501 148694000
3 2015-09-17 28.915001 29.122499 28.430000 28.480000 256450400
4 2015-09-18 28.052500 28.575001 27.967501 28.362499 297141200
5 2015-09-21 28.417500 28.842501 28.415001 28.802500 200888000
... ... ... ... ... ... ...
1164 2020-04-29 71.182503 72.417503 70.972504 71.932503 137280800
1165 2020-04-30 72.489998 73.632500 72.087502 73.449997 183064000
1166 2020-05-01 71.562500 74.750000 71.462502 72.267502 240616800
1167 2020-05-04 72.292503 73.422501 71.580002 73.290001 133568000
1168 2020-05-05 73.764999 75.250000 73.614998 74.389999 147751200

[1168 rows x 6 columns], 'future': Date Open High Low Close Volume
1169 2020-05-06 75.114998 75.809998 74.717499 75.157501 142333600
1170 2020-05-07 75.805000 76.292503 75.492500 75.934998 115215200
1171 2020-05-08 76.410004 77.587502 76.072502 77.532501 134048000
1172 2020-05-11 77.025002 79.262497 76.809998 78.752502 145946400
1173 2020-05-12 79.457497 79.922501 77.727501 77.852501 162301200
... ... ... ... ... ... ...
1254 2020-09-04 120.070000 123.699997 110.889999 120.959999 332607200
1255 2020-09-08 113.949997 118.989998 112.680000 112.820000 231366600
1256 2020-09-09 117.260002 119.139999 115.260002 117.320000 176940500
1257 2020-09-10 120.360001 120.500000 112.500000 113.489998 181425600
1258 2020-09-11 114.570000 115.230003 110.029999 112.000000 176498411

@clairvoyant
Copy link

the change in the dictionary keys was introduced in commit 4a4ceeb.

commit 4a4ceeb
Date: Fri Sep 11 01:42:43 2020 -0600

Prices to dataframes

and removed a bug where 1 day of data was lost

@clairvoyant
Copy link

clairvoyant commented Sep 11, 2020

after changing the trivial dict key issues, it fails with index out of bound exceptions.

iterating over the commit history, the last version that finish without exceptions is

commit 8722d20

@tradytics
Copy link
Owner

Thanks for adding this info. I am going to fix the latest version and comment here again.

@tradytics
Copy link
Owner

Please try now everyone. Should be fixed now.

@clairvoyant
Copy link

Working seamlessly, on top of that I appreciate you are sharing the code. It's really useful to learn.

thanks!!!

@tradytics
Copy link
Owner

Of course, appreciate your comments. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants