Skip to content

Commit

Permalink
Consolidate test providers to test_kit
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Mar 11, 2023
1 parent af3a720 commit 37df187
Show file tree
Hide file tree
Showing 132 changed files with 617 additions and 638 deletions.
18 changes: 8 additions & 10 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
Released on 11th March 2023 (UTC).

### Breaking Changes
- Moved `TestInstrumentProvider` to `backtest.providers`
- Moved `TestDataProvider` to `test_kit.providers`
- Moved wranglers to `persistence.wranglers`
- Moved loaders to `persistence.loaders` (to be consolidated)
- Moved `backtest.providers` to `test_kit.providers`
- Moved `backtest.data.wranglers` to `persistence.wranglers` (to be consolidated)
- Moved `backtest.data.loaders` to `persistence.loaders` (to be consolidated)
- Renamed `from_datetime` to `start` across data request methods and properties
- Renamed `to_datetime` to `end` across data request methods and properties
- Change parquet catalog schema dictionary integer key widths/types
- Removed `RiskEngineConfig.deny_modify_pending_update` (as now redundant with new pending event sequencing)
- Removed redundant log sink machinery
- All pickled data due Cython 3.0.0b1
- Changed parquet catalog schema dictionary integer key widths/types
- Invalidated all pickled data due to Cython 3.0.0b1 upgrade

### Enhancements
- Added logging to file at core Rust level
- Added `DataCatalogConfig` for more cohesive data catalog configuration
- Added `DataEngine.register_catalog` to support historical data requests
- Added `catalog_config` field to base `NautilusKernelConfig`
- Changed to immediately caching orders and order lists in `Strategy`
- Changed to checking duplicate `client_order_id` and `order_list_id` in `Strategy`
- Changed generating and applying `OrderPendingUpdate` and `OrderPendingCancel` in `Strategy`
- `PortfolioAnalyzer` PnL statistics now take optional `unrealized_pnl`
- Backtest performance statistics now include unrealized PnL in total PnL
- Now immediately caching orders and order lists in `Strategy`
- Now checking duplicate `client_order_id` and `order_list_id` in `Strategy`
- Now generates and applies `OrderPendingUpdate` and `OrderPendingCancel` in `Strategy`
- Upgrade Cython to `3.0.0b1`

### Fixes
- Fixed Binance Futures trigger type parsing
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/backtest_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ from nautilus_trader.core.datetime import dt_to_unix_nanos
from nautilus_trader.model.data.tick import QuoteTick
from nautilus_trader.model.objects import Price, Quantity

from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider
from nautilus_trader.backtest.node import BacktestNode, BacktestVenueConfig, BacktestDataConfig, BacktestRunConfig, BacktestEngineConfig
from nautilus_trader.config.common import ImportableStrategyConfig
from nautilus_trader.persistence.catalog import ParquetDataCatalog
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/loading_external_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ See [Instruments](./instruments.md) for more details on creating other instrumen

