From 444d18aa39cd7d143a152fa7d17ac79be3726a19 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 26 Mar 2023 14:30:29 +0200 Subject: [PATCH] Revert binance PO fix, since ccxt has fixed this bug. --- freqtrade/exchange/binance.py | 21 --------------------- tests/exchange/test_binance.py | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index a89c02631..7ac496f62 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -7,7 +7,6 @@ from typing import Dict, List, Optional, Tuple import arrow import ccxt -from freqtrade.constants import BuySell from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError from freqtrade.exchange import Exchange @@ -49,26 +48,6 @@ class Binance(Exchange): (TradingMode.FUTURES, MarginMode.ISOLATED) ] - def _get_params( - self, - side: BuySell, - ordertype: str, - leverage: float, - reduceOnly: bool, - time_in_force: str = 'GTC', - ) -> Dict: - params = super()._get_params(side, ordertype, leverage, reduceOnly, time_in_force) - if ( - time_in_force == 'PO' - and ordertype != 'market' - and self.trading_mode == TradingMode.SPOT - # Only spot can do post only orders - ): - params.pop('timeInForce') - params['postOnly'] = True - - return params - def get_tickers(self, symbols: Optional[List[str]] = None, cached: bool = False) -> Tickers: tickers = super().get_tickers(symbols=symbols, cached=cached) if self.trading_mode == TradingMode.FUTURES: diff --git a/tests/exchange/test_binance.py b/tests/exchange/test_binance.py index 273860e15..fda33b859 100644 --- a/tests/exchange/test_binance.py +++ b/tests/exchange/test_binance.py @@ -15,8 +15,8 @@ from tests.exchange.test_exchange import ccxt_exceptionhandlers ('buy', 'limit', 'gtc', {'timeInForce': 'GTC'}), ('buy', 'limit', 'IOC', {'timeInForce': 'IOC'}), ('buy', 'market', 'IOC', {}), - ('buy', 'limit', 'PO', {'postOnly': True}), - ('sell', 'limit', 'PO', {'postOnly': True}), + ('buy', 'limit', 'PO', {'timeInForce': 'PO'}), + ('sell', 'limit', 'PO', {'timeInForce': 'PO'}), ('sell', 'market', 'PO', {}), ]) def test__get_params_binance(default_conf, mocker, side, type, time_in_force, expected):