def test_populates_sell_trend(result): dataframe = populate_sell_trend(populate_indicators(result)) assert 'sell' in dataframe.columns
def test_populates_buy_trend(result): dataframe = populate_buy_trend(populate_indicators(result)) assert 'buy' in dataframe.columns assert 'buy_price' in dataframe.columns
return dataframe # define paths base_path = os.path.join(os.path.expanduser('~'), 'freqtrade') ml_path = os.path.join(base_path, 'ml_dev') data_path = os.path.join(ml_path, 'data') # define exchange exchange = 'hitbtc' # load back in master = pd.read_csv( os.path.join('/Users/dan/python-hitbtc/data/master', 'master_ethbtc_1min_v2.csv')) # print(pd.to_datetime(master.date, format="%m/%d/%y %H:%M")) # master['date'] = pd.to_datetime(master.date, format="%m/%d/%y %H:%M") # populate indicators master = populate_indicators(master) # # get price percentage change at t+1 # percentage_change = (master['close'][entry + 1] - master['open'][entry + 1]) / master['open'][entry + 1] # print(percentage_change) # master['percent_change'][entry] = percentage_change # # save master # master.to_csv(os.path.join(data_path, exchange, 'master.csv'), index=False) master.to_csv(os.path.join(data_path, exchange, 'master_ethbtc_1min_v2.csv'), index=False)
def preprocess(tickerdata: Dict[str, List]) -> Dict[str, DataFrame]: """Creates a dataframe and populates indicators for given ticker data""" return { pair: populate_indicators(parse_ticker_dataframe(pair_data)) for pair, pair_data in tickerdata.items() }
def preprocess(backdata) -> Dict[str, DataFrame]: processed = {} for pair, pair_data in backdata.items(): processed[pair] = populate_indicators( parse_ticker_dataframe(pair_data)) return processed
def preprocess(tickerdata: Dict[str, List]) -> Dict[str, DataFrame]: """Creates a dataframe and populates indicators for given ticker data""" return {pair: populate_indicators(parse_ticker_dataframe(pair_data)) for pair, pair_data in tickerdata.items()}
def test_populates_sell_trend(result): dataframe = populate_sell_trend(populate_indicators(result)) assert 'sell' in dataframe.columns
def test_populates_buy_trend(result): dataframe = populate_buy_trend(populate_indicators(result)) assert 'buy' in dataframe.columns
while True: # check time t = datetime.utcnow() s = t.second m = t.minute if s == 0 and m % trade_interval == 0: # get OHLC candles period = 'M' + str(trade_interval) resp = hitbtc.get_candles(market, limit=1000, period=period) # parse response into data frame and add technical indicators df = parse_ticker_dataframe(resp, exchange_name='HitBTC') df = populate_indicators(df) # add ask, bid, and last ticker = hitbtc.get_tickers(market) df['ask'] = ticker['ask'] df['bid'] = ticker['bid'] df['last'] = ticker['last'] # save the last row of data frame file_name = list(str(df['date'][len(df) - 1])) file_name = "".join(file_name).replace(' ', '_').replace(':', '-') + '.csv' save_path = os.path.join(market_path, file_name) df.tail(1).to_csv(save_path, index=False) else: