Merge pull request #2651 from freqtrade/dry_amount
Round amount to precision also for dry-runs
This commit is contained in:
commit
6c4f424887
@ -379,15 +379,16 @@ class Exchange:
|
|||||||
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
def 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}_{randint(0, 10**6)}'
|
order_id = f'dry_run_{side}_{randint(0, 10**6)}'
|
||||||
|
_amount = self.symbol_amount_prec(pair, amount)
|
||||||
dry_order = {
|
dry_order = {
|
||||||
"id": order_id,
|
"id": order_id,
|
||||||
'pair': pair,
|
'pair': pair,
|
||||||
'price': rate,
|
'price': rate,
|
||||||
'amount': amount,
|
'amount': _amount,
|
||||||
"cost": amount * rate,
|
"cost": _amount * rate,
|
||||||
'type': ordertype,
|
'type': ordertype,
|
||||||
'side': side,
|
'side': side,
|
||||||
'remaining': amount,
|
'remaining': _amount,
|
||||||
'datetime': arrow.utcnow().isoformat(),
|
'datetime': arrow.utcnow().isoformat(),
|
||||||
'status': "closed" if ordertype == "market" else "open",
|
'status': "closed" if ordertype == "market" else "open",
|
||||||
'fee': None,
|
'fee': None,
|
||||||
|
@ -786,7 +786,10 @@ def test_process_trade_no_whitelist_pair(default_conf, ticker, limit_buy_order,
|
|||||||
)
|
)
|
||||||
freqtrade = FreqtradeBot(default_conf)
|
freqtrade = FreqtradeBot(default_conf)
|
||||||
patch_get_signal(freqtrade)
|
patch_get_signal(freqtrade)
|
||||||
pair = 'NOCLUE/BTC'
|
pair = 'BLK/BTC'
|
||||||
|
# Ensure the pair is not in the whitelist!
|
||||||
|
assert pair not in default_conf['exchange']['pair_whitelist']
|
||||||
|
|
||||||
# create open trade not in whitelist
|
# create open trade not in whitelist
|
||||||
Trade.session.add(Trade(
|
Trade.session.add(Trade(
|
||||||
pair=pair,
|
pair=pair,
|
||||||
|
Loading…
Reference in New Issue
Block a user