Merge pull request #6670 from freqtrade/store_asset

store base and quote currency separately in the database
This commit is contained in:
Matthias
2022-04-10 08:42:28 +02:00
committed by GitHub
12 changed files with 62 additions and 18 deletions

View File

@@ -52,7 +52,8 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
assert results[0] == {
'trade_id': 1,
'pair': 'ETH/BTC',
'base_currency': 'BTC',
'base_currency': 'ETH',
'quote_currency': 'BTC',
'open_date': ANY,
'open_timestamp': ANY,
'is_open': ANY,
@@ -135,7 +136,8 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
assert results[0] == {
'trade_id': 1,
'pair': 'ETH/BTC',
'base_currency': 'BTC',
'base_currency': 'ETH',
'quote_currency': 'BTC',
'open_date': ANY,
'open_timestamp': ANY,
'is_open': ANY,

View File

@@ -931,6 +931,8 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short,
'open_order': None,
'open_rate': 0.123,
'pair': 'ETH/BTC',
'base_currency': 'ETH',
'quote_currency': 'BTC',
'stake_amount': 0.001,
'stop_loss_abs': ANY,
'stop_loss_pct': ANY,
@@ -1097,7 +1099,7 @@ def test_api_force_entry(botclient, mocker, fee, endpoint):
# Test creating trade
fbuy_mock = MagicMock(return_value=Trade(
pair='ETH/ETH',
pair='ETH/BTC',
amount=1,
amount_requested=1,
exchange='binance',
@@ -1130,7 +1132,9 @@ def test_api_force_entry(botclient, mocker, fee, endpoint):
'open_date': ANY,
'open_timestamp': ANY,
'open_rate': 0.245441,
'pair': 'ETH/ETH',
'pair': 'ETH/BTC',
'base_currency': 'ETH',
'quote_currency': 'BTC',
'stake_amount': 1,
'stop_loss_abs': None,
'stop_loss_pct': None,

View File

@@ -184,7 +184,8 @@ def test_telegram_status(default_conf, update, mocker) -> None:
_rpc_trade_status=MagicMock(return_value=[{
'trade_id': 1,
'pair': 'ETH/BTC',
'base_currency': 'BTC',
'base_currency': 'ETH',
'quote_currency': 'BTC',
'open_date': arrow.utcnow(),
'close_date': None,
'open_rate': 1.099e-05,

View File

@@ -1561,6 +1561,8 @@ def test_to_json(fee):
assert result == {'trade_id': None,
'pair': 'ADA/USDT',
'base_currency': 'ADA',
'quote_currency': 'USDT',
'is_open': None,
'open_date': trade.open_date.strftime("%Y-%m-%d %H:%M:%S"),
'open_timestamp': int(trade.open_date.timestamp() * 1000),
@@ -1637,6 +1639,8 @@ def test_to_json(fee):
assert result == {'trade_id': None,
'pair': 'XRP/BTC',
'base_currency': 'XRP',
'quote_currency': 'BTC',
'open_date': trade.open_date.strftime("%Y-%m-%d %H:%M:%S"),
'open_timestamp': int(trade.open_date.timestamp() * 1000),
'close_date': trade.close_date.strftime("%Y-%m-%d %H:%M:%S"),