From bccf3e0bb128c0ffe2e27a8a5ae0dfb2d4d6de21 Mon Sep 17 00:00:00 2001 From: Chris Sellers Date: Sun, 31 Dec 2023 09:01:13 +1100 Subject: [PATCH] Update docs --- README.md | 20 +++++++++---------- docs/concepts/strategies.md | 9 +++++---- docs/getting_started/installation.md | 5 +++-- docs/getting_started/quickstart.md | 10 ++++++---- docs/index.md | 2 +- .../bybit/bybit_request_custom_endpoint.py | 6 +++--- examples/notebooks/quick_start.ipynb | 6 +++--- 7 files changed, 31 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ae6508378a11..b87c64fee477 100644 --- a/README.md +++ b/README.md @@ -139,15 +139,15 @@ NautilusTrader is designed in a modular way to work with 'adapters' which provid connectivity to data providers and/or trading venues - converting their raw API into a unified interface. The following integrations are currently supported: -| Name | ID | Type | Status | Docs | -| :-------------------------------------------------------- | :---------- | :---------------------- | :------------------------------------------------------ | :---------------------------------------------------------------- | -| [Betfair](https://betfair.com) | `BETFAIR` | Sports betting exchange | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) | -| [Binance](https://binance.com) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | -| [Binance US](https://binance.us) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | -| [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | -| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | | -| [Databento](https://databento.com) | `DATABENTO` | Data provider | ![status](https://img.shields.io/badge/building-orange) | | -| [Interactive Brokers](https://www.interactivebrokers.com) | `IB` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) | +| Name | ID | Type | Status | Docs | +| :-------------------------------------------------------- | :-------------------- | :---------------------- | :------------------------------------------------------ | :---------------------------------------------------------------- | +| [Betfair](https://betfair.com) | `BETFAIR` | Sports betting exchange | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) | +| [Binance](https://binance.com) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | +| [Binance US](https://binance.us) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | +| [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) | +| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | | +| [Databento](https://databento.com) | `DATABENTO` | Data provider | ![status](https://img.shields.io/badge/building-orange) | | +| [Interactive Brokers](https://www.interactivebrokers.com) | `INTERACTIVE_BROKERS` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) | Refer to the [Integrations](https://docs.nautilustrader.io/integrations/index.html) documentation for further details. @@ -251,7 +251,7 @@ The below are some examples of this: ## Docker -Docker containers are built using a base `python:3.10-slim` with the following image variant tags: +Docker containers are built using a base `python:3.11-slim` with the following image variant tags: - `nautilus_trader:latest` has the latest release version installed - `nautilus_trader:develop` has the head of the `develop` branch installed diff --git a/docs/concepts/strategies.md b/docs/concepts/strategies.md index 331f032e2a09..4a50202c89c0 100644 --- a/docs/concepts/strategies.md +++ b/docs/concepts/strategies.md @@ -515,13 +515,14 @@ Here is an example configuration: ```python from decimal import Decimal from nautilus_trader.config import StrategyConfig +from nautilus_trader.model.data import BarType from nautilus_trader.model.identifiers import InstrumentId from nautilus_trader.trading.strategy import Strategy class MyStrategyConfig(StrategyConfig): - instrument_id: str - bar_type: str + instrument_id: InstrumentId + bar_type: BarType fast_ema_period: int = 10 slow_ema_period: int = 20 trade_size: Decimal @@ -542,8 +543,8 @@ class MyStrategy(Strategy): # trading strategy to initialize. config = MyStrategyConfig( - instrument_id="ETHUSDT-PERP.BINANCE", - bar_type="ETHUSDT-PERP.BINANCE-1000-TICK[LAST]-INTERNAL", + instrument_id=InstrumentId.from_str("ETHUSDT-PERP.BINANCE"), + bar_type=BarType.from_str("ETHUSDT-PERP.BINANCE-1000-TICK[LAST]-INTERNAL"), trade_size=Decimal(1), order_id_tag="001", ) diff --git a/docs/getting_started/installation.md b/docs/getting_started/installation.md index 68d82c59a55a..525976acc209 100644 --- a/docs/getting_started/installation.md +++ b/docs/getting_started/installation.md @@ -1,6 +1,6 @@ # Installation -NautilusTrader is tested and supported for Python 3.10-3.11 on the following 64-bit platforms: +NautilusTrader is tested and supported for Python 3.10-3.12 on the following 64-bit platforms: | Operating System | Supported Versions | CPU Architecture | |------------------------|-----------------------|-------------------| @@ -21,7 +21,8 @@ To install the latest binary wheel (or sdist package) from PyPI using Pythons _p Install optional dependencies as 'extras' for specific integrations: -- `betfair`: Betfair adapter +- `betfair`: Betfair adapter (integration) +- `databento`: Databento adapter (integration) - `docker`: Needed for Docker when using the IB gateway - `ib`: Interactive Brokers adapter diff --git a/docs/getting_started/quickstart.md b/docs/getting_started/quickstart.md index 1e32f921b4a8..94939a2f8b1a 100644 --- a/docs/getting_started/quickstart.md +++ b/docs/getting_started/quickstart.md @@ -79,7 +79,7 @@ from nautilus_trader.trading.strategy import Strategy, StrategyConfig class MACDConfig(StrategyConfig): - instrument_id: str + instrument_id: InstrumentId fast_period: int = 12 slow_period: int = 26 trade_size: int = 1_000_000 @@ -91,11 +91,13 @@ class MACDStrategy(Strategy): super().__init__(config=config) # Our "trading signal" self.macd = MovingAverageConvergenceDivergence( - fast_period=config.fast_period, slow_period=config.slow_period, price_type=PriceType.MID + fast_period=config.fast_period, + slow_period=config.slow_period, + price_type=PriceType.MID, ) # We copy some config values onto the class to make them easier to reference later on self.entry_threshold = config.entry_threshold - self.instrument_id = InstrumentId.from_str(config.instrument_id) + self.instrument_id = config.instrument_id self.trade_size = Quantity.from_int(config.trade_size) # Convenience @@ -173,7 +175,7 @@ To configure a `BacktestNode`, we first need to create an instance of a `Backtes following (minimal) aspects of the backtest: - `engine` - The engine for the backtest representing our core system, which will also contain our strategies -- `venues` - The simulated venues (exchanges or brokers) available in the backtest +- `venues` - The simulated execution venues (exchanges or brokers) available in the backtest - `data` - The input data we would like to perform the backtest on There are many more configurable features which will be described later in the docs, for now this will get us up and running. diff --git a/docs/index.md b/docs/index.md index 036a5c413064..8ef5929d67f4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,7 +23,7 @@ Welcome to the official documentation for NautilusTrader! providing quantitative traders with the ability to backtest portfolios of automated trading strategies on historical data with an event-driven engine, and also deploy those same strategies live, with no code changes.** -The platform boasts an extensive array of features and capabilities, coupled with open-ended flexibility for assembling +The platform provides an extensive array of features and capabilities, coupled with open-ended flexibility for assembling trading systems using the framework. Given the breadth of information, and required pre-requisite knowledge, both beginners and experts alike may find the learning curve steep. However, this documentation aims to assist you in learning and understanding NautilusTrader, so that you can then leverage it to achieve your algorithmic trading goals. diff --git a/examples/live/bybit/bybit_request_custom_endpoint.py b/examples/live/bybit/bybit_request_custom_endpoint.py index 5bc9891169c8..cc19b6149c24 100644 --- a/examples/live/bybit/bybit_request_custom_endpoint.py +++ b/examples/live/bybit/bybit_request_custom_endpoint.py @@ -46,7 +46,7 @@ class RequestDemoStrategyConfig(StrategyConfig, frozen=True): - instrument_id: str + instrument_id: InstrumentId interval: int @@ -64,7 +64,7 @@ class RequestDemoStrategy(Strategy): def __init__(self, config: RequestDemoStrategyConfig): super().__init__() self.interval = config.interval - self.instrument_id = InstrumentId.from_str(config.instrument_id) + self.instrument_id = config.instrument_id def on_start(self): seconds_delta = timedelta(seconds=self.interval) @@ -124,7 +124,7 @@ def on_historical_data(self, data: Data): node = TradingNode(config=config_node) -instrument_id = "ETHUSDT-LINEAR.BYBIT" +instrument_id = InstrumentId.from_str("ETHUSDT-LINEAR.BYBIT") strategy_config = RequestDemoStrategyConfig( instrument_id=instrument_id, interval=10, diff --git a/examples/notebooks/quick_start.ipynb b/examples/notebooks/quick_start.ipynb index 615889368fc2..c6924eaf0d5a 100644 --- a/examples/notebooks/quick_start.ipynb +++ b/examples/notebooks/quick_start.ipynb @@ -104,7 +104,7 @@ "\n", "\n", "class MACDConfig(StrategyConfig):\n", - " instrument_id: str\n", + " instrument_id: InstrumentId\n", " fast_period: int = 12\n", " slow_period: int = 26\n", " trade_size: int = 1_000_000\n", @@ -120,7 +120,7 @@ " )\n", " # We copy some config values onto the class to make them easier to reference later on\n", " self.entry_threshold = config.entry_threshold\n", - " self.instrument_id = InstrumentId.from_str(config.instrument_id)\n", + " self.instrument_id = config.instrument_id\n", " self.trade_size = Quantity.from_int(config.trade_size)\n", " self.entry_threshold = config.entry_threshold\n", "\n", @@ -323,7 +323,7 @@ " strategy_path=\"__main__:MACDStrategy\",\n", " config_path=\"__main__:MACDConfig\",\n", " config=dict(\n", - " instrument_id=instruments[0].id.value,\n", + " instrument_id=instruments[0].id,\n", " fast_period=12,\n", " slow_period=26,\n", " ),\n",