Improve performance of some RPC calls
These don't need orders to be loaded. As a side-effect, this will also reduce the strain on the database.
This commit is contained in:
@@ -2075,6 +2075,24 @@ def test_get_trades_proxy(fee, use_db, is_short):
|
||||
Trade.use_db = True
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_persistence")
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
def test_get_trades__query(fee, is_short):
|
||||
query = Trade.get_trades([])
|
||||
# without orders there should be no join issued.
|
||||
query1 = Trade.get_trades([], include_orders=False)
|
||||
|
||||
assert "JOIN orders" in str(query)
|
||||
assert "JOIN orders" not in str(query1)
|
||||
|
||||
create_mock_trades(fee, is_short)
|
||||
query = Trade.get_trades([])
|
||||
query1 = Trade.get_trades([], include_orders=False)
|
||||
|
||||
assert "JOIN orders" in str(query)
|
||||
assert "JOIN orders" not in str(query1)
|
||||
|
||||
|
||||
def test_get_trades_backtest():
|
||||
Trade.use_db = False
|
||||
with pytest.raises(NotImplementedError, match=r"`Trade.get_trades\(\)` not .*"):
|
||||
|
Reference in New Issue
Block a user