From f72fb0ad04faa56b6a53f1e8f382bfeba7f05017 Mon Sep 17 00:00:00 2001 From: misagh Date: Mon, 1 Oct 2018 17:29:33 +0200 Subject: [PATCH] =?UTF-8?q?exchange=20=E2=80=9CNone=E2=80=9D=20condition?= =?UTF-8?q?=20removed=20as=20Edge=20is=20after=20Exchange=20anyway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- freqtrade/edge/__init__.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/freqtrade/edge/__init__.py b/freqtrade/edge/__init__.py index f07c34427..a452e3751 100644 --- a/freqtrade/edge/__init__.py +++ b/freqtrade/edge/__init__.py @@ -32,6 +32,7 @@ class Edge(): def __init__(self, config: Dict[str, Any], exchange=None) -> None: self.config = config + self.exchange = exchange self.strategy: IStrategy = StrategyResolver(self.config).strategy self.ticker_interval = self.strategy.ticker_interval self.tickerdata_to_dataframe = self.strategy.tickerdata_to_dataframe @@ -45,23 +46,11 @@ class Edge(): self._total_capital = self.edge_config.get('total_capital_in_stake_currency') self._allowed_risk = self.edge_config.get('allowed_risk') - ### - # - ### - if exchange is None: - self.config['exchange']['secret'] = '' - self.config['exchange']['password'] = '' - self.config['exchange']['uid'] = '' - self.config['dry_run'] = True - self.exchange = Exchange(self.config) - else: - self.exchange = exchange - self.fee = self.exchange.get_fee() def calculate(self) -> bool: pairs = self.config['exchange']['pair_whitelist'] - heartbeat = self.config['edge']['process_throttle_secs'] + heartbeat = self.edge_config.get('process_throttle_secs') if (self._last_updated is not None) and ( self._last_updated + heartbeat > arrow.utcnow().timestamp): @@ -318,7 +307,6 @@ class Edge(): result: list = [] open_trade_index = utf1st.find_1st(buy_column, 1, utf1st.cmp_equal) - # open_trade_index = np.argmax(buy_column == 1) # return empty if we don't find trade entry (i.e. buy==1) or # we find a buy but at the of array @@ -337,8 +325,6 @@ class Edge(): if stop_index == -1: stop_index = float('inf') - # stop_index = np.argmax((ohlc_columns[open_trade_index + 1:, 2] < stop_price) == True) - # Searching for the index where sell is hit sell_index = utf1st.find_1st(sell_column[open_trade_index + 1:], 1, utf1st.cmp_equal) @@ -346,8 +332,6 @@ class Edge(): if sell_index == -1: sell_index = float('inf') - # sell_index = np.argmax(sell_column[open_trade_index + 1:] == 1) - # Check if we don't find any stop or sell point (in that case trade remains open) # It is not interesting for Edge to consider it so we simply ignore the trade # And stop iterating as the party is over @@ -379,6 +363,8 @@ class Edge(): result.append(trade) + # Calling again the same function recursively but giving + # it a view of exit_index till the end of array return result + self._detect_stop_and_sell_points( buy_column[exit_index:], sell_column[exit_index:],