@@ -18,8 +18,7 @@ from __future__ import annotations
1818from collections import deque
1919import datetime
2020import decimal
21- import uuid
22- from collections .abc import Callable , Generator
21+ from collections .abc import Generator
2322from typing import Any
2423
2524import pandas as pd
@@ -30,19 +29,18 @@ from nautilus_trader.backtest.modules import SimulationModule
3029from nautilus_trader .backtest .results import BacktestResult
3130from nautilus_trader .cache .base import CacheFacade
3231from nautilus_trader .common .actor import Actor
33- from nautilus_trader .common .component import Clock , Logger
32+ from nautilus_trader .common .component import Logger
3433from nautilus_trader .config import BacktestEngineConfig
3534from nautilus_trader .core .data import Data
3635from nautilus_trader .core .rust .model import AccountType , BookType , OmsType
3736from nautilus_trader .core .uuid import UUID4
38- from nautilus_trader .data .engine import DataEngine
37+ from nautilus_trader .data .engine import DataEngine , TimeRangeGenerator
3938from nautilus_trader .data .messages import RequestData
4039from nautilus_trader .execution .algorithm import ExecAlgorithm
4140from nautilus_trader .execution .messages import TradingCommand
4241from nautilus_trader .model .data import (
4342 Bar ,
4443 BarType ,
45- BookOrder ,
4644 InstrumentClose ,
4745 InstrumentStatus ,
4846 OrderBookDelta ,
@@ -330,8 +328,10 @@ class BacktestEngine:
330328 bar_execution : bool = True ,
331329 bar_adaptive_high_low_ordering : bool = False ,
332330 trade_execution : bool = False ,
331+ liquidity_consumption : bool = False ,
333332 allow_cash_borrowing : bool = False ,
334333 frozen_account : bool = False ,
334+ price_protection_points : int | None = None ,
335335 ) -> None :
336336 """
337337 Add a `SimulatedExchange` with the given parameters to the backtest engine.
@@ -502,8 +502,7 @@ class BacktestEngine:
502502 """
503503 ...
504504
505- @classmethod
506- def default_time_range_generator (cls , initial_time : int , params : dict ) -> None : ...
505+
507506
508507 def dump_pickled_data (self ) -> bytes :
509508 """
@@ -702,12 +701,13 @@ class BacktestEngine:
702701 def _handle_unsubscribe (self , command : UnsubscribeData ) -> None : ...
703702 def _handle_data_response (self , response : DataResponse ) -> None : ...
704703 def _update_subscription_data (
705- self ,
706- subscription_name : str ,
707- start_time : int ,
708- end_time : int
704+ self ,
705+ subscription_name : str ,
706+ request_start_ns : int ,
707+ request_end_ns : int ,
709708 ) -> None : ...
710- def _subscription_generator (self , subscription_name : str , time_range_generator ) -> Generator : ... # Generator
709+
710+ def _subscription_generator (self , subscription_name : str , time_range_generator : TimeRangeGenerator ) -> Generator [int , bool , None ]: ...
711711
712712 def _run (
713713 self ,
@@ -785,7 +785,7 @@ class BacktestDataIterator:
785785
786786 def __init__ (self ) -> None : ...
787787
788- def add_data (self , data_name : str , data : list [Data ], append_data : bool = True ) -> None : # list[Data]
788+ def add_data (self , data_name : str , data : list [Data ], append_data : bool = True , presorted : bool = False ) -> None : # list[Data]
789789 """
790790 Add (or replace) a named, pre-sorted data list for static data loading.
791791 If a stream with the same ``data_name`` already exists, it will be replaced
@@ -1079,6 +1079,8 @@ class SimulatedExchange:
10791079 bar_execution : bool = True ,
10801080 bar_adaptive_high_low_ordering : bool = False ,
10811081 trade_execution : bool = False ,
1082+ liquidity_consumption : bool = False ,
1083+ price_protection_points : int | None = None ,
10821084 ) -> None : ...
10831085
10841086 def __repr__ (self ) -> str : ...
@@ -1471,8 +1473,6 @@ class OrderMatchingEngine:
14711473 _fill_model : FillModel
14721474 _fee_model : FeeModel
14731475 _book : OrderBook
1474- _opening_auction_book : OrderBook
1475- _closing_auction_book : OrderBook
14761476 _account_ids : dict [TraderId , AccountId ]
14771477 _execution_bar_types : dict [InstrumentId , BarType ]
14781478 _execution_bar_deltas : dict [BarType , datetime .timedelta ]
@@ -1509,6 +1509,8 @@ class OrderMatchingEngine:
15091509 bar_execution : bool = True ,
15101510 bar_adaptive_high_low_ordering : bool = False ,
15111511 trade_execution : bool = False ,
1512+ liquidity_consumption : bool = False ,
1513+ price_protection_points : int | None = None ,
15121514 ) -> None : ...
15131515
15141516 def __repr__ (self ) -> str : ...
@@ -1692,8 +1694,6 @@ class OrderMatchingEngine:
16921694 """
16931695 ...
16941696
1695- def process_auction_book (self , book : OrderBook ) -> None : # OrderBook
1696- ...
16971697
16981698 def process_order (self , order : Order , account_id : AccountId ) -> None : ...
16991699
@@ -1957,6 +1957,4 @@ class OrderMatchingEngine:
19571957 liquidity_side : LiquiditySide ,
19581958 ) -> None : ...
19591959
1960- TimeRangeGenerator = Callable [[int , dict [str , Any ]], Generator [int , bool , None ]]
1961-
1962- def register_time_range_generator (name : str , function : TimeRangeGenerator ) -> None : ...
1960+
0 commit comments