Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.185.0 #1472

Merged
merged 31 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b7d411
Bump version
cjdsellers Jan 23, 2024
55d82a7
Consolidate logging module into components
cjdsellers Jan 23, 2024
ecbda36
Consolidate clock module into components
cjdsellers Jan 23, 2024
d874319
Cleanup imports and release notes
cjdsellers Jan 23, 2024
749a355
Update dependencies including databento
cjdsellers Jan 24, 2024
5429d57
Fix tutorial configs
cjdsellers Jan 24, 2024
a8f9a6e
Add warning when bypassing logging for LIVE
cjdsellers Jan 24, 2024
bc34886
Update MessageBusConfig docs
cjdsellers Jan 24, 2024
f0b8ad9
Consistently use TraderId
cjdsellers Jan 24, 2024
990a3f8
Revert requirement for TraderId
cjdsellers Jan 24, 2024
2e9030f
Update trigger_price arrow type
benjaminsingleton Jan 25, 2024
68d82ed
Fix OrderUpdated arrow serialization (#1469)
cjdsellers Jan 25, 2024
60b896d
Refine invalid configuration errors
cjdsellers Jan 25, 2024
d9b9246
Improve register_serializable_object
cjdsellers Jan 25, 2024
fd0e698
Refine logging config and testing
cjdsellers Jan 25, 2024
b09602a
Fix StreamingConfig.include_types behavior and docs
cjdsellers Jan 25, 2024
55c93c6
Fix type assignment in StrategyFactory for StrategyConfig
rsmb7z Jan 25, 2024
11136e9
Fix instrument_id for failing tests
rsmb7z Jan 25, 2024
ad11851
Fix ImportableStrategyConfig type assignment in StrategyFactory (#1470)
cjdsellers Jan 25, 2024
20e73fb
Update core dependencies
cjdsellers Jan 25, 2024
cd7177a
Refine importable config parsing
cjdsellers Jan 25, 2024
fc5761f
Upgrade datafusion
cjdsellers Jan 25, 2024
55e8c00
Standardize features formatting in manifest
cjdsellers Jan 25, 2024
9a6b890
Refine tick variable naming
cjdsellers Jan 26, 2024
b683e75
Continue Databento historical client in Rust
cjdsellers Jan 26, 2024
996769c
Continue Databento historical client in Rust
cjdsellers Jan 26, 2024
fc859ce
Continue Databento historical client in Rust
cjdsellers Jan 26, 2024
10562c6
Continue Databento historical client in Rust
cjdsellers Jan 26, 2024
2c64a97
Improve expiration contract parsing (#1471)
fhill2 Jan 26, 2024
d2efc9b
Update release notes
cjdsellers Jan 26, 2024
15b3a4c
Upgrade black
cjdsellers Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# NautilusTrader 1.185.0 Beta

Released on 26th January 2024 (UTC).

### Enhancements
- Add warning log when `bypass_logging` is set true for a `LIVE` context
- Improved `register_serializable object` to also add type to internal `_EXTERNAL_PUBLIHSABLE_TYPES`
- Improved Interactive Brokers expiration contract parsing, thanks @fhill2

### Breaking Changes
- Changed `StreamingConfig.include_types` type from `tuple[str]` to `list[type]` (better alignment with other type filters)
- Consolidated `clock` module into `component` module (reduce binary wheel size)
- Consolidated `logging` module into `component` module (reduce binary wheel size)

### Fixes
- Fixed Arrow serialization of `OrderUpdated` (`trigger_price` type was incorrect), thanks @benjaminsingleton
- Fixed `StreamingConfig.include_types` behavior (was not being honored for instrument writers), thanks for reporting @doublier1
- Fixed `ImportableStrategyConfig` type assignment in `StrategyFactory` (#1470), thanks @rsmb7z

---

# NautilusTrader 1.184.0 Beta

Released on 22nd January 2024 (UTC).
Expand Down Expand Up @@ -478,7 +499,7 @@ Released on 30th April 2023 (UTC).
- Defined public API for instruments, can now import directly from `nautilus_trader.model.instruments` (denest namespace)
- Defined public API for orders, can now import directly from `nautilus_trader.model.orders` (denest namespace)
- Defined public API for order book, can now import directly from `nautilus_trader.model.orderbook` (denest namespace)
- Now stripping debug symbols after build (reduced binary sizes)
- Now stripping debug symbols after build (reduced binary wheel size)
- Refined build and added additional `debug` Makefile convenience targets

### Fixes
Expand Down
20 changes: 0 additions & 20 deletions docs/api_reference/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
:member-order: bysource
```

## Clock

```{eval-rst}
.. automodule:: nautilus_trader.common.clock
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Component

```{eval-rst}
Expand Down Expand Up @@ -60,16 +50,6 @@
:member-order: bysource
```

## Logging

```{eval-rst}
.. automodule:: nautilus_trader.common.logging
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

```{eval-rst}
.. automodule:: nautilus_trader.common.providers
:show-inheritance:
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Here is an example of discovering the current instruments for the Binance Future
from nautilus_trader.adapters.binance.common.enums import BinanceAccountType
from nautilus_trader.adapters.binance.factories import get_cached_binance_http_client
from nautilus_trader.adapters.binance.futures.providers import BinanceFuturesInstrumentProvider
from nautilus_trader.common.clock import LiveClock
from nautilus_trader.common.component import LiveClock


clock = LiveClock()
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ determine how a primary order is split into a series of spawned orders.
```python
# Configure your strategy
config = EMACrossTWAPConfig(
instrument_id=str(ETHUSDT_BINANCE.id),
bar_type="ETHUSDT.BINANCE-250-TICK-LAST-INTERNAL",
instrument_id=ETHUSDT_BINANCE.id,
bar_type=BarType.from_str("ETHUSDT.BINANCE-250-TICK-LAST-INTERNAL"),
trade_size=Decimal("0.05"),
fast_ema_period=10,
slow_ema_period=20,
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ It's possible to use `Logger` objects directly, and these can be initialized any
If you ***aren't*** using an object which already initializes a `NautilusKernel` (and logging) such as `BacktestEngine` or `TradingNode`,
then you can initialize a logging in the following way:
```python
from nautilus_trader.common.logging import init_logging
from nautilus_trader.common.logging import Logger
from nautilus_trader.common.component import init_logging
from nautilus_trader.common.component import Logger

init_logging()
logger = Logger("MyLogger")
Expand Down
60 changes: 36 additions & 24 deletions docs/concepts/message_bus.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ your `TradingNodeConfig`. Each of these config options will be described below.
message_bus=MessageBusConfig(
database=DatabaseConfig(),
encoding="json",
stream="streams",
use_instance_id=False,
timestamps_as_iso8601=True,
types_filter=[QuoteTick, TradeTick],
buffer_interval_ms=100,
autotrim_mins=30,
use_trader_prefix=True,
use_trader_id=True,
use_instance_id=False,
streams_prefix="streams",
types_filter=[QuoteTick, TradeTick],
)
...
```
Expand All @@ -90,27 +93,6 @@ message_bus=MessageBusConfig(
A `DatabaseConfig` must be provided, for a default Redis setup on the local
loopback you can pass a `DatabaseConfig()`, which will use defaults to match.

### Trader keys

Trader keys are essential for identifying individual trader nodes and organizing messages within streams.
They can be tailored to meet your specific requirements and use cases. In the context of message bus streams, a trader key is typically structured as follows:

```
{stream}:{trader_id}:{instance_id}
```

The following options are available for configuring trader keys:

#### Stream
The `stream` string allows you to group all streams for a single trader instance, or organize messages related to a group of trader instances.
By configuring this grouping behavior, pass a string to the `stream` configuration option.

#### Instance ID

Each trader node is assigned a unique 'instance ID,' which is a UUIDv4. This instance ID helps distinguish individual traders when messages
are distributed across multiple streams. You can include the instance ID in the trader key by setting the `use_instance_id` configuration option to `True`.
This is particularly useful when you need to track and identify traders across various streams in a multi-node trading system.

### Encoding

Two encodings are currently supported by the built-in `Serializer` used by the `MessageBus`:
Expand All @@ -129,6 +111,36 @@ It's recommended to use `json` encoding for human readability when performance i
By default timestamps are formatted as UNIX epoch nanosecond integers. Alternatively you can
configure ISO 8601 string formatting by setting the `timestamps_as_iso8601` to `True`.

### Message stream keys

Message stream keys are essential for identifying individual trader nodes and organizing messages within streams.
They can be tailored to meet your specific requirements and use cases. In the context of message bus streams, a trader key is typically structured as follows:

```
trader:{trader_id}:{instance_id}:{streams_prefix}
```

The following options are available for configuring message stream keys:

#### Trader prefix

If the key should begin with the `trader` string.

#### Trader ID

If the key should include the trader ID for the node.

#### Instance ID

Each trader node is assigned a unique 'instance ID,' which is a UUIDv4. This instance ID helps distinguish individual traders when messages
are distributed across multiple streams. You can include the instance ID in the trader key by setting the `use_instance_id` configuration option to `True`.
This is particularly useful when you need to track and identify traders across various streams in a multi-node trading system.

#### Streams prefix

The `streams_prefix` string allows you to group all streams for a single trader instance, or organize messages related to a group of trader instances.
By configuring this grouping behavior, pass a string to the `streams_prefix` configuration option (with other prefixes false).

### Types filtering

When messages are published on the message bus, they are serialized and written to a stream, provided that a backing for the message bus has been configured and enabled.
Expand Down
7 changes: 4 additions & 3 deletions docs/tutorials/backtest_low_level.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -135,8 +136,8 @@ Firstly, initialize a strategy configuration, then use this to initialize a stra

# Configure your strategy
strategy_config = EMACrossTWAPConfig(
instrument_id=str(ETHUSDT_BINANCE.id),
bar_type="ETHUSDT.BINANCE-250-TICK-LAST-INTERNAL",
instrument_id=ETHUSDT_BINANCE.id,
bar_type=BarType.from_str("ETHUSDT.BINANCE-250-TICK-LAST-INTERNAL"),
trade_size=Decimal("0.10"),
fast_ema_period=10,
slow_ema_period=20,
Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/betfair_backtest_orderbook_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
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


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)
Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/crypto_ema_cross_ethusdt_trailing_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions examples/backtest/crypto_ema_cross_with_binance_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from nautilus_trader.adapters.binance.futures.providers import BinanceFuturesInstrumentProvider
from nautilus_trader.backtest.engine import BacktestEngine
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.common.clock import LiveClock
from nautilus_trader.common.component import LiveClock
from nautilus_trader.config import InstrumentProviderConfig
from nautilus_trader.config import LoggingConfig
from nautilus_trader.examples.strategies.ema_cross_trailing_stop import EMACrossTrailingStop
Expand All @@ -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
Expand Down Expand Up @@ -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"),
)

Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/crypto_orderbook_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"),
)

Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/fx_ema_cross_audusd_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/fx_market_maker_gbpusd_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/backtest/fx_talib_gbpusd_bars_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/live/betfair/betfair.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from nautilus_trader.adapters.betfair.factories import get_cached_betfair_client
from nautilus_trader.adapters.betfair.factories import get_cached_betfair_instrument_provider
from nautilus_trader.adapters.betfair.providers import BetfairInstrumentProviderConfig
from nautilus_trader.common.logging import init_logging
from nautilus_trader.common.logging import log_level_from_str
from nautilus_trader.common.component import init_logging
from nautilus_trader.common.component import log_level_from_str
from nautilus_trader.config import LoggingConfig
from nautilus_trader.config import TradingNodeConfig
from nautilus_trader.examples.strategies.orderbook_imbalance import OrderBookImbalance
Expand Down
Loading
Loading