From 6f6e7467f5fc2c3f798c8e2e64551f15cd58e854 Mon Sep 17 00:00:00 2001 From: Reigo Reinmets Date: Mon, 13 Dec 2021 11:17:24 +0200 Subject: [PATCH] Fix potential problem. --- freqtrade/freqtradebot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 18a02c3bc..69dfe39a1 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -657,6 +657,9 @@ class FreqtradeBot(LoggingMixin): Sends rpc notification when a buy occurred. """ open_rate = safe_value_fallback(order, 'average', 'price') + if open_rate is None: + open_rate = trade.open_rate + msg = { 'trade_id': trade.id, 'type': RPCMessageType.BUY_FILL if fill else RPCMessageType.BUY, @@ -664,7 +667,7 @@ class FreqtradeBot(LoggingMixin): 'exchange': self.exchange.name.capitalize(), 'pair': trade.pair, 'limit': safe_value_fallback(order, 'average', 'price'), # Deprecated (?) - 'open_rate': open_rate or trade.open_rate, + 'open_rate': open_rate, 'order_type': order_type, 'stake_amount': trade.stake_amount, 'stake_currency': self.config['stake_currency'],