added signal hypers notebooks

This commit is contained in:
Mark 2022-06-03 18:11:44 +03:00
parent 331592bfd0
commit 89a2fede6a
2 changed files with 6216 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,90 @@
#!/usr/bin/env python
# coding: utf-8
# This notebook is designed for ray integrations for signals
#
# lets load askbid candlesticks file.
# In[20]:
import market_trade.constants
import market_trade.dataloader
candlesticks_filepaths = [filepath for filepath in market_trade.constants.CANDLESTICK_DATASETS_PATH.iterdir()]
candlesticks_filepath = candlesticks_filepaths[0]
duka_interface = market_trade.dataloader.DukaMTInterface(candlesticks_filepath)
duka_interface.bid_candlesticks
# Let's test signal.
# In[21]:
import market_trade.signals.Signal1
bid_candlesticks_df = duka_interface.bid_candlesticks[:10000]
ind_params = {'MeanType': 'SMA', 'window': 5, 'valueType': 'low', 'kDev': 2}
indEl1 = {
'df': bid_candlesticks_df,
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
signal_result = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
signal_result.analiz
# Now let's design ray trainable.
# In[22]:
def trainable(config):
ind_params = {'MeanType': 'SMA',
'window': config['window'],
'valueType': config['value_type'],
'kDev': config['k_dev']}
indEl1 = {
'df': bid_candlesticks_df,
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
signal_result = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
tune.report(accuracy=signal_result.analiz["toch"])
# Let's create config space.
# In[23]:
from ray import tune
config = {
'window': tune.qrandint(5,100,5),
'value_type': tune.choice(['open', 'low', 'high', 'close']),
'k_dev': tune.uniform(1,4)
}
# Let's run ray tune
# In[24]:
analysis = tune.run(trainable, config=config, num_samples=100, mode='max', metric='accuracy')
# Let's see who was the best
# In[31]:
analysis.best_config