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

Completely Rewritten as a Library #24

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Conversation

silvavn
Copy link
Contributor

@silvavn silvavn commented Sep 22, 2020

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:

  1. Eiten now gracefully ignores companies that does not fit the timeline size (in the future I would like to just fill the gaps)
    image

  2. We can now use any future estimator desired and compare its performance
    image
    image

  3. We can use any kind of covariance matrix calculation, including those from Scikit Learn
    image

  4. Portfolio weights are now normalized and correspond to percentages (we can just multiply by some number and output a portfolio)
    image

  5. Testing is now completely vectorized
    image
    image
    image

  6. And we can easily evaluate our portfolios
    image

Disclaimer: I haven't developed unit tests. I have changed the GA a bit. This is not finance advice (obviously).

Code now uses vectorized operations
remove some retundancy
integrated pandas
update strategies to make them compliant to new paradigm
Created a demo notebook to show that now Eiten can be used as a library XD
moved random matrix factor to util, since its not a strategy.
Started removing hardcoding
now all strategies in the strategy folder are considered.
used for loops in eiten
removed strategy manager
separating calculation methods from plot methods in backtest.
changed default data timeframe to 1 day.
Inversion of future and past
corrected typo
migrates all vectorization to dataframes
drastically improves speed.
removed all invalid stocks from dataframe
better back/forward testing
@tradytics
Copy link
Owner

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.

@ricnov
Copy link

ricnov commented Sep 7, 2022

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'

@jmlocatelli
Copy link

Hi, where do I find this library and how to install it?

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

Successfully merging this pull request may close these issues.

4 participants