Skip to content

Commit

Permalink
Implement log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Feb 22, 2020
1 parent 97e6e5e commit 77ef324
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions freqtrade/freqtradebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,10 @@ def get_buy_rate(self, pair: str, refresh: bool) -> float:
:return: float: Price
"""
if not refresh:
rate = self._sell_rate_cache.get(pair)
rate = self._buy_rate_cache.get(pair)
# Check if cache has been invalidated
if rate:
logger.info(f"Using cached buy rate for {pair}.")
return rate

config_bid_strategy = self.config.get('bid_strategy', {})
Expand Down Expand Up @@ -577,7 +578,7 @@ def _notify_buy_cancel(self, trade: Trade, order_type: str) -> None:
"""
Sends rpc notification when a buy cancel occured.
"""
current_rate = self.get_buy_rate(trade.pair, True)
current_rate = self.get_buy_rate(trade.pair, False)

msg = {
'type': RPCMessageType.BUY_CANCEL_NOTIFICATION,
Expand Down Expand Up @@ -640,6 +641,7 @@ def get_sell_rate(self, pair: str, refresh: bool) -> float:
rate = self._sell_rate_cache.get(pair)
# Check if cache has been invalidated
if rate:
logger.info(f"Using cached sell rate for {pair}.")
return rate

config_ask_strategy = self.config.get('ask_strategy', {})
Expand Down Expand Up @@ -1078,7 +1080,7 @@ def _notify_sell_cancel(self, trade: Trade, order_type: str) -> None:
"""
profit_rate = trade.close_rate if trade.close_rate else trade.close_rate_requested
profit_trade = trade.calc_profit(rate=profit_rate)
current_rate = self.get_sell_rate(trade.pair, True)
current_rate = self.get_sell_rate(trade.pair, False)
profit_percent = trade.calc_profit_ratio(profit_rate)
gain = "profit" if profit_percent > 0 else "loss"

Expand Down

0 comments on commit 77ef324

Please sign in to comment.