Fix potential problem.

This commit is contained in:
Reigo Reinmets 2021-12-13 11:17:24 +02:00
parent 1362bd9626
commit 6f6e7467f5

View File

@ -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'],