Skip to content

Commit

Permalink
Update gh-pages to output generated at a79c2bb
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Jan 22, 2024
1 parent 799cef6 commit 1c5bb14
Show file tree
Hide file tree
Showing 5,970 changed files with 27,961 additions and 1,738,288 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 3a8db2a01e84bab4b905f0628d80935d
config: 2cc4fc082a3721222847b5586df58780
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified .doctrees/api_reference/accounting.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/adapters/betfair.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/adapters/binance.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/adapters/interactive_brokers.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/analysis.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/backtest.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/cache.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/common.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/config.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/core.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/data.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/execution.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/index.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/indicators.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/live.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/book.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/data.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/events.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/identifiers.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/instruments.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/objects.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/orders.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/position.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/model/tick_scheme.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/persistence.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/portfolio.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/risk.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/serialization.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/system.doctree
Binary file not shown.
Binary file modified .doctrees/api_reference/trading.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/adapters.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/advanced/custom_data.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/advanced/index.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/advanced/portfolio_statistics.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/advanced/synthetic_instruments.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/data.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/instruments.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/logging.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/overview.doctree
Binary file not shown.
Binary file modified .doctrees/concepts/strategies.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/getting_started/installation.doctree
Binary file not shown.
Binary file modified .doctrees/getting_started/quickstart.doctree
Binary file not shown.
Binary file modified .doctrees/index.doctree
Binary file not shown.
Binary file modified .doctrees/integrations/ib.doctree
Binary file not shown.
Binary file modified .doctrees/rust.doctree
Binary file not shown.
Binary file modified .doctrees/tutorials/backtest_high_level.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion _sources/api_reference/index.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ from the latest NautilusTrader source code using [Sphinx](https://www.sphinx-doc
Please note that there are separate references for different versions of NautilusTrader:

- **Latest**: This API reference is built from the head of the `master` branch and represents the latest stable release.
- **Develop**: This API reference is built from the head of the `develop` branch and represents bleeding edge and experimental changes/features currently in development.
- **Nightly**: This API reference is built from the head of the `nightly` branch and represents bleeding edge and experimental changes/features currently in development.

You can select the desired API reference from the **Versions** top right drop down menu.

Expand Down
5 changes: 1 addition & 4 deletions _sources/concepts/adapters.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ 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.logging import Logger


clock = LiveClock()
Expand All @@ -37,7 +36,6 @@ account_type = BinanceAccountType.USDT_FUTURE
client = get_cached_binance_http_client(
loop=asyncio.get_event_loop(),
clock=clock,
logger=Logger(clock=clock),
account_type=account_type,
key=os.getenv("BINANCE_FUTURES_TESTNET_API_KEY"),
secret=os.getenv("BINANCE_FUTURES_TESTNET_API_SECRET"),
Expand All @@ -47,7 +45,6 @@ await client.connect()

provider = BinanceFuturesInstrumentProvider(
client=client,
logger=Logger(clock=clock),
account_type=BinanceAccountType.USDT_FUTURE,
)

Expand Down Expand Up @@ -132,7 +129,7 @@ from nautilus_trader.model.identifiers import InstrumentId

# nautilus_trader/adapters/binance/spot/data.py
def request_instrument(self, instrument_id: InstrumentId, correlation_id: UUID4):
instrument: Optional[Instrument] = self._instrument_provider.find(instrument_id)
instrument: Instrument | None = self._instrument_provider.find(instrument_id)
if instrument is None:
self._log.error(f"Cannot find instrument for {instrument_id}.")
return
Expand Down
4 changes: 2 additions & 2 deletions _sources/concepts/advanced/custom_data.md.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Custom/Generic Data
# Custom Data
Due to the modular nature of the Nautilus design, it is possible to set up systems
with very flexible data streams, including custom user defined data types. This
guide covers some possible use cases for this functionality.
Expand Down Expand Up @@ -92,7 +92,7 @@ self.subscribe_data(

This will result in your actor/strategy passing these received `MyDataPoint`
objects to your `on_data` method. You will need to check the type, as this
method acts as a flexible handler for all custom/generic data.
method acts as a flexible handler for all custom data.

```python
def on_data(self, data: Data) -> None:
Expand Down
2 changes: 1 addition & 1 deletion _sources/concepts/advanced/index.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ highest to lowest level (although they are self-contained and can be read in any
Explore more advanced concepts of NautilusTrader through these guides:

- [Actors](actors.md)
- [Custom/Generic data](custom_data.md)
- [Custom Data](custom_data.md)
- [Advanced Orders](advanced_orders.md)
- [Emulated Orders](emulated_orders.md)
- [Synthetic Instruments](synthetic_instruments.md)
Expand Down
2 changes: 1 addition & 1 deletion _sources/concepts/advanced/portfolio_statistics.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WinRate(PortfolioStatistic):
Calculates the win rate from a realized PnLs series.
"""

def calculate_from_realized_pnls(self, realized_pnls: pd.Series) -> Optional[Any]:
def calculate_from_realized_pnls(self, realized_pnls: pd.Series) -> Any | None:
# Preconditions
if realized_pnls is None or realized_pnls.empty:
return 0.0
Expand Down
4 changes: 2 additions & 2 deletions _sources/concepts/advanced/synthetic_instruments.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Note that the venue for a synthetic instrument is always designated as `'SYNTH'`
## Formula
A synthetic instrument is composed of a combination of two or more component instruments (which
can include instruments from multiple venues), as well as a "derivation formula".
Utilizing the dynamic expression engine powered by the [evalexpr](https://github.com/ISibboI/evalexpr)
Rust library, the platform can evaluate the formula to calculate the latest synthetic price tick
Utilizing the dynamic expression engine powered by the [evalexpr](https://github.com/ISibboI/evalexpr)
Rust crate, the platform can evaluate the formula to calculate the latest synthetic price tick
from the incoming component instrument prices.

See the `evalexpr` documentation for a full description of available features, operators and precedence.
Expand Down
14 changes: 6 additions & 8 deletions _sources/concepts/data.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This inheritance ensures chronological data ordering (vital for backtesting), wh
Consistency is key; data flows through the platform in exactly the same way for all system environment contexts (`backtest`, `sandbox`, `live`)
primarily through the `MessageBus` to the `DataEngine` and onto subscribed or registered handlers.

For those seeking customization, the platform supports user-defined data types. Refer to the advanced [Custom/Generic data guide](advanced/custom_data.md) for more details.
For those seeking customization, the platform supports user-defined data types. Refer to the advanced [Custom data guide](advanced/custom_data.md) for more details.

## Loading data

Expand Down Expand Up @@ -88,16 +88,14 @@ Conceretely, this would involve:

The following example shows how to accomplish the above in Python:
```python
import os

from nautilus_trader import PACKAGE_ROOT
from nautilus_trader import TEST_DATA_DIR
from nautilus_trader.persistence.loaders import BinanceOrderBookDeltaDataLoader
from nautilus_trader.persistence.wranglers import OrderBookDeltaDataWrangler
from nautilus_trader.test_kit.providers import TestInstrumentProvider


# Load raw data
data_path = os.path.join(PACKAGE_ROOT, "tests/test_data/binance/binance/btcusdt-depth-snap.csv")
data_path = TEST_DATA_DIR / "binance" / "btcusdt-depth-snap.csv"
df = BinanceOrderBookDeltaDataLoader.load(data_path)

# Setup a wrangler
Expand All @@ -117,7 +115,7 @@ We have chosen Parquet as the storage format for the following reasons:
- It does not require any separate running components (for example a database)
- It is quick and simple to get up and running with

The Arrow schemas used for the Parquet format are either single sourced in the core `persistence` Rust library, or available
The Arrow schemas used for the Parquet format are either single sourced in the core `persistence` Rust crate, or available
from the `/serialization/arrow/schema.py` module.

```{note}
Expand All @@ -130,11 +128,11 @@ The data catalog can be initialized from a `NAUTILUS_PATH` environment variable,
The following example shows how to initialize a data catalog where there is pre-existing data already written to disk at the given path.

```python
import os
from pathlib import Path
from nautilus_trader.persistence.catalog import ParquetDataCatalog


CATALOG_PATH = os.getcwd() + "/catalog"
CATALOG_PATH = Path.cwd() / "catalog"

# Create a new catalog instance
catalog = ParquetDataCatalog(CATALOG_PATH)
Expand Down
7 changes: 2 additions & 5 deletions _sources/concepts/instruments.md.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Instruments

The `Instrument` base class represents the core specification for any tradable asset/contract. There are
currently a number of subclasses representing a range of _asset classes_ and _asset types_ which are supported by the platform:
currently a number of subclasses representing a range of _asset classes_ and _instrument classes_ which are supported by the platform:
- `Equity` (generic Equity)
- `Future` (generic Futures Contract)
- `Option` (generic Options Contract)
Expand Down Expand Up @@ -37,10 +37,7 @@ Exchange specific instruments can be discovered from live exchange data using an
from nautilus_trader.adapters.binance.spot.providers import BinanceSpotInstrumentProvider
from nautilus_trader.model.identifiers import InstrumentId

provider = BinanceSpotInstrumentProvider(
client=binance_http_client,
logger=live_logger,
)
provider = BinanceSpotInstrumentProvider(client=binance_http_client)
await self.provider.load_all_async()

btcusdt = InstrumentId.from_str("BTCUSDT.BINANCE")
Expand Down
47 changes: 36 additions & 11 deletions _sources/concepts/logging.md.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Logging

The platform provides logging for both backtesting and live trading using a high-performance logger implemented in Rust.
The logger operates in a separate thread and uses a multi-producer single consumer (MPSC) channel to receive log messages.
This design ensures that the main thread is not blocked by log string formatting or file I/O operations.
The platform provides logging for both backtesting and live trading using a high-performance logging system implemented in Rust
with a standardized facade from the `log` crate.

```{note}
The latest stable Rust MPSC channel is used, which is now based on the `crossbeam` implementation.
```
The core logger operates in a separate thread and uses a multi-producer single consumer (MPSC) channel to receive log messages.
This design ensures that the main thread is not blocked by log string formatting or file I/O operations.

There are two configurable writers for logging:
- stdout/stderr writer
Expand All @@ -19,11 +17,12 @@ Infrastructure such as [vector](https://github.com/vectordotdev/vector) can be c
Logging can be configured by importing the `LoggingConfig` object.
By default, log events with an 'INFO' `LogLevel` and higher are written to stdout/stderr.

Log level (`LogLevel`) values include:
- 'DEBUG' or 'DBG'
- 'INFO' or 'INF'
- 'WARNING' or 'WRN'
- 'ERROR' or 'ERR'
Log level (`LogLevel`) values include (and generally match Rusts `tracing` level filters):
- `OFF`
- `DEBUG`
- `INFO`
- `WARNING` or `WARN`
- `ERROR`

```{note}
See the `LoggingConfig` [API Reference](../api_reference/config.md#LoggingConfig) for further details.
Expand All @@ -33,8 +32,12 @@ Logging can be configured in the following ways:
- Minimum `LogLevel` for stdout/stderr
- Minimum `LogLevel` for log files
- Automatic log file naming and daily rotation, or custom log file name
- Directory for writing log files
- Plain text or JSON log file formatting
- Filtering of individual components by log level
- ANSI colors in log lines
- Bypass logging completely
- Print Rust config to stdout at initialization

### Standard output logging
Log messages are written to the console via stdout/stderr writers. The minimum log level can be configured using the `log_level` parameter.
Expand Down Expand Up @@ -95,3 +98,25 @@ these color codes may not be appropriate as they can appear as raw text.
To accommodate for such scenarios, the `LoggingConfig.log_colors` option can be set to `false`.
Disabling `log_colors` will prevent the addition of ANSI color codes to the log messages, ensuring
compatibility across different environments where color rendering is not supported.

### Using a Logger directly

It's possible to use `Logger` objects directly, and these can be initialized anywhere (very similar to the Python built-in `logging` API).

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

init_logging()
logger = Logger("MyLogger")
```

```{note}
See the `init_logging` [API Reference](../api_reference/common.md#init_logging) for further details.
```

```{warning}
Only one logging system can be initialized per process with an `init_logging` call.
```
5 changes: 3 additions & 2 deletions _sources/concepts/overview.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ which are used to aggregate multiple events to determine state.
### Data Types
The following market data types can be requested historically, and also subscribed to as live streams when available from a venue / data provider, and implemented in an integrations adapter.
- `OrderBookDelta` (L1/L2/L3)
- `Ticker`
- `OrderBookDeltas` (container type)
- `OrderBookDepth10` (fixed depth of 10 levels per side)
- `QuoteTick`
- `TradeTick`
- `Bar`
- `Instrument`
- `VenueStatus`
- `InstrumentStatus`
- `InstrumentClose`
- `VenueStatus`

The following PriceType options can be used for bar aggregations;
- `BID`
Expand Down
13 changes: 6 additions & 7 deletions _sources/concepts/strategies.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ from nautilus_trader.model.data import OrderBookDeltas
from nautilus_trader.model.data import InstrumentClose
from nautilus_trader.model.data import InstrumentStatus
from nautilus_trader.model.data import VenueStatus
from nautilus_trader.model.data import Ticker
from nautilus_trader.model.instruments import Instrument

def on_order_book_deltas(self, deltas: OrderBookDeltas) -> None:
def on_order_book(self, order_book: OrderBook) -> None:
def on_ticker(self, ticker: Ticker) -> None:
def on_quote_tick(self, tick: QuoteTick) -> None:
def on_trade_tick(self, tick: TradeTick) -> None:
def on_bar(self, bar: Bar) -> None:
Expand All @@ -105,7 +103,7 @@ def on_instrument(self, instrument: Instrument) -> None:
def on_instrument_status(self, data: InstrumentStatus) -> None:
def on_instrument_close(self, data: InstrumentClose) -> None:
def on_historical_data(self, data: Data) -> None:
def on_data(self, data: Data) -> None: # Generic data passed to this handler
def on_data(self, data: Data) -> None: # Custom data passed to this handler
```

#### Order management
Expand Down Expand Up @@ -515,13 +513,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
Expand All @@ -542,8 +541,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",
)
Expand Down
5 changes: 3 additions & 2 deletions _sources/getting_started/installation.md.txt
Original file line number Diff line number Diff line change
@@ -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 |
|------------------------|-----------------------|-------------------|
Expand All @@ -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

Expand Down
Loading

0 comments on commit 1c5bb14

Please sign in to comment.