11 Commits

Author SHA1 Message Date
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 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 e6e2317fe0 refactor(Training): use date indexes instead of integers, need this to prepare for Events (#185) 2022-01-24 12:22:30 +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 2c03959315 feat(Reporting): added backtesting with vectorbt (#148)
* feat(Reporting): added vectorbt-based backtest

* fix(Reporting): added transaction costs

* feat(Reporting): added ability to rebalance only every n days

* feat(Dependencies): added pytorch

* fix(Dependencies): added pytorch-lightning

* feat(CI): added portfolio reporting step

* feat(Reporting): save weights as well

* fix(Reporting): start with less cash
2022-01-11 09:34:08 +01:00
Mark Aron Szulyovszky 73cfc67336 fix(Evaluation): correlation test should work on a per asset level, not per model level (#142)
* fix(Evaluation): correlation test should work on a per asset level, not per model level

* fix(Evaluation): correlations series initalized correctly

* fix(Reporting): don't name the run after the incorrectly supposed model_type

* fix(Reporting): put back send_report_to_wandb() into its original place

* fix(CI): sending reports again in comment
2022-01-10 14:17:06 +01:00
Mark Aron Szulyovszky f5bbc266a4 feat(Reporting): added robustness / correlation test (#138)
* feat(Evaluation): added robustness/correlation test

* feat(Reporting): saving correlations

* fix(Reporting): record correlations properly

* fix(Model): SVC's random seed

* feat(CI): store artifacts
2022-01-09 20:00:03 +01:00
Mark Aron Szulyovszky f8af5641e8 chore(Project): added output folder (#124)
* chore(Project): added output folder

* chore(CI): updated path

* fix(CI): correct path
2022-01-07 19:03:17 +01:00
Mark Aron Szulyovszky 9488e92597 feature(MetaLabeling): replaced previous non-functional Ensembling method with Meta-labeling method available for both lvl1 and lvl2 models (#110)
* feature(MetaLabeling): added hacky prototype

* fix(MetaLabeling): drop index until first valid X & y

* fix(MetaLabeling): transform both X & y before feature selection

* fix(MetaLabeling): got feature selection to work

* fix(MetaLabeling): correct values for meta_y

* feat(MetaLabeling): created predictions multiplied by bet sizes

* feat(Pipeline): print out averaged result

* fix(Evaluation): correctly deal with non-discretized data

* fix(Pipeline): use the right column names

* refactor(Pipeline): move out meta-labeling

* refactor(Pipeline): complete refactoring

* feat(CI): post results to PR

* fix(Pipeline): use the correct filename

* chore(Config): removed now redundant feature_selection flag

* feat(Models): added SVC

* fix(Pipeline): accidentally switched two return values

* feat(Sweep): prepared sweep_meta.yaml, moved report_results() into a separate file

* fix(Pipeline): wrong function name

* fix(Sweep): yaml + run_sweep

* fix(Sweep): typo in name

* fix(Reporting): only save averaged results

* feat(MetaLabeling): use optional meta-labeling step for every lvl1 models, before averaging

* feat(Reporting): print out sharpe improvement in meta-labeling step

* fix(Sweep): adjusted config, defaulted to good defaults

* fix(Sweep): adjusted sweep
2022-01-06 16:36:45 +01:00
Mark Aron Szulyovszky 0963df2087 refactor(Project): move out load_data to utils, rename fetch_data to run_fetch_data, got classifiers to work (#38) 2021-12-17 17:41:50 +01:00
Mark Aron Szulyovszky cc7061b456 feat(Core): ensemble models, correct forward returns calculation, scaling, only train from when asset returns are available, major bug fixed in walk_forward_train_test (#35)
* fix(Core): correct forward returns calculation, classifiers are now working again, only train from when asset returns are available

* feat(Utils): added get_first_valid_return_index()

* feat(Ensemble): return models from `run_whole_pipeline`

* feat(Ensemble): added ensemble step, fixed walk_forward_train_test predictions index confusion,

* chore(Pipeline): remove unnecessary extra ensemble results dataframe

* refactor(Core): removed unnecessary ensemble_train_predict, moved run_single_asset_trainig_pipeline to a separate file

* feat(Training): added scaling on expanding window (the past) to walk_forward_train_test(), now printing out mean sharpe ratio

* feat(CI): added environment.yml file

* chore(Environment): update env.yml

* feat(CI): added testing workflow

* fix(CI): renamed enviroment.yml

* fix(Tests): added missing new parameter to walk_forward_train_test()
2021-12-17 14:32:17 +01:00