text
stringlengths
1
93.6k
top[0].data[0]=np.sum(dice)
def backward(self, top, propagate_down, bottom):
for btm in [0]:
prob = bottom[0].data[...]
bottom[btm].diff[...] = np.zeros(bottom[btm].diff.shape, dtype=np.float32)
for i in range(0, bottom[btm].diff.shape[0]):
bottom[btm].diff[i, 0, :] += 2.0 * (
(self.gt[i, :] * self.union[i]) / ((self.union[i]) ** 2) - 2.0*prob[i,1,:]*(self.intersection[i]) / (
(self.union[i]) ** 2))
bottom[btm].diff[i, 1, :] -= 2.0 * (
(self.gt[i, :] * self.union[i]) / ((self.union[i]) ** 2) - 2.0*prob[i,1,:]*(self.intersection[i]) / (
(self.union[i]) ** 2))
# <FILESEP>
"""
https://github.com/raph92?tab=repositories
"""
import logging
# --- Do not remove these libs ---
import sys
from functools import reduce
from pathlib import Path
import freqtrade.vendor.qtpylib.indicators as qtpylib
import talib.abstract as ta
from freqtrade.constants import ListPairsWithTimeframes
from freqtrade.strategy import (
IntParameter,
DecimalParameter,
merge_informative_pair,
)
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
sys.path.append(str(Path(__file__).parent))
logger = logging.getLogger(__name__)
class Gumbo1(IStrategy):
# region Parameters
ewo_low = DecimalParameter(-20.0, 1, default=0, space="buy", optimize=True)
t3_periods = IntParameter(5, 20, default=5, space="buy", optimize=True)
stoch_high = IntParameter(60, 100, default=80, space="sell", optimize=True)
stock_periods = IntParameter(70, 90, default=80, space="sell", optimize=True)
# endregion
# region Params
minimal_roi = {"0": 0.10, "20": 0.05, "64": 0.03, "168": 0}
stoploss = -0.25
# endregion
timeframe = '5m'
use_custom_stoploss = False
inf_timeframe = '1h'
# Recommended
use_sell_signal = True
sell_profit_only = False
ignore_roi_if_buy_signal = True
startup_candle_count = 200
def informative_pairs(self) -> ListPairsWithTimeframes:
pairs = self.dp.current_whitelist()
informative_pairs = [(pair, '1h') for pair in pairs]
return informative_pairs
def populate_informative_indicators(self, dataframe: DataFrame, metadata):
informative = self.dp.get_pair_dataframe(
pair=metadata['pair'], timeframe=self.inf_timeframe
)
# t3 from custom_indicators
informative['T3'] = T3(informative)
# bollinger bands
bbands = ta.BBANDS(informative, timeperiod=20)
informative['bb_lowerband'] = bbands['lowerband']
informative['bb_middleband'] = bbands['middleband']
informative['bb_upperband'] = bbands['upperband']
dataframe = merge_informative_pair(
dataframe, informative, self.timeframe, self.inf_timeframe
)
return dataframe
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# ewo
dataframe['EWO'] = EWO(dataframe)
# ema
dataframe['EMA'] = ta.EMA(dataframe)
# t3
for i in self.t3_periods.range:
dataframe[f'T3_{i}'] = T3(dataframe, i)
# bollinger bands 40
bbands = ta.BBANDS(dataframe, timeperiod=40)
dataframe['bb_lowerband_40'] = bbands['lowerband']
dataframe['bb_middleband_40'] = bbands['middleband']