Adding the pair name when populating indicators allowing the strategy to have customized context for a pair
This commit is contained in:
@@ -91,7 +91,7 @@ def tickerdata_to_dataframe(data):
|
||||
|
||||
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))
|
||||
return {pair: populate_indicators(parse_ticker_dataframe(pair_data), pair)
|
||||
for pair, pair_data in tickerdata.items()}
|
||||
|
||||
|
||||
|
@@ -117,7 +117,7 @@ def backtest(args) -> DataFrame:
|
||||
exchange._API = Bittrex({'key': '', 'secret': ''})
|
||||
for pair, pair_data in processed.items():
|
||||
pair_data['buy'], pair_data['sell'] = 0, 0
|
||||
ticker = populate_sell_trend(populate_buy_trend(pair_data))
|
||||
ticker = populate_sell_trend(populate_buy_trend(pair_data, pair), pair)
|
||||
# for each buy point
|
||||
lock_pair_until = None
|
||||
headers = ['buy', 'open', 'close', 'date', 'sell']
|
||||
|
@@ -61,7 +61,7 @@ TRIALS = Trials()
|
||||
main._CONF = OPTIMIZE_CONFIG
|
||||
|
||||
|
||||
def populate_indicators(dataframe: DataFrame) -> DataFrame:
|
||||
def populate_indicators(dataframe: DataFrame, pair: str) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
"""
|
||||
@@ -320,7 +320,7 @@ def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by hyperopt
|
||||
"""
|
||||
def populate_buy_trend(dataframe: DataFrame) -> DataFrame:
|
||||
def populate_buy_trend(dataframe: DataFrame, pair: str) -> DataFrame:
|
||||
conditions = []
|
||||
# GUARDS AND TRENDS
|
||||
if 'uptrend_long_ema' in params and params['uptrend_long_ema']['enabled']:
|
||||
|
Reference in New Issue
Block a user