diff --git a/docs/tutorials/backtest_low_level.md b/docs/tutorials/backtest_low_level.md index 70b6cf4917e6..1ce229d241d1 100644 --- a/docs/tutorials/backtest_low_level.md +++ b/docs/tutorials/backtest_low_level.md @@ -29,6 +29,7 @@ from nautilus_trader.model.currencies import ETH from nautilus_trader.model.currencies import USDT from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import TradeTickDataWrangler @@ -72,7 +73,7 @@ to show the general configuration pattern: ```python # Configure backtest engine -config = BacktestEngineConfig(trader_id="BACKTESTER-001") +config = BacktestEngineConfig(trader_id=TraderId("BACKTESTER-001")) # Build the backtest engine engine = BacktestEngine(config=config) diff --git a/examples/backtest/betfair_backtest_orderbook_imbalance.py b/examples/backtest/betfair_backtest_orderbook_imbalance.py index 2e96982aa506..24c7a6adb115 100644 --- a/examples/backtest/betfair_backtest_orderbook_imbalance.py +++ b/examples/backtest/betfair_backtest_orderbook_imbalance.py @@ -30,6 +30,7 @@ from nautilus_trader.model.enums import BookType from nautilus_trader.model.enums import OmsType from nautilus_trader.model.identifiers import ClientId +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.objects import Money from tests.integration_tests.adapters.betfair.test_kit import BetfairDataProvider from tests.integration_tests.adapters.betfair.test_kit import betting_instrument @@ -37,7 +38,7 @@ if __name__ == "__main__": # Configure backtest engine - config = BacktestEngineConfig(trader_id="BACKTESTER-001") + config = BacktestEngineConfig(trader_id=TraderId("BACKTESTER-001")) # Build the backtest engine engine = BacktestEngine(config=config) diff --git a/examples/backtest/crypto_ema_cross_ethusdt_trailing_stop.py b/examples/backtest/crypto_ema_cross_ethusdt_trailing_stop.py index 62d364905f6d..35cdfb279ccd 100755 --- a/examples/backtest/crypto_ema_cross_ethusdt_trailing_stop.py +++ b/examples/backtest/crypto_ema_cross_ethusdt_trailing_stop.py @@ -28,6 +28,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import TradeTickDataWrangler @@ -37,7 +38,7 @@ if __name__ == "__main__": # Configure backtest engine - config = BacktestEngineConfig(trader_id="BACKTESTER-001") + config = BacktestEngineConfig(trader_id=TraderId("BACKTESTER-001")) # Build the backtest engine engine = BacktestEngine(config=config) diff --git a/examples/backtest/crypto_ema_cross_with_binance_provider.py b/examples/backtest/crypto_ema_cross_with_binance_provider.py index 37139aef068c..7bc35db84f61 100644 --- a/examples/backtest/crypto_ema_cross_with_binance_provider.py +++ b/examples/backtest/crypto_ema_cross_with_binance_provider.py @@ -35,6 +35,7 @@ from nautilus_trader.model.enums import OmsType from nautilus_trader.model.identifiers import InstrumentId from nautilus_trader.model.identifiers import Symbol +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -66,7 +67,7 @@ async def create_provider(): if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO"), ) diff --git a/examples/backtest/crypto_orderbook_imbalance.py b/examples/backtest/crypto_orderbook_imbalance.py index 1bdc76d0459a..04df7543d9d2 100644 --- a/examples/backtest/crypto_orderbook_imbalance.py +++ b/examples/backtest/crypto_orderbook_imbalance.py @@ -30,6 +30,7 @@ from nautilus_trader.model.enums import BookType from nautilus_trader.model.enums import OmsType from nautilus_trader.model.enums import book_type_to_str +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.loaders import BinanceOrderBookDeltaDataLoader @@ -40,7 +41,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), # logging=LoggingConfig(log_level="DEBUG"), ) diff --git a/examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py b/examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py index 0353746ae9f8..ab05db012928 100755 --- a/examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py +++ b/examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py @@ -29,6 +29,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -39,7 +40,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), ) # Build the backtest engine diff --git a/examples/backtest/fx_ema_cross_audusd_ticks.py b/examples/backtest/fx_ema_cross_audusd_ticks.py index f88effe2c2d3..f99131933d7b 100644 --- a/examples/backtest/fx_ema_cross_audusd_ticks.py +++ b/examples/backtest/fx_ema_cross_audusd_ticks.py @@ -30,6 +30,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -40,7 +41,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), ) # Build the backtest engine diff --git a/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_external.py b/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_external.py index 55860c4f397b..322dd184ffba 100755 --- a/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_external.py +++ b/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_external.py @@ -32,6 +32,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import BarDataWrangler @@ -42,7 +43,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO"), risk_engine=RiskEngineConfig( bypass=True, # Example of bypassing pre-trade risk checks for backtests diff --git a/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_internal.py b/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_internal.py index d7de8d413eb4..c9ba112bcec5 100755 --- a/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_internal.py +++ b/examples/backtest/fx_ema_cross_bracket_gbpusd_bars_internal.py @@ -32,6 +32,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -42,7 +43,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO"), risk_engine=RiskEngineConfig( bypass=True, # Example of bypassing pre-trade risk checks for backtests diff --git a/examples/backtest/fx_market_maker_gbpusd_bars.py b/examples/backtest/fx_market_maker_gbpusd_bars.py index 814f7e12b0c5..704b90ed87a7 100755 --- a/examples/backtest/fx_market_maker_gbpusd_bars.py +++ b/examples/backtest/fx_market_maker_gbpusd_bars.py @@ -31,6 +31,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -41,7 +42,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), ) # Build the backtest engine diff --git a/examples/backtest/fx_talib_gbpusd_bars_internal.py b/examples/backtest/fx_talib_gbpusd_bars_internal.py index 60ca7caf8f53..fd2adce28b7c 100644 --- a/examples/backtest/fx_talib_gbpusd_bars_internal.py +++ b/examples/backtest/fx_talib_gbpusd_bars_internal.py @@ -29,6 +29,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -39,7 +40,7 @@ if __name__ == "__main__": # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO"), risk_engine=RiskEngineConfig( bypass=True, # Example of bypassing pre-trade risk checks for backtests diff --git a/tests/mem_leak_tests/memray_backtest.py b/tests/mem_leak_tests/memray_backtest.py index 87be4ebc72bf..9c2b6e3e74e1 100644 --- a/tests/mem_leak_tests/memray_backtest.py +++ b/tests/mem_leak_tests/memray_backtest.py @@ -27,6 +27,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import TradeTickDataWrangler @@ -43,7 +44,7 @@ # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(bypass_logging=True), ) diff --git a/tests/mem_leak_tests/tracemalloc_cross_bracket_gbpusd_bars_internal.py b/tests/mem_leak_tests/tracemalloc_cross_bracket_gbpusd_bars_internal.py index fc3e4850902b..328b01f31af3 100644 --- a/tests/mem_leak_tests/tracemalloc_cross_bracket_gbpusd_bars_internal.py +++ b/tests/mem_leak_tests/tracemalloc_cross_bracket_gbpusd_bars_internal.py @@ -29,6 +29,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -41,7 +42,7 @@ def run(*args, **kwargs): # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO", bypass_logging=True), risk_engine=RiskEngineConfig( bypass=True, # Example of bypassing pre-trade risk checks for backtests diff --git a/tests/mem_leak_tests/tracemalloc_crypto_ema_cross_ethusdt_trailing_stop.py b/tests/mem_leak_tests/tracemalloc_crypto_ema_cross_ethusdt_trailing_stop.py index 0ada23b778de..ac3647ccbdee 100644 --- a/tests/mem_leak_tests/tracemalloc_crypto_ema_cross_ethusdt_trailing_stop.py +++ b/tests/mem_leak_tests/tracemalloc_crypto_ema_cross_ethusdt_trailing_stop.py @@ -26,6 +26,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import TradeTickDataWrangler @@ -38,7 +39,7 @@ def run(*args, **kwargs): # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO", bypass_logging=True), ) diff --git a/tests/mem_leak_tests/tracemalloc_market_maker_gbpusd_bars.py b/tests/mem_leak_tests/tracemalloc_market_maker_gbpusd_bars.py index 3e7e2db310c1..fe692ff37d7d 100644 --- a/tests/mem_leak_tests/tracemalloc_market_maker_gbpusd_bars.py +++ b/tests/mem_leak_tests/tracemalloc_market_maker_gbpusd_bars.py @@ -29,6 +29,7 @@ from nautilus_trader.model.data import BarType from nautilus_trader.model.enums import AccountType from nautilus_trader.model.enums import OmsType +from nautilus_trader.model.identifiers import TraderId from nautilus_trader.model.identifiers import Venue from nautilus_trader.model.objects import Money from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler @@ -41,7 +42,7 @@ def run(): # Configure backtest engine config = BacktestEngineConfig( - trader_id="BACKTESTER-001", + trader_id=TraderId("BACKTESTER-001"), logging=LoggingConfig(log_level="INFO", bypass_logging=True), )