From 2523c12c710f6f7f5865877fe78c6127c56ebd92 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Feb 2022 14:33:37 +0100 Subject: [PATCH] Small enhancements and notes --- freqtrade/exchange/exchange.py | 2 +- freqtrade/freqtradebot.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 90b63b57b..6213ecbff 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -499,7 +499,7 @@ class Exchange: # Note: ccxt has BaseCurrency/QuoteCurrency format for pairs if self.markets and pair not in self.markets: raise OperationalException( - f'Pair {pair} is not available on {self.name}. ' + f'Pair {pair} is not available on {self.name} {self.trading_mode.value}. ' f'Please remove {pair} from your whitelist.') # From ccxt Documentation: diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 0906276f9..39b404fd4 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -740,6 +740,9 @@ class FreqtradeBot(LoggingMixin): # in case of FOK the order may be filled immediately and fully elif order_status == 'closed': + # TODO-lev: Evaluate this. Why is setting stake_amount here necessary? + # it should never change in theory - and in case of leveraged orders, + # may be the leveraged amount. stake_amount = order['cost'] amount = safe_value_fallback(order, 'filled', 'amount') enter_limit_filled_price = safe_value_fallback(order, 'average', 'price') @@ -1288,6 +1291,7 @@ class FreqtradeBot(LoggingMixin): # * Check edge cases, we don't want to make leverage > 1.0 if we don't have to # * (for leverage modes which aren't isolated futures) + # TODO-lev: The below calculation needs to include leverage ... trade.stake_amount = trade.amount * trade.open_rate self.update_trade_state(trade, trade.open_order_id, corder)