Export amount/price precisions per trade

This commit is contained in:
Matthias 2023-03-25 11:42:19 +01:00
parent 4053ee4581
commit 9c6a49436b
3 changed files with 141 additions and 121 deletions

View File

@ -560,6 +560,9 @@ class LocalTrade():
'trading_mode': self.trading_mode, 'trading_mode': self.trading_mode,
'funding_fees': self.funding_fees, 'funding_fees': self.funding_fees,
'open_order_id': self.open_order_id, 'open_order_id': self.open_order_id,
'amount_precision': self.amount_precision,
'price_precision': self.price_precision,
'precision_mode': self.precision_mode,
'orders': orders, 'orders': orders,
} }

View File

@ -1330,12 +1330,16 @@ def test_to_json(fee):
open_rate=0.123, open_rate=0.123,
exchange='binance', exchange='binance',
enter_tag=None, enter_tag=None,
open_order_id='dry_run_buy_12345' open_order_id='dry_run_buy_12345',
precision_mode=1,
amount_precision=8.0,
price_precision=7.0,
) )
result = trade.to_json() result = trade.to_json()
assert isinstance(result, dict) assert isinstance(result, dict)
assert result == {'trade_id': None, assert result == {
'trade_id': None,
'pair': 'ADA/USDT', 'pair': 'ADA/USDT',
'base_currency': 'ADA', 'base_currency': 'ADA',
'quote_currency': 'USDT', 'quote_currency': 'USDT',
@ -1393,6 +1397,9 @@ def test_to_json(fee):
'is_short': None, 'is_short': None,
'trading_mode': None, 'trading_mode': None,
'funding_fees': None, 'funding_fees': None,
'amount_precision': 8.0,
'price_precision': 7.0,
'precision_mode': 1,
'orders': [], 'orders': [],
} }
@ -1410,11 +1417,15 @@ def test_to_json(fee):
close_rate=0.125, close_rate=0.125,
enter_tag='buys_signal_001', enter_tag='buys_signal_001',
exchange='binance', exchange='binance',
precision_mode=2,
amount_precision=7.0,
price_precision=8.0,
) )
result = trade.to_json() result = trade.to_json()
assert isinstance(result, dict) assert isinstance(result, dict)
assert result == {'trade_id': None, assert result == {
'trade_id': None,
'pair': 'XRP/BTC', 'pair': 'XRP/BTC',
'base_currency': 'XRP', 'base_currency': 'XRP',
'quote_currency': 'BTC', 'quote_currency': 'BTC',
@ -1472,6 +1483,9 @@ def test_to_json(fee):
'is_short': None, 'is_short': None,
'trading_mode': None, 'trading_mode': None,
'funding_fees': None, 'funding_fees': None,
'amount_precision': 7.0,
'price_precision': 8.0,
'precision_mode': 2,
'orders': [], 'orders': [],
} }

View File

@ -88,6 +88,9 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'is_short': False, 'is_short': False,
'funding_fees': 0.0, 'funding_fees': 0.0,
'trading_mode': TradingMode.SPOT, 'trading_mode': TradingMode.SPOT,
'amount_precision': 8.0,
'price_precision': 8.0,
'precision_mode': 2,
'orders': [{ 'orders': [{
'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05, 'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05,
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy', 'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',