Kismuz / btgym

Scalable, event-driven, deep-learning-friendly backtesting library
https://kismuz.github.io/btgym/
GNU Lesser General Public License v3.0
988 stars 261 forks source link

loading multiple features - question ? #126

Closed 123mitnik closed 4 years ago

123mitnik commented 4 years ago

Is it possible to load and train on additional exogenous data features (in addition to the OHLCV data) - for example technical indicators, sentiment analysis etc... I checked the data and example folders and also the docs but i can't find how to train with additional features (I have some 255 and more to load).

And one additional question. Is it possible to save the model and later to load it and continue training / or switch to testing mode directly and feed the environment with single step data and get the prediction; I.e how to switch from training to prediction with real data fed from the exchange.

If there is a notebook for this it would be awesome.

123mitnik commented 4 years ago

I've found that I can resume the training with

launcher.export_checkpoint(os.path.expanduser('~/tmp/pre_trained_model/test_4_11'))

but still struggling training with additional features.

I've found this example inside the docs :

1. Four data streams added via Dataset.data_config,
   portfolio consists of four assets, added via strategy_params, cash is EUR:

    data_config = {
        'usd': {'filename': '.../DAT_ASCII_EURUSD_M1_2017.csv'},
        'gbp': {'filename': '.../DAT_ASCII_EURGBP_M1_2017.csv'},
        'jpy': {'filename': '.../DAT_ASCII_EURJPY_M1_2017.csv'},
        'chf': {'filename': '.../DAT_ASCII_EURCHF_M1_2017.csv'},
    }
    cash_name = 'eur'
    assets_names = ['usd', 'gbp', 'jpy', 'chf']

2. Three streams added, only two of them form portfolio; DXY stream is `decision-making` only:
    data_config = {
        'usd': {'filename': '.../DAT_ASCII_EURUSD_M1_2017.csv'},
        'gbp': {'filename': '.../DAT_ASCII_EURGBP_M1_2017.csv'},
        '​DXY': {'filename': '.../DAT_ASCII_DXY_M1_2017.csv'},
    }
    cash_name = 'eur'
    assets_names = ['usd', 'gbp']

where DXY stream is decision-making only - what is the DXY stream format. Can I load all me features data with the following ASCII format: timestamp, f1, f2 ..... fx. Or I should load every feature as a separate stream.

And after the model is trained how to create the predictions i.e. how to pass single observation and get the best prediction of what action I should take given my previously trained model (also I guess there is some exploration randomness for the gym //at least for the final training episode// which must be set to 0 in order to make sure that you get persistent results from the model)

Thank You !

Kismuz commented 4 years ago

@123mitnik , see #8, #32, #40 and https://github.com/Kismuz/btgym/wiki/FRAMEWORK-DEVELOPMENT#data-input-pipe

Kismuz commented 4 years ago

Closed due to long inactivity period.