filter pairs according to expectancy + bug at the end of array resolved

This commit is contained in:
misagh 2018-09-28 16:40:34 +02:00
parent f15825e3a7
commit c8d06e2b0e
4 changed files with 16 additions and 8 deletions

View File

@ -53,12 +53,14 @@
"edge": { "edge": {
"enabled": false, "enabled": false,
"process_throttle_secs": 1800, "process_throttle_secs": 1800,
"calculate_since_number_of_days": 14,
"total_capital_in_stake_currency": 0.5, "total_capital_in_stake_currency": 0.5,
"allowed_risk": 0.01, "allowed_risk": 0.01,
"stoploss_range_min": -0.01, "stoploss_range_min": -0.01,
"stoploss_range_max": -0.1, "stoploss_range_max": -0.1,
"stoploss_range_step": -0.001, "stoploss_range_step": -0.001,
"maximum_winrate": 0.80, "maximum_winrate": 0.80,
"minimum_expectancy": 0.20,
"min_trade_number": 15, "min_trade_number": 15,
"max_trade_duration_minute": 1440, "max_trade_duration_minute": 1440,
"remove_pumps": true, "remove_pumps": true,

View File

@ -154,11 +154,14 @@ class Edge():
info = [x for x in self._cached_pairs if x[0] == pair][0] info = [x for x in self._cached_pairs if x[0] == pair][0]
return info[1] return info[1]
def sort_pairs(self, pairs) -> list: def filter(self, pairs) -> list:
if len(self._cached_pairs) == 0: # Filtering pairs acccording to the expectancy
self.calculate() filtered_expectancy: list = []
edge_sorted_pairs = [x[0] for x in self._cached_pairs] filtered_expectancy = [x[0] for x in self._cached_pairs if x[5] > float(self.edge_config.get('minimum_expectancy', 0.2))]
return [x for _, x in sorted(zip(edge_sorted_pairs, pairs), key=lambda pair: pair[0])]
# Only return pairs which are included in "pairs" argument list
final = [x for x in filtered_expectancy if x in pairs]
return final
def _fill_calculable_fields(self, result: DataFrame): def _fill_calculable_fields(self, result: DataFrame):
""" """
@ -312,8 +315,9 @@ class Edge():
open_trade_index = utf1st.find_1st(buy_column, 1, utf1st.cmp_equal) open_trade_index = utf1st.find_1st(buy_column, 1, utf1st.cmp_equal)
# open_trade_index = np.argmax(buy_column == 1) # open_trade_index = np.argmax(buy_column == 1)
# return empty if we don't find trade entry (i.e. buy==1) # return empty if we don't find trade entry (i.e. buy==1) or
if open_trade_index == -1: # we find a buy but at the of array
if open_trade_index == -1 or open_trade_index == len(buy_column) - 1:
return [] return []
stop_price_percentage = stoploss + 1 stop_price_percentage = stoploss + 1

View File

@ -399,7 +399,7 @@ class FreqtradeBot(object):
# running get_signal on historical data fetched # running get_signal on historical data fetched
# to find buy signals # to find buy signals
if self.config['edge']['enabled']: if self.config['edge']['enabled']:
whitelist = self.edge.sort_pairs(whitelist) whitelist = self.edge.filter(whitelist)
for _pair in whitelist: for _pair in whitelist:
(buy, sell) = self.strategy.get_signal(_pair, interval, self.exchange.klines.get(_pair)) (buy, sell) = self.strategy.get_signal(_pair, interval, self.exchange.klines.get(_pair))

View File

@ -132,12 +132,14 @@ def default_conf():
"edge": { "edge": {
"enabled": False, "enabled": False,
"process_throttle_secs": 1800, "process_throttle_secs": 1800,
"calculate_since_number_of_days": 14,
"total_capital_in_stake_currency": 0.5, "total_capital_in_stake_currency": 0.5,
"allowed_risk": 0.01, "allowed_risk": 0.01,
"stoploss_range_min": -0.01, "stoploss_range_min": -0.01,
"stoploss_range_max": -0.1, "stoploss_range_max": -0.1,
"stoploss_range_step": -0.001, "stoploss_range_step": -0.001,
"maximum_winrate": 0.80, "maximum_winrate": 0.80,
"minimum_expectancy": 0.20,
"min_trade_number": 15, "min_trade_number": 15,
"max_trade_duration_minute": 1440, "max_trade_duration_minute": 1440,
"remove_pumps": True, "remove_pumps": True,