def fast_tf_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: if self.config['runmode'].value == 'hyperopt': for len in range(30, 91): dataframe[f'zema_{len}'] = ftt.zema(dataframe, period=len) else: dataframe[f'zema_{self.zema_len_buy.value}'] = ftt.zema(dataframe, period=self.zema_len_buy.value) dataframe[f'zema_{self.zema_len_sell.value}'] = ftt.zema(dataframe, period=self.zema_len_sell.value) dataframe[f'zema_buy'] = ftt.zema(dataframe, period=self.zema_len_buy.value) * self.low_offset.value dataframe[f'zema_sell'] = ftt.zema(dataframe, period=self.zema_len_sell.value) * self.high_offset.value return dataframe
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: length = 10 MAtype = 9 src_val = 2 multiplier = 3 dataframe['ZLEMA'] = zema(dataframe, period=length) dataframe = PMAX(dataframe, period=length, multiplier=multiplier, length=length, MAtype=MAtype, src=src_val) print(dataframe.keys) return dataframe
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: atrperiod = 10 multiplier = 3 matype = 9 malength = 10 source = 2 dataframe['ZLEMA'] = zema(dataframe, period=malength) dataframe = PMAX(dataframe, atrperiod=atrperiod, multiplier=multiplier, malength=malength, matype=matype, source=source) # print(dataframe.keys) return dataframe
def populate_indicators(dataframe: DataFrame, metadata: dict) -> DataFrame: """ This method can also be loaded from the strategy, if it doesn't exist in the hyperopt class. """ n = 0 length = 10 dframe = dataframe.copy() default = dataframe.copy() jobs = [] tuples = [] def thr(default, length, MAtype, multiplier, src_val, ns): DAT = PMAX(default, period=length, multiplier=multiplier, length=length, MAtype=MAtype, src=src_val) xdata = ns.df xdata[list(DAT.keys())[-1]] = DAT[list(DAT.keys())[-1]] ns.df = xdata mgr = multiprocessing.Manager() ns = mgr.Namespace() ns.df = dataframe print(dataframe.head()) def wrapper(mpobject): mpobject.start() mpobject.join() for length in range(2, 200): for MAtype in range(1, 8): for multiplier in range(1, 30): for src_val in range(1, 3): p = multiprocessing.Process(target=thr, args=(default, length, MAtype, multiplier, src_val, ns)) # p.start() # print(p.exitcode) # thr(default, length, MAtype, multiplier, src_val, ns) # jobs.append(p) # print(ns.df) # print(dataframe) jobs.append(p) # tuples.append(tuple([length, MAtype, multiplier, src_val, default])) # pool = multiprocessing.Pool(processes=16) # pool.map_async(wrapper, jobs) # pool.close() # pool.join() for process in jobs: th = threading.Thread(target=wrapper, args=(process, )) th.start() n = n + 1 if n == 512: th.join() n = 0 print(sys.getsizeof(ns.df)) dataframe = ns.df for i in range(2, 200): EMA = '' EMA = 'EMA' + str(i) dataframe[EMA] = zema(dataframe, period=length) return dataframe