```python
from nautilus_trader.persistence.external.core import process_files, write_objects
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider

# Use nautilus test helpers to create a EUR/USD FX instrument for our purposes
instrument = TestInstrumentProvider.default_fx_ccy("EUR/USD")
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/betfair_backtest_orderbook_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from nautilus_trader.adapters.betfair.parsing.core import BetfairParser
from nautilus_trader.backtest.engine import BacktestEngine
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.orderbook_imbalance import OrderBookImbalance
from nautilus_trader.examples.strategies.orderbook_imbalance import OrderBookImbalanceConfig
from nautilus_trader.model.currencies import GBP
Expand All @@ -32,6 +31,7 @@
from nautilus_trader.model.enums import OmsType
from nautilus_trader.model.identifiers import ClientId
from nautilus_trader.model.objects import Money
from nautilus_trader.test_kit.providers import TestInstrumentProvider
from tests.integration_tests.adapters.betfair.test_kit import BetfairDataProvider


Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/crypto_ema_cross_ethusdt_trade_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from nautilus_trader.backtest.engine import BacktestEngine
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.ema_cross import EMACross
from nautilus_trader.examples.strategies.ema_cross import EMACrossConfig
from nautilus_trader.model.currencies import ETH
Expand All @@ -32,6 +31,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import TradeTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from nautilus_trader.backtest.engine import BacktestEngine
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.ema_cross_trailing_stop import EMACrossTrailingStop
from nautilus_trader.examples.strategies.ema_cross_trailing_stop import EMACrossTrailingStopConfig
from nautilus_trader.model.currencies import ETH
Expand All @@ -32,6 +31,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import TradeTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.backtest.modules import FXRolloverInterestConfig
from nautilus_trader.backtest.modules import FXRolloverInterestModule
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.ema_cross import EMACross
from nautilus_trader.examples.strategies.ema_cross import EMACrossConfig
from nautilus_trader.model.currencies import USD
Expand All @@ -33,6 +32,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_ema_cross_audusd_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from nautilus_trader.backtest.models import FillModel
from nautilus_trader.backtest.modules import FXRolloverInterestConfig
from nautilus_trader.backtest.modules import FXRolloverInterestModule
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.ema_cross import EMACross
from nautilus_trader.examples.strategies.ema_cross import EMACrossConfig
from nautilus_trader.model.currencies import USD
Expand All @@ -34,6 +33,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from nautilus_trader.backtest.models import FillModel
from nautilus_trader.backtest.modules import FXRolloverInterestConfig
from nautilus_trader.backtest.modules import FXRolloverInterestModule
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.config.common import RiskEngineConfig
from nautilus_trader.examples.strategies.ema_cross_bracket import EMACrossBracket
from nautilus_trader.examples.strategies.ema_cross_bracket import EMACrossBracketConfig
Expand All @@ -36,6 +35,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import BarDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from nautilus_trader.backtest.models import FillModel
from nautilus_trader.backtest.modules import FXRolloverInterestConfig
from nautilus_trader.backtest.modules import FXRolloverInterestModule
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.config.common import RiskEngineConfig
from nautilus_trader.examples.strategies.ema_cross_bracket import EMACrossBracket
from nautilus_trader.examples.strategies.ema_cross_bracket import EMACrossBracketConfig
Expand All @@ -35,6 +34,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_market_maker_gbpusd_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from nautilus_trader.backtest.models import FillModel
from nautilus_trader.backtest.modules import FXRolloverInterestConfig
from nautilus_trader.backtest.modules import FXRolloverInterestModule
from nautilus_trader.backtest.providers import TestInstrumentProvider
from nautilus_trader.examples.strategies.volatility_market_maker import VolatilityMarketMaker
from nautilus_trader.examples.strategies.volatility_market_maker import VolatilityMarketMakerConfig
from nautilus_trader.model.currencies import USD
Expand All @@ -35,6 +34,7 @@
from nautilus_trader.model.objects import Money
from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler
from nautilus_trader.test_kit.providers import TestDataProvider
from nautilus_trader.test_kit.providers import TestInstrumentProvider


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/backtest_fx_usdjpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"from nautilus_trader.backtest.models import FillModel\n",
"from nautilus_trader.backtest.modules import FXRolloverInterestConfig\n",
"from nautilus_trader.backtest.modules import FXRolloverInterestModule\n",
"from nautilus_trader.backtest.providers import TestInstrumentProvider\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.config.common import RiskEngineConfig\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACross\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACrossConfig\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/external_data_backtest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"from nautilus_trader.model.data.tick import QuoteTick\n",
"from nautilus_trader.model.objects import Price, Quantity\n",
"\n",
"from nautilus_trader.backtest.providers import TestInstrumentProvider\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.backtest.node import BacktestNode, BacktestVenueConfig, BacktestDataConfig, BacktestRunConfig, BacktestEngineConfig\n",
"from nautilus_trader.config.common import ImportableStrategyConfig\n",
"from nautilus_trader.persistence.catalog import ParquetDataCatalog\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"from nautilus_trader.model.data.tick import QuoteTick\n",
"from nautilus_trader.model.objects import Price, Quantity\n",
"\n",
"from nautilus_trader.backtest.providers import TestInstrumentProvider\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.backtest.node import BacktestNode, BacktestVenueConfig, BacktestDataConfig, BacktestRunConfig, BacktestEngineConfig\n",
"from nautilus_trader.config.common import ImportableStrategyConfig\n",
"from nautilus_trader.persistence.catalog import ParquetDataCatalog\n",
Expand Down
Loading

0 comments on commit 37df187

Please sign in to comment.