From a19466c08578a0078622cc2b0c5356c4d304746a Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 7 Jul 2021 01:06:51 -0600 Subject: [PATCH] Moved leverage and is_short variables out of trade constructors and into conftest --- tests/conftest.py | 7 +++++-- tests/persistence/test_persistence_leverage.py | 3 --- tests/persistence/test_persistence_short.py | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 20fbde61c..3923ab587 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2150,7 +2150,8 @@ def limit_exit_short_order_open(): 'amount': 90.99370639272354, 'filled': 0.0, 'remaining': 90.99370639272354, - 'status': 'open' + 'status': 'open', + 'leverage': 1.0 } @@ -2281,7 +2282,8 @@ def market_leveraged_buy_order(): 'remaining': 0.0, 'status': 'closed', 'exchange': 'kraken', - 'liquidation_price': 0.00004000 + 'liquidation_price': 0.00004000, + 'leverage': 3.0 } @@ -2298,5 +2300,6 @@ def market_leveraged_sell_order(): 'filled': 275.97543219, 'remaining': 0.0, 'status': 'closed', + 'leverage': 3.0, 'exchange': 'kraken' } diff --git a/tests/persistence/test_persistence_leverage.py b/tests/persistence/test_persistence_leverage.py index 74103156d..0453e5de5 100644 --- a/tests/persistence/test_persistence_leverage.py +++ b/tests/persistence/test_persistence_leverage.py @@ -157,7 +157,6 @@ def test_update_open_order_lev(limit_leveraged_buy_order): fee_open=0.1, fee_close=0.1, interest_rate=0.0005, - leverage=3.0, exchange='binance', interest_mode=InterestMode.HOURSPERDAY ) @@ -412,7 +411,6 @@ def test_update_limit_order_lev(limit_leveraged_buy_order, limit_leveraged_sell_ open_date=datetime.utcnow() - timedelta(hours=0, minutes=10), fee_open=fee.return_value, fee_close=fee.return_value, - leverage=3.0, interest_rate=0.0005, exchange='binance', interest_mode=InterestMode.HOURSPERDAY @@ -480,7 +478,6 @@ def test_update_market_order_lev(market_leveraged_buy_order, market_leveraged_se amount=5, open_rate=0.00004099, is_open=True, - leverage=3, fee_open=fee.return_value, fee_close=fee.return_value, open_date=datetime.utcnow() - timedelta(hours=0, minutes=10), diff --git a/tests/persistence/test_persistence_short.py b/tests/persistence/test_persistence_short.py index 11431c124..6a52eb91f 100644 --- a/tests/persistence/test_persistence_short.py +++ b/tests/persistence/test_persistence_short.py @@ -494,7 +494,6 @@ def test_update_market_order_short( fee_open=fee.return_value, fee_close=fee.return_value, open_date=datetime.utcnow() - timedelta(hours=0, minutes=10), - leverage=3.0, interest_rate=0.0005, exchange='kraken', interest_mode=InterestMode.HOURSPER4 @@ -584,7 +583,6 @@ def test_calc_profit_short(market_short_order, market_exit_short_order, fee): fee_close=fee.return_value, exchange='kraken', is_short=True, - leverage=3.0, interest_rate=0.0005, interest_mode=InterestMode.HOURSPER4 )