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.188.0 #1514

Merged
merged 130 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
029a530
Bump version
cjdsellers Feb 9, 2024
912b55d
Fix typo
cjdsellers Feb 9, 2024
68862f8
Refine Databento InstrumentId parsing
cjdsellers Feb 9, 2024
4f06291
Optimize DatabentoDataLoader
cjdsellers Feb 10, 2024
d8cc92a
Refine Databento include_trades filtering
cjdsellers Feb 10, 2024
800cad5
Improve clarity of param description
cjdsellers Feb 10, 2024
34aefe8
Standardize instruments pyo3 interface
cjdsellers Feb 10, 2024
54e5a21
Update to ignore notebooks dir catalog
cjdsellers Feb 10, 2024
dc723eb
Update dependencies
cjdsellers Feb 10, 2024
f816826
Fix missing enc_hook in configurations
cjdsellers Feb 10, 2024
a9772e3
Fix Binance order book example
cjdsellers Feb 10, 2024
78fd9e8
Add Databento re-exports
cjdsellers Feb 10, 2024
9ba9e8f
Cleanup example notebook imports
cjdsellers Feb 10, 2024
9258aed
Add Databento notebook example progress
cjdsellers Feb 10, 2024
cc475f5
Add Databento DBN files to gitignore
cjdsellers Feb 10, 2024
adc2ec9
Refine Databento re-exports
cjdsellers Feb 11, 2024
e9f80c4
Refine Databento components
cjdsellers Feb 11, 2024
47170e9
Refine Databento adapter and decoding
cjdsellers Feb 11, 2024
dc26c27
Add OrderBookDepth10 constructor to type stub
cjdsellers Feb 11, 2024
287b8a6
Fix deprecation warnings and docstrings
cjdsellers Feb 11, 2024
35e4548
Fix pyo3 stubs
cjdsellers Feb 11, 2024
40a0c93
Unskip catalog OrderBookDepth10 test
cjdsellers Feb 11, 2024
0f62924
Fix clippy lints
cjdsellers Feb 11, 2024
365f2e8
Standardize indicators special method ordering
cjdsellers Feb 11, 2024
91b48cc
Refine Databento adapter more
cjdsellers Feb 11, 2024
3c9dcc3
Standardize tutorial language
cjdsellers Feb 11, 2024
2774a36
Continue Databento data catalog tutorial
cjdsellers Feb 11, 2024
9055ef6
Update dependencies including chrono
cjdsellers Feb 11, 2024
2b73774
Fix call to clock.utc_now
cjdsellers Feb 12, 2024
faae332
Refine DatabentoLiveClient record handling loop
cjdsellers Feb 12, 2024
ed40835
Fix ControllerConfig base and docstring
cjdsellers Feb 12, 2024
e78bb97
Improve DatabentoDataClient startup sequence
cjdsellers Feb 12, 2024
f11de01
Implement Databento parent symbols on startup
cjdsellers Feb 12, 2024
5b68874
Update dependencies and pre-commit
cjdsellers Feb 13, 2024
753b769
Standardize attribute ordering
cjdsellers Feb 13, 2024
0009f3a
Implement OrderBookDeltas FFI and pyo3 interfaces
cjdsellers Feb 13, 2024
19113b8
Refine OrderBookDeltas implementation
cjdsellers Feb 13, 2024
74e3533
Fix Rust imports
cjdsellers Feb 13, 2024
ae5422c
Fix Equity short selling
cjdsellers Feb 14, 2024
78d0d49
Skip Windows in CI while GH runners broken
cjdsellers Feb 14, 2024
bf32484
Fix InteractiveBrokers historical bar data bug (#1499)
benjaminsingleton Feb 14, 2024
be3a5bb
Fix logging timestamps for backtesting
cjdsellers Feb 14, 2024
ed3334c
Optimize applying OrderBookDeltas to OrderBook
cjdsellers Feb 14, 2024
e176ea6
Fix FOK and IOC time in force fill handling
cjdsellers Feb 15, 2024
72a0d33
Fix account balance updates for zero quantity NETTING positions
cjdsellers Feb 16, 2024
bbd3cf0
Remove redundant docstring lines
cjdsellers Feb 16, 2024
95d1854
Fix print_config config option
cjdsellers Feb 16, 2024
f58077d
Implement AverageTrueRange in Rust (#1502)
rsmb7z Feb 16, 2024
c491ebf
Update core dependencies
cjdsellers Feb 16, 2024
28f2d8d
Introduce common tokio runtime
cjdsellers Feb 16, 2024
c3c6cbf
Optimize DatabentoLiveClient order book replay
cjdsellers Feb 16, 2024
956ae97
Port LiveClock and LiveTimer to Rust
cjdsellers Feb 17, 2024
f1512d6
Optimize pyo3 TimeEvent conversion with pycapsule
cjdsellers Feb 17, 2024
9253372
Refine comment in LiveTimer
cjdsellers Feb 17, 2024
c31e732
Fix LiveTimer to use saturating sub
cjdsellers Feb 17, 2024
1d006d6
Add order book subscriptions managed parameter
cjdsellers Feb 17, 2024
41e535b
Resume Windows in CI
cjdsellers Feb 17, 2024
fec8d73
Pause Windows in CI
cjdsellers Feb 17, 2024
3dd4386
Fix await eventually in cache tests
cjdsellers Feb 17, 2024
13ba8d1
Remove sleeps from interactive_brokers tests
cjdsellers Feb 17, 2024
50df82e
Fix logging enabled check (#1503)
twitu Feb 18, 2024
2a8011d
Optimize balance impact calculation
cjdsellers Feb 17, 2024
cdf6f56
Update release notes
cjdsellers Feb 18, 2024
213715e
Use pyo3_asyncio runtime
cjdsellers Feb 18, 2024
3483a3b
Implement OrderBookDeltas pickling
cjdsellers Feb 18, 2024
21764f9
Separate OrderBookMbo and OrderBookMbp
cjdsellers Feb 18, 2024
8287844
Reorganize core python model module
cjdsellers Feb 18, 2024
5e8a26f
Qualify pyo3::pyclass attribute
cjdsellers Feb 18, 2024
e447621
Add OrderBookMbp pyo3 interface
cjdsellers Feb 18, 2024
a1a0f6d
Upgrade ruff
cjdsellers Feb 18, 2024
c491f3b
Add collection type annotations
cjdsellers Feb 18, 2024
72de1ff
Fix backtest clock iteration
cjdsellers Feb 18, 2024
e4a3b39
Fix MessageBus publishable_types collection type
cjdsellers Feb 18, 2024
25e4ae1
Standardize field ordering
cjdsellers Feb 18, 2024
4bc817d
Add OrderBookMbo and Level pyo3 interfaces
cjdsellers Feb 19, 2024
f9e41af
Refine core order book impls
cjdsellers Feb 19, 2024
ef4c557
Standardize core indicator field naming
cjdsellers Feb 19, 2024
33f6cde
Extend core Indicator to handle order books
cjdsellers Feb 19, 2024
d9584d5
Extend core Indicator to handle order book data
cjdsellers Feb 19, 2024
ff1cd69
Fix TradeId memory leak
cjdsellers Feb 19, 2024
d1eec04
Fix TradeId pyo3 interface and improve docs
cjdsellers Feb 19, 2024
6fda4ee
Add some timer doc comments
cjdsellers Feb 19, 2024
e01d25d
Standardize type annotations in tests
cjdsellers Feb 19, 2024
16ee342
Add BookImbalanceRatio indicator in Rust
cjdsellers Feb 19, 2024
e7a957b
Standardize indicator initialized property naming
cjdsellers Feb 19, 2024
b408b65
Add example Rust OrderBookMbp BookImbalanceRatio
cjdsellers Feb 19, 2024
506170b
Update dependencies
cjdsellers Feb 19, 2024
920380a
Fix TradeTick size precision for pyo3 conversion
cjdsellers Feb 19, 2024
1926e2d
Resume Windows in CI
cjdsellers Feb 19, 2024
8eabaed
Fix DefaultHasher import
cjdsellers Feb 20, 2024
c00b888
Add OrderBookDeltas from mem C function
cjdsellers Feb 20, 2024
aa6ea25
Refine DatabentoLiveClient MBO replay
cjdsellers Feb 20, 2024
a4e4d0c
Refine DatabentoLiveClient MBO replay
cjdsellers Feb 20, 2024
ab10890
Update dependencies
cjdsellers Feb 21, 2024
ba50390
Fix catalog freeze_dict function
cjdsellers Feb 21, 2024
7ee3e93
Update release notes
cjdsellers Feb 21, 2024
abae459
Improve bypass_logging fixture
cjdsellers Feb 21, 2024
d4b22af
Fix RiskEngine cash value check when selling
cjdsellers Feb 21, 2024
ac788c7
Fix RiskEngine cash value check when selling
cjdsellers Feb 21, 2024
11e953f
Ported ChandeMomentumOscillator to Rust (#1508)
Pushkarm029 Feb 21, 2024
db97b95
Update dependencies including hyper
cjdsellers Feb 22, 2024
dc7e837
Cleanup cash_value base currency
cjdsellers Feb 22, 2024
3d54cec
Add OrderBookDeltas to_pyo3 conversion
cjdsellers Feb 22, 2024
df8b323
Cleanup imports
cjdsellers Feb 22, 2024
5ff7042
Fix clippy lints
cjdsellers Feb 23, 2024
a29c8f7
Fix clippy lints
cjdsellers Feb 23, 2024
06dc861
Cleanup Rust imports
cjdsellers Feb 23, 2024
9816f58
Cleanup Databento MBO buffering
cjdsellers Feb 23, 2024
fd5c734
Cleanup Rust imports
cjdsellers Feb 23, 2024
9a8c7f8
Cleanup Rust imports
cjdsellers Feb 23, 2024
c34721b
Standardize expect message
cjdsellers Feb 23, 2024
295ce51
Cleanup Databento adapter dependencies
cjdsellers Feb 23, 2024
cdfd644
Cleanup Databento adapter imports
cjdsellers Feb 23, 2024
026569c
Fix OrderBookDeltas capsule transfers
cjdsellers Feb 23, 2024
098c61b
Standardize section comments
cjdsellers Feb 24, 2024
53d62e4
Add Venue constants
cjdsellers Feb 24, 2024
9ed4b2c
Standardize record vs message
cjdsellers Feb 24, 2024
320d0d8
Implement CME Globex exchange venue mappings
cjdsellers Feb 24, 2024
a16404e
Update dependencies
cjdsellers Feb 24, 2024
c7049db
Add FuturesSpread instrument
cjdsellers Feb 24, 2024
29a1ca2
Add FuturesSpread instrument
cjdsellers Feb 24, 2024
f174fed
Add OptionsSpread instrument
cjdsellers Feb 24, 2024
5ecb84b
Update core Databento decoding
cjdsellers Feb 25, 2024
1aa96a3
Improve price and quantity precision validation
cjdsellers Feb 25, 2024
f32d817
Fix betfair trade ID (#1513)
limx0 Feb 25, 2024
595f4f5
Add missing enum test
cjdsellers Feb 25, 2024
065edbe
Update Databento mixed spread decoding
cjdsellers Feb 25, 2024
702bae9
Standardize TradeId maximum length
cjdsellers Feb 25, 2024
0966369
Fix formatting
cjdsellers Feb 25, 2024
303b9f4
Update release notes
cjdsellers Feb 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*.tar.gz*
*.zip

*.dbn
*.dbn.zst

.benchmarks*
.coverage*
.history*
Expand All @@ -34,6 +37,7 @@
.vscode/

/catalog/
/examples/notebooks/catalog/

__pycache__
_build/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repos:
types: [python]

- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.2.0
hooks:
- id: black
types_or: [python, pyi]
Expand All @@ -82,7 +82,7 @@ repos:
exclude: "docs/_pygments/monokai.py"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.2.2
hooks:
- id: ruff
args: ["--fix"]
Expand Down
44 changes: 44 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# NautilusTrader 1.188.0 Beta

Released on 25th February 2024 (UTC).

### Enhancements
- Added `FuturesSpread` instrument type
- Added `OptionsSpread` instrument type
- Added `InstrumentClass.FUTURE_SPREAD`
- Added `InstrumentClass.OPTION_SPREAD`
- Added `managed` parameter to `subscribe_order_book_deltas`, default true to retain current behavior (if false then the data engine will not automatically manage a book)
- Added `managed` parameter to `subscribe_order_book_snapshots`, default true to retain current behavior (if false then the data engine will not automatically manage a book)
- Added additional validations for `OrderMatchingEngine` (will now reject orders with incorrect price or quantity precisions)
- Removed `interval_ms` 20 millisecond limitation for `subscribe_order_book_snapshots` (i.e. just needs to be positive), although we recommend you consider subscribing to deltas below 100 milliseconds
- Ported `LiveClock` and `LiveTimer` implementations to Rust
- Implemented `OrderBookDeltas` pickling
- Implemented `AverageTrueRange` in Rust, thanks @rsmb7z

### Breaking Changes
- Changed `TradeId` value maximum length to 36 characters (will raise a `ValueError` if value exceeds the maximum)

### Fixes
- Fixed `TradeId` memory leak due assigning unique values to the `Ustr` global string cache (which are never freed for the lifetime of the program)
- Fixed `TradeTick` size precision for pyo3 conversion (size precision was incorrectly price precision)
- Fixed `RiskEngine` cash value check when selling (would previously divide quantity by price which is too much), thanks for reporting@AnthonyVince
- Fixed FOK time in force behavior (allows fills beyond the top level, will cancel if cannot fill full size)
- Fixed IOC time in force behavior (allows fills beyond the top level, will cancel any remaining after all fills are applied)
- Fixed `LiveClock` timer behavior for small intervals causing next time to be less than now (timer then would not run)
- Fixed log level filtering for `log_level_file` (bug introduced in v1.187.0), thanks @twitu
- Fixed logging `print_config` config option (was not being passed through to the logging system)
- Fixed logging timestamps for backtesting (static clock was not being incrementally set to individual `TimeEvent` timestamps)
- Fixed account balance updates (fills from zero quantity `NETTING` positions will generate account balance updates)
- Fixed `MessageBus` publishable types collection type (needed to be `tuple` not `set`)
- Fixed `Controller` registration of components to ensure all active clocks are iterated correctly during backtests
- Fixed `Equity` short selling for `CASH` accounts (will now reject)
- Fixed `ActorFactory.create` JSON encoding (was missing the encoding hook)
- Fixed `ImportableConfig.create` JSON encoding (was missing the encoding hook)
- Fixed `ImportableStrategyConfig.create` JSON encoding (was missing the encoding hook)
- Fixed `ExecAlgorithmFactory.create` JSON encoding (was missing the encoding hook)
- Fixed `ControllerConfig` base class and docstring
- Fixed Interactive Brokers historical bar data bug, thanks @benjaminsingleton
- Fixed persistence `freeze_dict` function to handle `fs_storage_options`, thanks @dimitar-petrov

---

# NautilusTrader 1.187.0 Beta

Released on 9th February 2024 (UTC).
Expand Down
119 changes: 119 additions & 0 deletions examples/live/binance/binance_spot_orderbook_imbalance_rust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env python3
# -------------------------------------------------------------------------------------------------
# Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
# https://nautechsystems.io
#
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------------------------------------

from decimal import Decimal

from nautilus_trader.adapters.binance.common.enums import BinanceAccountType
from nautilus_trader.adapters.binance.config import BinanceDataClientConfig
from nautilus_trader.adapters.binance.config import BinanceExecClientConfig
from nautilus_trader.adapters.binance.factories import BinanceLiveDataClientFactory
from nautilus_trader.adapters.binance.factories import BinanceLiveExecClientFactory
from nautilus_trader.config import CacheConfig
from nautilus_trader.config import InstrumentProviderConfig
from nautilus_trader.config import LiveExecEngineConfig
from nautilus_trader.config import LoggingConfig
from nautilus_trader.config import TradingNodeConfig
from nautilus_trader.examples.strategies.orderbook_imbalance_rust import OrderBookImbalance
from nautilus_trader.examples.strategies.orderbook_imbalance_rust import OrderBookImbalanceConfig
from nautilus_trader.live.node import TradingNode
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.identifiers import TraderId


# *** THIS IS A TEST STRATEGY WITH NO ALPHA ADVANTAGE WHATSOEVER. ***
# *** IT IS NOT INTENDED TO BE USED TO TRADE LIVE WITH REAL MONEY. ***


# Configure the trading node
config_node = TradingNodeConfig(
trader_id=TraderId("TESTER-001"),
logging=LoggingConfig(
log_level="INFO",
# log_level_file="DEBUG",
# log_file_format="json",
),
exec_engine=LiveExecEngineConfig(
reconciliation=True,
reconciliation_lookback_mins=1440,
filter_position_reports=True,
),
cache=CacheConfig(
database=None,
timestamps_as_iso8601=True,
flush_on_start=False,
),
# snapshot_orders=True,
# snapshot_positions=True,
# snapshot_positions_interval=5.0,
data_clients={
"BINANCE": BinanceDataClientConfig(
api_key=None, # 'BINANCE_API_KEY' env var
api_secret=None, # 'BINANCE_API_SECRET' env var
account_type=BinanceAccountType.SPOT,
base_url_http=None, # Override with custom endpoint
base_url_ws=None, # Override with custom endpoint
us=False, # If client is for Binance US
testnet=False, # If client uses the testnet
instrument_provider=InstrumentProviderConfig(load_all=True),
),
},
exec_clients={
"BINANCE": BinanceExecClientConfig(
api_key=None, # 'BINANCE_API_KEY' env var
api_secret=None, # 'BINANCE_API_SECRET' env var
account_type=BinanceAccountType.SPOT,
base_url_http=None, # Override with custom endpoint
base_url_ws=None, # Override with custom endpoint
us=False, # If client is for Binance US
testnet=False, # If client uses the testnet
instrument_provider=InstrumentProviderConfig(load_all=True),
),
},
timeout_connection=20.0,
timeout_reconciliation=10.0,
timeout_portfolio=10.0,
timeout_disconnection=10.0,
timeout_post_stop=5.0,
)

# Instantiate the node with a configuration
node = TradingNode(config=config_node)

# Configure your strategy
strat_config = OrderBookImbalanceConfig(
instrument_id=InstrumentId.from_str("ETHUSDT.BINANCE"),
external_order_claims=[InstrumentId.from_str("ETHUSDT.BINANCE")],
max_trade_size=Decimal("0.010"),
)

# Instantiate your strategy
strategy = OrderBookImbalance(config=strat_config)

# Add your strategies and modules
node.trader.add_strategy(strategy)

# Register your client factories with the node (can take user defined factories)
node.add_data_client_factory("BINANCE", BinanceLiveDataClientFactory)
node.add_exec_client_factory("BINANCE", BinanceLiveExecClientFactory)
node.build()


# Stop and dispose of the node with SIGINT/CTRL+C
if __name__ == "__main__":
try:
node.run()
finally:
node.dispose()
27 changes: 15 additions & 12 deletions examples/live/databento/databento_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
# limitations under the License.
# -------------------------------------------------------------------------------------------------

from nautilus_trader.adapters.databento.config import DatabentoDataClientConfig
from nautilus_trader.adapters.databento.constants import DATABENTO
from nautilus_trader.adapters.databento.constants import DATABENTO_CLIENT_ID
from nautilus_trader.adapters.databento.factories import DatabentoLiveDataClientFactory
from nautilus_trader.adapters.databento import DATABENTO
from nautilus_trader.adapters.databento import DATABENTO_CLIENT_ID
from nautilus_trader.adapters.databento import DatabentoDataClientConfig
from nautilus_trader.adapters.databento import DatabentoLiveDataClientFactory
from nautilus_trader.cache.config import CacheConfig
from nautilus_trader.common.config import DatabaseConfig
from nautilus_trader.common.enums import LogColor
from nautilus_trader.config import InstrumentProviderConfig
from nautilus_trader.config import LiveExecEngineConfig
Expand All @@ -43,8 +45,9 @@
# For correct subscription operation, you must specify all instruments to be immediately
# subscribed for as part of the data client configuration
instrument_ids = [
InstrumentId.from_str("ESH4.GLBX"),
# InstrumentId.from_str("ESM4.GLBX"),
InstrumentId.from_str("ESH4.XCME"),
# InstrumentId.from_str("ESM4.XCME"),
# InstrumentId.from_str("ESU4.XCME"),
# InstrumentId.from_str("AAPL.XCHI"),
]

Expand All @@ -56,12 +59,12 @@
reconciliation=False, # Not applicable
inflight_check_interval_ms=0, # Not applicable
),
# cache=CacheConfig(
# database=DatabaseConfig(),
# encoding="json",
# timestamps_as_iso8601=True,
# buffer_interval_ms=100,
# ),
cache=CacheConfig(
database=DatabaseConfig(),
encoding="msgpack",
timestamps_as_iso8601=True,
buffer_interval_ms=100,
),
# message_bus=MessageBusConfig(
# database=DatabaseConfig(),
# encoding="json",
Expand Down
13 changes: 8 additions & 5 deletions examples/notebooks/backtest_binance_orderbook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Backtest on Binance OrderBook data\n",
"\n",
"This example runs through how to setup the data catalog and a `BacktestNode` to backtest an `OrderBookImbalance` strategy or order book data. This example requires you bring your Binance own order book data.\n",
"This tutorial runs through how to setup the data catalog and a `BacktestNode` to backtest an `OrderBookImbalance` strategy or order book data. This example requires you bring your Binance own order book data.\n",
"\n",
"**Warning:**\n",
"\n",
Expand Down Expand Up @@ -41,14 +41,17 @@
"import pandas as pd\n",
"\n",
"from nautilus_trader.backtest.node import BacktestNode\n",
"from nautilus_trader.backtest.node import BacktestVenueConfig\n",
"from nautilus_trader.backtest.node import BacktestDataConfig\n",
"from nautilus_trader.backtest.node import BacktestRunConfig\n",
"from nautilus_trader.backtest.node import BacktestEngineConfig\n",
"from nautilus_trader.core.datetime import dt_to_unix_nanos\n",
"from nautilus_trader.config import BacktestRunConfig, BacktestVenueConfig, BacktestDataConfig, BacktestEngineConfig\n",
"from nautilus_trader.config import ImportableStrategyConfig\n",
"from nautilus_trader.config import LoggingConfig\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACross, EMACrossConfig\n",
"from nautilus_trader.model.data import OrderBookDelta\n",
"from nautilus_trader.persistence.loaders import BinanceOrderBookDeltaDataLoader\n",
"from nautilus_trader.persistence.wranglers import OrderBookDeltaDataWranglerV2\n",
"from nautilus_trader.persistence.wranglers import OrderBookDeltaDataWrangler\n",
"from nautilus_trader.persistence.catalog import ParquetDataCatalog\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider"
]
Expand Down Expand Up @@ -113,7 +116,7 @@
"source": [
"# Process deltas using a wrangler\n",
"BTCUSDT_BINANCE = TestInstrumentProvider.btcusdt_binance()\n",
"wrangler = OrderBookDeltaDataWranglerV2(BTCUSDT_BINANCE)\n",
"wrangler = OrderBookDeltaDataWrangler(BTCUSDT_BINANCE)\n",
"\n",
"deltas = wrangler.process(df_snap)\n",
"deltas += wrangler.process(df_update)\n",
Expand Down Expand Up @@ -146,7 +149,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Write instrument and ticks to catalog (this currently takes a minute - investigating)\n",
"# Write instrument and ticks to catalog\n",
"catalog.write_data([BTCUSDT_BINANCE])\n",
"catalog.write_data(deltas)"
]
Expand Down
15 changes: 13 additions & 2 deletions examples/notebooks/backtest_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "0",
"metadata": {},
"source": [
"# Complete backtest using the data catalog and a BacktestNode (higher level)\n",
"# Complete backtest using the data catalog and a BacktestNode (high-level API)\n",
"\n",
"This example runs through how to setup the data catalog and a `BacktestNode` for a single 'one-shot' backtest run."
]
Expand All @@ -32,8 +32,11 @@
"import pandas as pd\n",
"\n",
"from nautilus_trader.backtest.node import BacktestNode\n",
"from nautilus_trader.backtest.node import BacktestVenueConfig\n",
"from nautilus_trader.backtest.node import BacktestDataConfig\n",
"from nautilus_trader.backtest.node import BacktestRunConfig\n",
"from nautilus_trader.backtest.node import BacktestEngineConfig\n",
"from nautilus_trader.core.datetime import dt_to_unix_nanos\n",
"from nautilus_trader.config import BacktestRunConfig, BacktestVenueConfig, BacktestDataConfig, BacktestEngineConfig\n",
"from nautilus_trader.config import ImportableStrategyConfig\n",
"from nautilus_trader.config import LoggingConfig\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACross, EMACrossConfig\n",
Expand Down Expand Up @@ -170,6 +173,14 @@
"source": [
"result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/backtest_fx_usdjpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"id": "0",
"metadata": {},
"source": [
"# Complete backtest using a wrangler and BacktestEngine (lower level)\n",
"# Complete backtest using a wrangler and BacktestEngine (low-level API)\n",
"\n",
"This example runs through how to setup a `BacktestEngine` for a single 'one-shot' backtest run."
"This tutorial runs through how to setup a `BacktestEngine` for a single 'one-shot' backtest run."
]
},
{
Expand Down
Loading
Loading