Rename dry_run_order to create_dry_run_order
This commit is contained in:
parent
4996bd443e
commit
37c2e037f1
@ -52,7 +52,7 @@ class Binance(Exchange):
|
|||||||
'In stoploss limit order, stop price should be more than limit price')
|
'In stoploss limit order, stop price should be more than limit price')
|
||||||
|
|
||||||
if self._config['dry_run']:
|
if self._config['dry_run']:
|
||||||
dry_order = self.dry_run_order(
|
dry_order = self.create_dry_run_order(
|
||||||
pair, ordertype, "sell", amount, stop_price)
|
pair, ordertype, "sell", amount, stop_price)
|
||||||
return dry_order
|
return dry_order
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ class Exchange:
|
|||||||
# See also #2575 at github.
|
# See also #2575 at github.
|
||||||
return max(min_stake_amounts) * amount_reserve_percent
|
return max(min_stake_amounts) * amount_reserve_percent
|
||||||
|
|
||||||
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
def create_dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
||||||
rate: float, params: Dict = {}) -> Dict[str, Any]:
|
rate: float, params: Dict = {}) -> Dict[str, Any]:
|
||||||
order_id = f'dry_run_{side}_{datetime.now().timestamp()}'
|
order_id = f'dry_run_{side}_{datetime.now().timestamp()}'
|
||||||
_amount = self.amount_to_precision(pair, amount)
|
_amount = self.amount_to_precision(pair, amount)
|
||||||
@ -618,7 +618,7 @@ class Exchange:
|
|||||||
rate: float, time_in_force: str) -> Dict:
|
rate: float, time_in_force: str) -> Dict:
|
||||||
|
|
||||||
if self._config['dry_run']:
|
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
|
return dry_order
|
||||||
|
|
||||||
params = self._params.copy()
|
params = self._params.copy()
|
||||||
@ -631,7 +631,7 @@ class Exchange:
|
|||||||
rate: float, time_in_force: str = 'gtc') -> Dict:
|
rate: float, time_in_force: str = 'gtc') -> Dict:
|
||||||
|
|
||||||
if self._config['dry_run']:
|
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
|
return dry_order
|
||||||
|
|
||||||
params = self._params.copy()
|
params = self._params.copy()
|
||||||
|
@ -53,7 +53,7 @@ class Ftx(Exchange):
|
|||||||
stop_price = self.price_to_precision(pair, stop_price)
|
stop_price = self.price_to_precision(pair, stop_price)
|
||||||
|
|
||||||
if self._config['dry_run']:
|
if self._config['dry_run']:
|
||||||
dry_order = self.dry_run_order(
|
dry_order = self.create_dry_run_order(
|
||||||
pair, ordertype, "sell", amount, stop_price)
|
pair, ordertype, "sell", amount, stop_price)
|
||||||
return dry_order
|
return dry_order
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class Kraken(Exchange):
|
|||||||
stop_price = self.price_to_precision(pair, stop_price)
|
stop_price = self.price_to_precision(pair, stop_price)
|
||||||
|
|
||||||
if self._config['dry_run']:
|
if self._config['dry_run']:
|
||||||
dry_order = self.dry_run_order(
|
dry_order = self.create_dry_run_order(
|
||||||
pair, ordertype, "sell", amount, stop_price)
|
pair, ordertype, "sell", amount, stop_price)
|
||||||
return dry_order
|
return dry_order
|
||||||
|
|
||||||
|
@ -931,11 +931,11 @@ def test_exchange_has(default_conf, mocker):
|
|||||||
("sell")
|
("sell")
|
||||||
])
|
])
|
||||||
@pytest.mark.parametrize("exchange_name", EXCHANGES)
|
@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
|
default_conf['dry_run'] = True
|
||||||
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
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)
|
pair='ETH/BTC', ordertype='limit', side=side, amount=1, rate=200)
|
||||||
assert 'id' in order
|
assert 'id' in order
|
||||||
assert f'dry_run_{side}_' in order["id"]
|
assert f'dry_run_{side}_' in order["id"]
|
||||||
|
Loading…
Reference in New Issue
Block a user