eiten
eiten copied to clipboard
Completely Rewritten as a Library
I have completely re-written the code as a library instead of writing a CLI. I did that because, in my humble opinion, it is more useful to use Eiten in data analysis by integrating it into pipelines and notebooks. Taking this approach, the next step would be making it a package and releasing it on PyPi.
Features:
-
Eiten now gracefully ignores companies that does not fit the timeline size (in the future I would like to just fill the gaps)
-
We can now use any future estimator desired and compare its performance
-
We can use any kind of covariance matrix calculation, including those from Scikit Learn
-
Portfolio weights are now normalized and correspond to percentages (we can just multiply by some number and output a portfolio)
-
Testing is now completely vectorized
-
And we can easily evaluate our portfolios
Disclaimer: I haven't developed unit tests. I have changed the GA a bit. This is not finance advice (obviously).
This is some excellent stuff @silvavn - do you mind running some tests just to make sure everything works. Someone else previously submitted a PR and said that they'd run all the tests. The code broke immediately after I merged the PR.
Hi I've got this errore when testing your PR:
Traceback (most recent call last): File "portfolio_manager.py", line 36, in <module> main() File "portfolio_manager.py", line 32, in main eiten.run_strategies() File "eiten.py", line 100, in run_strategies weights = p.generate_portfolio( File "./strategies/genetic_algo_strategy.py", line 34, in generate_portfolio top_genes = self.select(kwargs.sample_returns, initial_genes) File "./strategies/genetic_algo_strategy.py", line 80, in select returns = np.dot(return_matrix, transposed_gene) File "<__array_function__ internals>", line 180, in dot TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'