Rename dry_run_order to create_dry_run_order

This commit is contained in:
Matthias 2021-04-10 13:50:56 +02:00
parent 4996bd443e
commit 37c2e037f1
5 changed files with 9 additions and 9 deletions

View File

@ -52,7 +52,7 @@ class Binance(Exchange):
'In stoploss limit order, stop price should be more than limit price')
if self._config['dry_run']:
dry_order = self.dry_run_order(
dry_order = self.create_dry_run_order(
pair, ordertype, "sell", amount, stop_price)
return dry_order

View File

@ -543,8 +543,8 @@ class Exchange:
# See also #2575 at github.
return max(min_stake_amounts) * amount_reserve_percent
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
rate: float, params: Dict = {}) -> Dict[str, Any]:
def create_dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
rate: float, params: Dict = {}) -> Dict[str, Any]:
order_id = f'dry_run_{side}_{datetime.now().timestamp()}'
_amount = self.amount_to_precision(pair, amount)
dry_order = {
@ -618,7 +618,7 @@ class Exchange:
rate: float, time_in_force: str) -> Dict:
if self._config['dry_run']:
dry_order = self.dry_run_order(pair, ordertype, "buy", amount, rate)
dry_order = self.create_dry_run_order(pair, ordertype, "buy", amount, rate)
return dry_order
params = self._params.copy()
@ -631,7 +631,7 @@ class Exchange:
rate: float, time_in_force: str = 'gtc') -> Dict:
if self._config['dry_run']:
dry_order = self.dry_run_order(pair, ordertype, "sell", amount, rate)
dry_order = self.create_dry_run_order(pair, ordertype, "sell", amount, rate)
return dry_order
params = self._params.copy()

View File

@ -53,7 +53,7 @@ class Ftx(Exchange):
stop_price = self.price_to_precision(pair, stop_price)
if self._config['dry_run']:
dry_order = self.dry_run_order(
dry_order = self.create_dry_run_order(
pair, ordertype, "sell", amount, stop_price)
return dry_order

View File

@ -92,7 +92,7 @@ class Kraken(Exchange):
stop_price = self.price_to_precision(pair, stop_price)
if self._config['dry_run']:
dry_order = self.dry_run_order(
dry_order = self.create_dry_run_order(
pair, ordertype, "sell", amount, stop_price)
return dry_order

View File

@ -931,11 +931,11 @@ def test_exchange_has(default_conf, mocker):
("sell")
])
@pytest.mark.parametrize("exchange_name", EXCHANGES)
def test_dry_run_order(default_conf, mocker, side, exchange_name):
def test_create_dry_run_order(default_conf, mocker, side, exchange_name):
default_conf['dry_run'] = True
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
order = exchange.dry_run_order(
order = exchange.create_dry_run_order(
pair='ETH/BTC', ordertype='limit', side=side, amount=1, rate=200)
assert 'id' in order
assert f'dry_run_{side}_' in order["id"]