33 Commits

Author SHA1 Message Date
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 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 5b7bcbb5e9 fix(DataLoader): sort the data before merging (this corrupted the pipeline completely) 2022-03-12 22:22:10 +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 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 cfb65c135e feat(Pipeline): added multi-asset pipeline, ensembling_method to config 2022-02-19 15:37:19 +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 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 42a1bc59cb feat(Events): added EventFilter, EventLabeller (#186) 2022-01-26 23:22:43 +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
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 4aefba33ea fix(Pipeline): remove PCA step that introduced clear lookahead bias (#164) 2022-01-13 12:11:38 +01:00
Daniel Szemerey 3084f5e271 Refractor(Main Pipeline): Refractored the two main steps and the data processing. (#156)
* refr: Took out main primary and secondary loops and data processing.

* feat: Tidied the code up.

* feat: Saving models and results now works in a type safe way.

* fix: There was error in the saving function.

* chore: Took out some remaining comments.

* fix: Fixed the previous data checking process.

* feat: Fixed model selection method. I will continue the inference after we merged.

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
2022-01-12 23:10:18 +01:00
Daniel Szemerey 55f083638f feature(Inference): Created the inference process, added model saving. (#153)
* feat: Basic scaffolding up for inference process after training.

* feat: Saving and loading models works. Inference works nearly.

* feat: Added inference pipeline.

* feat: Saving model now accoring to date and time; loading models now selects from latest file. Fixed the creation of dictionary of models.

* feat: Added lightweight asset config, but full pipeline.

* feat: Added new naming for dictionary.

* fix: Fixed dictionary naming convention.

* fix: Fixed naming again, now the model structure is good

* fix: Changed the output path and the return values from run_pipeline.

* feat: Added function to make sure folder exists for output models.

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
2022-01-11 19:15:58 +01:00
Mark Aron Szulyovszky 22b3167cb9 feat(Evaluate): increase transactions costs, to get a more realistic view on performance (#137) 2022-01-09 14:18:20 +01:00
Mark Aron Szulyovszky fc5eba4e2d feat(Models): added lightGBM, moved other models to separate files (#128)
* feat(Models): added lightGBM, moved other models to separate files

* feat(Models): added non-working statsmodel wrapper

* fix(Models): added work-in-progress comment to StatsModels
2022-01-08 12:02:42 +01:00
Mark Aron Szulyovszky 81c217a401 feat(Portfolio): reporting MVP (#108)
* feat(DataLoader): added load_only_returns() method

* feat(Portfolio): load predictions

* feat(Portfolio): normalize weights

* feat(Portfolio): started integrating with portfoliobt

* feat(Portfolio): include fees in the portfolio construction

* feat(Portfolio): demo of pyportfolioopt

* feat(Portfolio): get efficient frontier calculation to work

* feat(Portfolio): add a few strategies to create weights

* chore(Dependencies): remove pyportfolioopt for now

* fix(Dependencies): try to install all dependencies with pip

* fix(Dependencies): indentation

* fix(Dependencies): corrected pytorch module name

* fix(Dependencies): try to have as many modules installed by conda for the sake of sanity?

* fix(Dependencies): put fracdiff into pip modules

* fix(Dependencies): revert to using pip almost exclusively

* feat(Portfolio): added alphalens

* fix(Portfolio): got limited weights working

* feat(Portfolio): trying to get alphalens to work

* feat(Portfolio): alphalens working

* fix(Dependencies): removed vectorbt

* fix(Dependencies): use alphalens-reloaded

* fix(Dependencies): added conda source for alphalens-reloaded

* refactor(Portfolio): removed traces of vectorbt

* feat(Reporting): factor reporting done

* feat(Portfolio): added pyfolio reporting (fails bc alphalens is not working properly lol)
2022-01-08 00:05:36 +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
Daniel Szemerey ee35332f58 feature(Models): Implemented a basic Neural Network with Pytorch-Lightning (#101)
* feat: Added base functions for Neural Net.

* feat: Added function to handle Neural Nets.

* fix: Fixed fit loop

* feat: Neural Net trains now, need to test it.

* feat: Prediction now works on the neural net.

* fix: Put back config and run_pipeline.py

* fix: Took out import from run_pipeline.

* fix(Models): added get_name(), adjusted pytorch model output size

* fix(Tests): fixed tests

Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2022-01-05 12:25:03 +01:00
Mark Aron Szulyovszky 1cd0119589 feat(DataLoader): caching MVP, added ability to use standard scaling for exogenous data, scaling is now also done before feature selection (#105)
* fix(FeatureExtractor): apply log to transform some series to normality

* feat(DataLoader): add ability of not returning returns when they're not needed (exogenous data), applied log to certain features

* feat(FeatureExtractors): added standard scaling for exogenous data

* feat(FeatureSelection): scale data with the passed in scaler before doing feature-selection

* fix(Config): sweep config

* feat(Models): output probability, store it

* feat(Core): added caching to select_features() and load_data()

* fix(Dependencies): added diskcache

* fix(Training): error when creating results DF

* feat(Models): added xgboost, fixed tests

* refactor(Cache): moved hashing to a separate function, created wrapper functions to separate business logic and caching

* fix(Tests): new syntax

* fix(Model): XGboost can't handle -1 class, so we'll use the deprecated label_encoder fornow

* fix(Model): XGBoost config

* feat(Cache): add run_clear_cache script

* fix(Pipeline) accidentally re-instatiating all_predictions for each asset
2022-01-04 11:44:35 +01:00
Mark Aron Szulyovszky 867269df2b feat(Data): added daily_glassnode DataCollection (#99) 2022-01-03 13:57:36 +01:00
Mark Aron Szulyovszky 442915f847 feat(Data): create DataSource, DataCollection, added hourly crypto data (#96)
* feat(Data): create DataSource, DataCollection, added hourly crypto data

* fix(Data): hourly data format, loading & config
2021-12-31 19:04:27 +01:00