Commit Graph

139 Commits

Author SHA1 Message Date
Mark Aron Szulyovszky 4dfd75eb3e chore(Project): removed code that was used to "close-source" the repo 2022-11-07 17:00:11 +01:00
Mark Aron Szulyovszky 0ca1d0ed2f Delete copy_repo.yml 2022-11-07 16:52:58 +01:00
Mark Aron Szulyovszky 2606639cc2 fix(Labelling): didn't forward shift forward returns previously, introduced major lookahead bias (#249)
* fix(Labelling): didn't forward shift forward returns previously, introduced major lookahead bias

* fix(Baseline): use the same config
2022-03-15 19:12:40 +01:00
Mark Aron Szulyovszky 7deeb2de01 feat(Baseline): added one-split baseline, pure sklearn (#247)
* feat(Baseline): added sklearn_baseline

* feat(Baseline): completely working
2022-03-15 18:16:12 +01:00
Mark Aron Szulyovszky 5482e3fc95 feat(Config): added start_date property (#245)
* refactor(Training): remove non-expanding window option

* feat(Config): added `start_date` property

* fix(Inference): added start_date here as well

* fix(Linter): ran
2022-03-15 17:48:43 +01:00
Mark Aron Szulyovszky 0395715fa1 fix(Config): set remove_overlapping_events=True (#246)
* fix(Config): set remove_overlapping_events=True

* fix(Config): only use level_1 features

* feat(Config): added get_minimal_config
2022-03-15 17:39:39 +01:00
Mark Aron Szulyovszky d0c519dc5b refactor(Training): remove non-expanding window option (#244) 2022-03-15 16:21:06 +01:00
Mark Aron Szulyovszky b5ddee8dce feat(HPO): added run_hpo script (#237)
* feat(HPO): added `run_hpo` script

* fix(Linter): ran

* feat(HPO): removed any reference to sweep (superseeded by optuna)

* fix(HPO): optimize for sharpe

* fix(Config): removed glassnode data, save trials from hpo

* feat(Labelling): added three-balanced method works again

* fix(BetSizing): set the correct class labels

* fix(HPO): powerset should return what's expected, added two new normalization methods

* fix(Linter): ran

* fix(DataLoader): sort the dataframe when fetching data

* fix(Config): only take z-score of other assets
2022-03-15 14:43:16 +01:00
Mark Aron Szulyovszky 345b48a67c feat(Filters): added numba compiled cusum filter (#243) 2022-03-15 14:32:49 +01:00
Mark Aron Szulyovszky 4fc1070f45 fix(DataLoader): sort the dataframe when fetching data (#239) 2022-03-15 14:12:05 +01:00
Mark Aron Szulyovszky 95b0499430 fix(Config): rename sliding_window_size to initial_window_size (#235) 2022-03-13 16:05:16 +01:00
Mark Aron Szulyovszky 717e0ac979 feat(Models): added optional hpsklearn (#236) 2022-03-13 14:59:42 +01:00
Mark Aron Szulyovszky d6df773267 fix(Linter): ran 2022-03-12 22:25:03 +01:00
Mark Aron Szulyovszky 5b7bcbb5e9 fix(DataLoader): sort the data before merging (this corrupted the pipeline completely) 2022-03-12 22:22:10 +01:00
Mark Aron Szulyovszky c1d79ac8c2 fix(Labeling): use X.loc instead of X.filter, remove Nan from event_start_times 2022-03-12 13:27:44 +01:00
Mark Aron Szulyovszky b656f790f5 feat(Data): resample exogenous/other datasource when their frequency is different (#234)
* feat(Data): resample exogenous/other datasource when their frequency is different

* fix(Linter): ran

* fix(Data): resampling done properly
2022-03-10 20:00:06 +01:00
Mark Aron Szulyovszky 4a9f74d645 fix(Project): m1 support (#233) 2022-03-10 13:07:41 +01:00
Mark Aron Szulyovszky 567cd5e9f0 refactor(Evaluate): print out accuracy, f1, etc. for the final & meta predictions, separated out evaluation step (#228)
* refactor(Evaluate): print out accuracy, f1, etc. for the final & meta predictions, separated out evaluation step

* fix(Linter): ran

* fix(Tests): syntax change

* fix(Inference): runs now again

* fix(Linter): ran
2022-03-03 17:40:17 +01:00
Mark Aron Szulyovszky 75157c6285 feat(Labeling): purge overlapping events, sort dataframe at loading time (#226)
* feat(Labeling): purge overlapping events, sort dataframe at loading time

* fix(Linter): ran

* refactor(Labeling): moved purge_overlapping_events one abstraction level higher

* fix(Data): renamed class

* fix(Data): corrected parameter name

* fix(Config): parameters

* fix(Data): fixed path

* fix(Data): uncommented required code

* feat(EventFilters): use vol based CUSUM

* fix(Config): only retrain every 2000 samples

* fix(Config): filter out even more events

* fix(Inference): added remove_overlapping_events

* refactor(Types): simplified type hierarchy
2022-03-02 00:26:33 +01:00
Mark Aron Szulyovszky 10a0803c91 fix(Data): make sure we have data in chronological order 2022-02-20 18:01:01 +01:00
Mark Aron Szulyovszky c9f8ed1304 feat(Data): added script to download data from binance (#224)
* feat(Data): added script to download data from binance

* feat(Data): saving unified parquet file/loading

* fix(Config): tweak the cusum filter's threshold

* fix(Dependencies): added binance_historical_data
2022-02-20 12:30:53 +01:00
Mark Aron Szulyovszky 7a443d93e4 feat(Transformations): added robust scaler (#223)
* feat(Transformations): added robust scaler

* fix(Config): set back default scaler to MinMax
2022-02-20 00:41:46 +01:00
Mark Aron Szulyovszky 229f16c4b3 fix(Ensembling): stacking now works (although performance is poor) 2022-02-19 19:19:02 +01:00
Mark Aron Szulyovszky 7c08a87243 feat(Ensembling): added possiblity of stacking models 2022-02-19 18:55:17 +01:00
Mark Aron Szulyovszky cfb65c135e feat(Pipeline): added multi-asset pipeline, ensembling_method to config 2022-02-19 15:37:19 +01:00
Mark Aron Szulyovszky 7db1c4dc00 feat(Config): added flag to save models 2022-02-19 15:06:05 +01:00
Mark Aron Szulyovszky 77206a5d0a fix(Config): adjusted parameters to 5 minute timeframe 2022-02-19 14:58:34 +01:00
Mark Aron Szulyovszky 3b9d7f554a feature(Config): added transformation parameters to Config, removed expanding_window (it's ON now) 2022-02-19 14:44:49 +01:00
Mark Aron Szulyovszky 8dd2d88740 chore(Linter): reformatted code with black (#211)
* chore(Linter): reformatted code with black

* Create black.yaml
2022-02-17 19:22:17 +01:00
Mark Aron Szulyovszky f3fee4a4e1 fix(Codemod): restored original docstring replacement 2022-02-17 16:53:09 +01:00
Mark Aron Szulyovszky 9d47ee942d feat(Project): use SKLearn models directly, removed custom ensembling, use 5 minute data, batch inference, numba cusum filter (#192)
* feat(Project): use 5 minute data, running training in parallel, sped up cusum filter by 10x with numba

* fix(WalkForward): inference mini-batch parallelization

* fix(WalkForward): don't use the parallel version of any of the functions

* feat(CI): download the data required

* fix(Project): 5min_crypto folder added

* fix(Evaluate): make sure we have numerical stability in returns

* feat(Models): use SKLearn models directly to enable composability

* feat(Inference): batched inference now working, added forecasting_horizon

* fix(Inference): works again

* fix(Inference)

* chore(Models): remove unused Ensemble model

* fix(Labeller): don't just forward shift returns, also take the sum of the data happened until then

* Update test.yml
2022-02-17 16:36:35 +01:00
Mark Aron Szulyovszky 5c94af8b01 fix(CI): removed sphinx workflow from private repo 2022-02-14 23:09:56 +01:00
Mark Aron Szulyovszky 522757c282 fix(CI): push to the public repo without the private repo's history (#207)
* feat(CI): push to the public repo without the private repo's history

* fix(CI): workflow syntax

* fix(CI): use the destination ssh key

* fix(CI): wrong syntax

* fix(CI): taken out unnecessary step

* fix(CI): correct pipe syntax?

* fix(CI): create dictionary

* fix(CI): use global ssh config

* fix(CI): git config can be only called in a repo's dir

* fix(CI): clone the repo with ssh

* fix(CI): added ssh key when clonign

* fix(CI): don't build the docs on PRs

* fix(CI): use the correct ssh keys

* fix(CI): don't push to the local brunch

* fix(CI): missing chmod

* chore(CI): print out private key

* fix(CI): echo

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Create purge.yaml

* Update purge.yaml

* Update copy_repo.yml

* Update copy_repo.yml

* Delete purge.yaml
2022-02-08 01:07:16 +01:00
Mark Aron Szulyovszky 62686393f5 feat(Docs): prepare for sphinx-pages (#205)
* feat(Docs): prepare for sphinx-pages

* feat(CI): added sphinx workflow

* feat(Docs): added content

* fix(CI): use the patched GH action

* fix(CI): set source dir

* chore(Docs): reorder project structure

* chore(Docs): moved index.rst one level up?

* fix(Config): restore the config file, etc.

* fix(Docs): adjusted config
2022-02-02 17:56:25 +01:00
Daniel Szemerey 1f813f89e3 Create copy_repo.yml (#200)
* Create copy_repo.yml

* Create strip_action.yaml

* Create .libcst.codemod.yaml

* Create replace_functions.py

* Create __init__.py

* Update copy_repo.yml (#201)

* Update copy_repo.yml (#202)

* Update copy_repo.yml

* Update copy_repo.yml (#203)

* Update copy_repo.yml

* Update replace_functions.py

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Update copy_repo.yml

* Rename strip_action.yaml to environment-strip-action.yaml

* Update copy_repo.yml

* Update replace_functions.py (#206)
2022-02-02 17:23:16 +01:00
Daniel Szemerey d817605873 Create strip-action.yaml 2022-02-02 12:52:19 +01:00
Mark Aron Szulyovszky f85ee6bb9c fix(MetaLabeling): previously misinterpreted meta-labeling, now also multiplying base model's prediction with the meta model's prediction (#193)
* fix(MetaLabeling): previously misinterpreted meta-labeling, now also multiplying base model's prediction with the meta model's prediction

* fix(Evaluate): print results

* fix(Evaluate): make sure we have numerical stability in returns

* fix(Inference): only output and print stats in training mode

* fix(Evaluate): don't add miniscule amount to result
2022-02-01 13:09:00 +01:00
Mark Aron Szulyovszky 3eb3ea94e3 Refactor(Training): new outcome types, representative pipeline steps, bet-sizing (#187)
* refactor(Training): added InferenceResult & TrainedModel types

* refactor(Pipeline): introduced TrainingOutcome, BetSizingWithMetaOutcome, etc.

* fix(Pipeline): getting it to compile

* refactor(WalkForward): separate preprocessing step

* feat(Pipeline): separate out transformations processing step

* refactor(Pipeline): use the Directional model terminology, put bet_sizing into pipeline instead of hiding it in a step

* refactor(WalkForward): moved functions to separate folder

* fix(WalkForward): use sparse array to store models, process transformations in parallel (lot faster)

* fix(Tests): and evaluation

* fix(Tests): for realz

* fix(Inference): preloading everything now, renamed primary models to directional models

* fix(BetSizing): was running transformations on the wrong data, oops

* fix(BetSizing): concatenated on the wrong axis accidentally

* fix(Reporting): able to use the new Stats type

* fix(BetSizing): renamed int column names

* fix(Portfolio): name the column properly

* fix(Reporting): rename the correct Series, lol

* fix(Inference): walk_forwad_inference() can deal with models not being aligned with the starting index

* fix(WalkForward): accidentally using the wrong index

* fix(WalkForward): use the correct indicies to fetch last model/transformations

* fix(CI): changed the name of the results
2022-01-29 06:41:40 +01:00
Mark Aron Szulyovszky 42a1bc59cb feat(Events): added EventFilter, EventLabeller (#186) 2022-01-26 23:22:43 +01:00
Mark Aron Szulyovszky 1042c82333 Update README.md 2022-01-26 22:06:40 +01:00
Mark Aron Szulyovszky e6e2317fe0 refactor(Training): use date indexes instead of integers, need this to prepare for Events (#185) 2022-01-24 12:22:30 +01:00
Mark Aron Szulyovszky e80fffdb65 refactor(Config): use a Config object instead of dictionary of dictionaries! (#184)
* refactor(Config): use a Config object instead of dictionary of dictionaries!

* fix(Config): use default_ensemble_config

* fix(Portfolio): fixed portfolio construction
2022-01-23 18:37:43 +01:00
Mark Aron Szulyovszky 5c4a5b0cf1 refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classification later) (#182)
* refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classes later)

* fix(Training): removed mistakenly left in `method` parameter
2022-01-23 17:15:08 +01:00
Daniel Szemerey 516c8bcc87 feat(Inference): Inference now runs on the entire pipeline, only train/predict one asset, adjust trading costs (#173)
* fix, feat: Fixed inference processing data. Add transformation attribute.

* feat: Added transformations step, refractored the loop to make more sense (divided the train and inference loop).

* feat: Truncated models over time and transformations over time. Fixed some typing aswell.

* fix: Fixed a number of out of array problems.

* feat: Inference now works!

* fix(Steps): runtime error not checking for None

* fix(Steps): preloaded transformers are not optional anymore, sped up training by temporary increasing the retrain_every

* fix(CI): disable ray memory monitoring

* refactor(Inference): removed truncate_models and replaced it with filling X with NaN until inference should start

* feat(Inference): added index_from parameter

* fix(Tests): walk_forward test

* refactor(Pipeline): only predict one asset

* refactor(Inference): removed select_models step, inference code moved to run_inference.py so it matches convention (similar to run_pipeline.py)

* fix(Evaluation): adjust transaction costs

* fix(Config): adjusted retrain_every

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2022-01-23 11:38:40 +01:00
Mark Aron Szulyovszky 6b26643ece feat(Transformations): replaced feature selection pre-processing step with online version (with cache) (#170)
* feat(Transformations): removed feature-selection pre-processing step completely

* fix(Core): removed unnecessary `original_X`

* fix(Transformations): use the X_expanding_window to transform subsequent data

* fix(RFE): should check for model correctly

* fix(Config): only re-train the model every 40 timestamp

* fix(MetaLabeling): pass in the correct X to meta-labeling step

* fix(Transformation): PCA should at least keep as many features as sliding_window_size

* feat(Transformations): cache transformations across the same asset

* fix(Tests): missing preloaded_transformations arg

* chore(Config): got rid of unnecessary 'classification_models' and 'regression_models' dictionary keys
2022-01-17 11:43:51 +01:00
Daniel Szemerey 31dc847be1 Feature(Speed): Python launches faster by conditionally importing models. (#169)
* feat: Added optional import of models.

* fix: Models weren't wrapped into abstract class, fixed it.

* chore: Deleted leftover comments.

* fix: Same merge commit as on remote.

* fix: System wasn't putting in RF because there was no differentiation between RF as regressor and RF as classificator.

* fix(Models): use the XGBoostModel wrapper

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2022-01-14 14:29:24 +01:00
Mark Aron Szulyovszky 797d45d036 feat(Inference): pipeline wired up (#171)
* feat: Basic pipeline extended.

* feat: Added conversion of model list to existing structure (model_name, model_in_time). Fixed loading of previous models and dicts.

* fix: Had an unfinished function.

* fix: Inference wasn't getting model_over_time. Now transformations are not getting it either yet.

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
2022-01-14 10:34:28 +01:00
Mark Aron Szulyovszky 4aefba33ea fix(Pipeline): remove PCA step that introduced clear lookahead bias (#164) 2022-01-13 12:11:38 +01:00
Mark Aron Szulyovszky 3c2a0d4247 refactor(Types): added nested types for Reporting (#162) 2022-01-13 09:21:07 +01:00
Mark Aron Szulyovszky 1856fcad22 feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference() (#161)
* feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference()

* fix(WalkForward): use Dataframes to call Transformation.fit_transform()

* feat(WalkForward): restored option for models to recieve unscaled data

* fix(Transformations): output DataFrame as expected

* fix(Tests): missing new property
2022-01-12 23:22:55 +01:00