Skip to content

Commit e6c5820

Browse files
committed
Done 1.222.0 release
1 parent 0792c0f commit e6c5820

File tree

28 files changed

+1328
-738
lines changed

28 files changed

+1328
-738
lines changed

scripts/llm_stub_gen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from glob import glob
44
from pathlib import Path
55

6+
os.environ["OPENROUTER_API_KEY"] = ""
7+
68
module_path = "nautilus_trader/nautilus_trader/"
79
stub_file_path = "stubs/"
810
symbol_file_path = "nautilus_trader/nautilus_trader/core/nautilus_pyo3.pyi"

stubs/accounting/factory.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ class AccountFactory:
6262
"""
6363
...
6464
@staticmethod
65+
def deregister_cash_borrowing(issuer: str) -> None:
66+
"""
67+
Deregister cash borrowing for the given issuer.
68+
69+
This is primarily intended for test cleanup to prevent global state leakage.
70+
71+
Parameters
72+
----------
73+
issuer : str
74+
The issuer to deregister.
75+
76+
"""
77+
...
78+
@staticmethod
6579
def create(event: AccountState) -> Account:
6680
"""
6781
Create an account based on the events account type.

stubs/backtest/data_client.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class BacktestMarketDataClient(MarketDataClient):
9898
): ...
9999
def _start(self) -> None: ...
100100
def _stop(self) -> None: ...
101-
def _reset(self) -> None: ...
102101
def subscribe(self, command: SubscribeData) -> None: ...
103102
def unsubscribe(self, command: UnsubscribeData) -> None: ...
104103
def subscribe_instruments(self, command: SubscribeInstruments) -> None: ...
@@ -133,5 +132,3 @@ class BacktestMarketDataClient(MarketDataClient):
133132
def request_quote_ticks(self, request: RequestQuoteTicks) -> None: ...
134133
def request_trade_ticks(self, request: RequestTradeTicks) -> None: ...
135134
def request_bars(self, request: RequestBars) -> None: ...
136-
def _start_spread_quote_aggregator(self, command: SubscribeQuoteTicks) -> None: ...
137-
def _stop_spread_quote_aggregator(self, command: UnsubscribeQuoteTicks) -> None: ...

stubs/backtest/engine.pyi

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ from __future__ import annotations
1818
from collections import deque
1919
import datetime
2020
import decimal
21-
import uuid
22-
from collections.abc import Callable, Generator
21+
from collections.abc import Generator
2322
from typing import Any
2423

2524
import pandas as pd
@@ -30,19 +29,18 @@ from nautilus_trader.backtest.modules import SimulationModule
3029
from nautilus_trader.backtest.results import BacktestResult
3130
from nautilus_trader.cache.base import CacheFacade
3231
from nautilus_trader.common.actor import Actor
33-
from nautilus_trader.common.component import Clock, Logger
32+
from nautilus_trader.common.component import Logger
3433
from nautilus_trader.config import BacktestEngineConfig
3534
from nautilus_trader.core.data import Data
3635
from nautilus_trader.core.rust.model import AccountType, BookType, OmsType
3736
from nautilus_trader.core.uuid import UUID4
38-
from nautilus_trader.data.engine import DataEngine
37+
from nautilus_trader.data.engine import DataEngine, TimeRangeGenerator
3938
from nautilus_trader.data.messages import RequestData
4039
from nautilus_trader.execution.algorithm import ExecAlgorithm
4140
from nautilus_trader.execution.messages import TradingCommand
4241
from 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+

stubs/backtest/models/aggregator.pyi

Lines changed: 0 additions & 26 deletions
This file was deleted.

stubs/backtest/models/fill.pyi

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class FillModel:
3232
def __init__(
3333
self,
3434
prob_fill_on_limit: float = 1.0,
35-
prob_fill_on_stop: float = 1.0,
3635
prob_slippage: float = 0.0,
3736
random_seed: int | None = None,
3837
config = None,
@@ -49,17 +48,6 @@ class FillModel:
4948
"""
5049
...
5150

52-
def is_stop_filled(self) -> bool:
53-
"""
54-
Return a value indicating whether a ``STOP-MARKET`` order filled.
55-
56-
Returns
57-
-------
58-
bool
59-
60-
"""
61-
...
62-
6351
def is_slipped(self) -> bool:
6452
"""
6553
Return a value indicating whether an order fill slipped.
@@ -269,7 +257,6 @@ class MarketHoursFillModel(FillModel):
269257
def __init__(
270258
self,
271259
prob_fill_on_limit: float = 1.0,
272-
prob_fill_on_stop: float = 1.0,
273260
prob_slippage: float = 0.0,
274261
random_seed: int | None = None,
275262
) -> None: ...
@@ -310,7 +297,6 @@ class VolumeSensitiveFillModel(FillModel):
310297
def __init__(
311298
self,
312299
prob_fill_on_limit: float = 1.0,
313-
prob_fill_on_stop: float = 1.0,
314300
prob_slippage: float = 0.0,
315301
random_seed: int | None = None,
316302
) -> None: ...
@@ -345,7 +331,6 @@ class CompetitionAwareFillModel(FillModel):
345331
def __init__(
346332
self,
347333
prob_fill_on_limit: float = 1.0,
348-
prob_fill_on_stop: float = 1.0,
349334
prob_slippage: float = 0.0,
350335
random_seed: int | None = None,
351336
liquidity_factor: float = 0.3,

0 commit comments

Comments
 (0)