From 605c9207f551756a936e769195b3da8bf922a13a Mon Sep 17 00:00:00 2001 From: David Blom Date: Sat, 27 Apr 2024 15:17:41 +0200 Subject: [PATCH] Fix unit test --- nautilus_trader/adapters/sandbox/execution.py | 3 ++- tests/integration_tests/adapters/sandbox/conftest.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nautilus_trader/adapters/sandbox/execution.py b/nautilus_trader/adapters/sandbox/execution.py index 52aa0b384f0b..18d112a52329 100644 --- a/nautilus_trader/adapters/sandbox/execution.py +++ b/nautilus_trader/adapters/sandbox/execution.py @@ -86,6 +86,7 @@ def __init__( balance: int, oms_type: OmsType = OmsType.NETTING, account_type: AccountType = AccountType.MARGIN, + default_leverage: Decimal = Decimal(10), ) -> None: self._currency = Currency.from_str(currency) money = Money(value=balance, currency=self._currency) @@ -112,7 +113,7 @@ def __init__( account_type=self._account_type, base_currency=self._currency, starting_balances=[self.balance.free], - default_leverage=Decimal(10), + default_leverage=default_leverage, leverages={}, instruments=self.INSTRUMENTS, modules=[], diff --git a/tests/integration_tests/adapters/sandbox/conftest.py b/tests/integration_tests/adapters/sandbox/conftest.py index b171d2958438..7eacad869e03 100644 --- a/tests/integration_tests/adapters/sandbox/conftest.py +++ b/tests/integration_tests/adapters/sandbox/conftest.py @@ -13,9 +13,12 @@ # limitations under the License. # ------------------------------------------------------------------------------------------------- +from decimal import Decimal + import pytest from nautilus_trader.adapters.sandbox.execution import SandboxExecutionClient +from nautilus_trader.model.enums import AccountType from nautilus_trader.model.events import AccountState from nautilus_trader.model.identifiers import AccountId from nautilus_trader.model.identifiers import Venue @@ -48,6 +51,8 @@ def exec_client( venue=venue.value, currency="USD", balance=100_000, + account_type=AccountType.CASH, + default_leverage=Decimal(1), )