Skip to content

Commit

Permalink
Update gh-pages to output generated at 2ff65be
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Oct 24, 2023
1 parent 0b87ae5 commit 78deb7f
Show file tree
Hide file tree
Showing 69 changed files with 430 additions and 48 deletions.
Binary file modified develop/.doctrees/api_reference/accounting.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/adapters/betfair.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/adapters/binance.doctree
Binary file not shown.
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/analysis.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/backtest.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/cache.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/common.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/config.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/core.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/data.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/execution.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/indicators.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/infrastructure.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/live.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/currency.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/data.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/events.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/identifiers.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/instruments.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/objects.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/orderbook.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/orders.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/position.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/model/tick_scheme.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/msgbus.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/persistence.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/portfolio.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/risk.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/serialization.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/system.doctree
Binary file not shown.
Binary file modified develop/.doctrees/api_reference/trading.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/adapters.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/data.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/execution.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/instruments.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/logging.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/orders.doctree
Binary file not shown.
Binary file modified develop/.doctrees/concepts/strategies.doctree
Binary file not shown.
Binary file modified develop/.doctrees/environment.pickle
Binary file not shown.
Binary file modified develop/.doctrees/integrations/betfair.doctree
Binary file not shown.
Binary file modified develop/.doctrees/integrations/binance.doctree
Binary file not shown.
Binary file modified develop/.doctrees/integrations/ib.doctree
Binary file not shown.
6 changes: 6 additions & 0 deletions develop/_sources/concepts/adapters.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ as configured:
- All instruments are automatically loaded on start:

```python
from nautilus_trader.config import InstrumentProviderConfig

InstrumentProviderConfig(load_all=True)
```

Expand Down Expand Up @@ -124,6 +126,10 @@ cpdef void request_instrument(self, InstrumentId instrument_id, ClientId client_
The handler on the `ExecutionClient`:

```python
from nautilus_trader.core.uuid import UUID4
from nautilus_trader.model.data import DataType
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)
Expand Down
10 changes: 10 additions & 0 deletions develop/_sources/concepts/data.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ 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 nautilus_trader.persistence.catalog import ParquetDataCatalog


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

# Create a new catalog instance
Expand Down Expand Up @@ -159,6 +163,9 @@ Rust Arrow schema implementations and available for the follow data types (enhan
### Reading data
Any stored data can then we read back into memory:
```python
from nautilus_trader.core.datetime import dt_to_unix_nanos
import pandas as pd

start = dt_to_unix_nanos(pd.Timestamp("2020-01-03", tz=pytz.utc))
end = dt_to_unix_nanos(pd.Timestamp("2020-01-04", tz=pytz.utc))

Expand All @@ -170,6 +177,9 @@ When running backtests in streaming mode with a `BacktestNode`, the data catalog

The following example shows how to achieve this by initializing a `BacktestDataConfig` configuration object:
```python
from nautilus_trader.config import BacktestDataConfig
from nautilus_trader.model.data import OrderBookDelta

data_config = BacktestDataConfig(
catalog_path=str(catalog.path),
data_cls=OrderBookDelta,
Expand Down
2 changes: 2 additions & 0 deletions develop/_sources/concepts/execution.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ Received orders will arrive via the following `on_order(...)` method. These rece
know as "primary" (original) orders when being handled by an execution algorithm.

```python
from nautilus_trader.model.orders.base import Order

def on_order(self, order: Order) -> None: # noqa (too complex)
"""
Actions to be performed when running and receives an order.
Expand Down
9 changes: 8 additions & 1 deletion develop/_sources/concepts/instruments.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ An incorrectly specified instrument may truncate data or otherwise produce surpr
Generic test instruments can be instantiated through the `TestInstrumentProvider`:

```python
from nautilus_trader.test_kit.providers import TestInstrumentProvider

audusd = TestInstrumentProvider.default_fx_ccy("AUD/USD")
```

Exchange specific instruments can be discovered from live exchange data using an adapters `InstrumentProvider`:

```python
provider = BinanceInstrumentProvider(
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,
)
Expand All @@ -45,6 +50,8 @@ instrument = provider.find(btcusdt)
Or flexibly defined by the user through an `Instrument` constructor, or one of its more specific subclasses:

```python
from nautilus_trader.model.instruments import Instrument

instrument = Instrument(...) # <-- provide all necessary parameters
```
See the full instrument [API Reference](../api_reference/model/instruments.md).
Expand Down
3 changes: 3 additions & 0 deletions develop/_sources/concepts/logging.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ The input value should be a dictionary of component ID strings to log level stri
Below is an example of a trading node logging configuration that includes some of the options mentioned above:

```python
from nautilus_trader.config import LoggingConfig
from nautilus_trader.config import TradingNodeConfig

config_node = TradingNodeConfig(
trader_id="TESTER-001",
logging=LoggingConfig(
Expand Down
75 changes: 75 additions & 0 deletions develop/_sources/concepts/orders.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ In the following example we create a _Market_ order on the Interactive Brokers [
to BUY 100,000 AUD using USD:

```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import MarketOrder

order: MarketOrder = self.order_factory.market(
instrument_id=InstrumentId.from_str("AUD/USD.IDEALPRO"),
order_side=OrderSide.BUY,
Expand All @@ -152,6 +158,13 @@ In the following example we create a _Limit_ order on the Binance Futures Crypto
contracts at a limit price of 5000 USDT, as a market maker.

```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import LimitOrder

order: LimitOrder = self.order_factory.limit(
instrument_id=InstrumentId.from_str("ETHUSDT-PERP.BINANCE"),
order_side=OrderSide.SELL,
Expand All @@ -176,6 +189,14 @@ In the following example we create a _Stop-Market_ order on the Binance Spot/Mar
to SELL 1 BTC at a trigger price of 100,000 USDT, active until further notice:

```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import StopMarketOrder

order: StopMarketOrder = self.order_factory.stop_market(
instrument_id=InstrumentId.from_str("BTCUSDT.BINANCE"),
order_side=OrderSide.SELL,
Expand All @@ -198,6 +219,15 @@ In the following example we create a _Stop-Limit_ order on the Currenex FX ECN t
once the market hits the trigger price of 1.30010 USD, active until midday 6th June, 2022 (UTC):

```python
import pandas as pd
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import StopLimitOrder

order: StopLimitOrder = self.order_factory.stop_limit(
instrument_id=InstrumentId.from_str("GBP/USD.CURRENEX"),
order_side=OrderSide.BUY,
Expand All @@ -223,6 +253,12 @@ In the following example we create a _Market-To-Limit_ order on the Interactive
to BUY 200,000 USD using JPY:

```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import MarketToLimitOrder

order: MarketToLimitOrder = self.order_factory.market_to_limit(
instrument_id=InstrumentId.from_str("USD/JPY.IDEALPRO"),
order_side=OrderSide.BUY,
Expand All @@ -246,6 +282,14 @@ In the following example we create a _Market-If-Touched_ order on the Binance Fu
to SELL 10 ETHUSDT-PERP Perpetual Futures contracts at a trigger price of 10,000 USDT, active until further notice:

```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import MarketIfTouchedOrder

order: MarketIfTouchedOrder = self.order_factory.market_if_touched(
instrument_id=InstrumentId.from_str("ETHUSDT-PERP.BINANCE"),
order_side=OrderSide.SELL,
Expand All @@ -270,6 +314,15 @@ Binance Futures exchange at a limit price of 30_100 USDT (once the market hits t
active until midday 6th June, 2022 (UTC):

```python
import pandas as pd
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import StopLimitOrder

order: StopLimitOrder = self.order_factory.limit_if_touched(
instrument_id=InstrumentId.from_str("BTCUSDT-PERP.BINANCE"),
order_side=OrderSide.BUY,
Expand All @@ -296,6 +349,17 @@ In the following example we create a _Trailing-Stop-Market_ order on the Binance
Perpetual Futures Contracts activating at a trigger price of 5000 USD, then trailing at an offset of 1% (in basis points) away from the current last traded price:

```python
import pandas as pd
from decimal import Decimal
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.enums import TrailingOffsetType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import TrailingStopMarketOrder

order: TrailingStopMarketOrder = self.order_factory.trailing_stop_market(
instrument_id=InstrumentId.from_str("ETHUSD-PERP.BINANCE"),
order_side=OrderSide.SELL,
Expand Down Expand Up @@ -323,6 +387,17 @@ at a limit price of 0.72000 USD, activating at 0.71000 USD then trailing at a st
away from the current ask price, active until further notice:

```python
import pandas as pd
from decimal import Decimal
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.enums import TrailingOffsetType
from nautilus_trader.model.identifiers import InstrumentId
from nautilus_trader.model.objects import Price
from nautilus_trader.model.objects import Quantity
from nautilus_trader.model.orders import TrailingStopLimitOrder

order: TrailingStopLimitOrder = self.order_factory.trailing_stop_limit(
instrument_id=InstrumentId.from_str("AUD/USD.CURRENEX"),
order_side=OrderSide.BUY,
Expand Down
58 changes: 57 additions & 1 deletion develop/_sources/concepts/strategies.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Since a trading strategy is a class which inherits from `Strategy`, you must def
a constructor where you can handle initialization. Minimally the base/super class needs to be initialized:

```python
from nautilus_trader.trading.strategy import Strategy

class MyStrategy(Strategy):
def __init__(self) -> None:
super().__init__() # <-- the super class must be called to initialize the strategy
Expand Down Expand Up @@ -75,6 +77,18 @@ These handlers deal with market data updates.
You can use these handlers to define actions upon receiving new market data.

```python
from nautilus_trader.core.data import Data
from nautilus_trader.model.data import Bar
from nautilus_trader.model.data import QuoteTick
from nautilus_trader.model.data import TradeTick
from nautilus_trader.model.data.book import OrderBookDeltas
from nautilus_trader.model.data.status import InstrumentClose
from nautilus_trader.model.data.status import InstrumentStatus
from nautilus_trader.model.data.status import VenueStatus
from nautilus_trader.model.data.ticker import Ticker
from nautilus_trader.model.instruments import Instrument
from nautilus_trader.model.orderbook import OrderBook

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:
Expand All @@ -99,6 +113,24 @@ Handlers in this category are triggered by events related to orders.
3. `on_event(...)`

```python
from nautilus_trader.model.events import OrderAccepted
from nautilus_trader.model.events import OrderCanceled
from nautilus_trader.model.events import OrderCancelRejected
from nautilus_trader.model.events import OrderDenied
from nautilus_trader.model.events import OrderEmulated
from nautilus_trader.model.events import OrderEvent
from nautilus_trader.model.events import OrderExpired
from nautilus_trader.model.events import OrderFilled
from nautilus_trader.model.events import OrderInitialized
from nautilus_trader.model.events import OrderModifyRejected
from nautilus_trader.model.events import OrderPendingCancel
from nautilus_trader.model.events import OrderPendingUpdate
from nautilus_trader.model.events import OrderRejected
from nautilus_trader.model.events import OrderReleased
from nautilus_trader.model.events import OrderSubmitted
from nautilus_trader.model.events import OrderTriggered
from nautilus_trader.model.events import OrderUpdated

def on_order_initialized(self, event: OrderInitialized) -> None:
def on_order_denied(self, event: OrderDenied) -> None:
def on_order_emulated(self, event: OrderEmulated) -> None:
Expand Down Expand Up @@ -128,6 +160,11 @@ Handlers in this category are triggered by events related to positions.
3. `on_event(...)`

```python
from nautilus_trader.model.events import PositionChanged
from nautilus_trader.model.events import PositionClosed
from nautilus_trader.model.events import PositionEvent
from nautilus_trader.model.events import PositionOpened

def on_position_opened(self, event: PositionOpened) -> None:
def on_position_changed(self, event: PositionChanged) -> None:
def on_position_closed(self, event: PositionClosed) -> None:
Expand All @@ -140,6 +177,8 @@ This handler will eventually receive all event messages which arrive at the stra
which no other specific handler exists.

```python
from nautilus_trader.core.message import Event

def on_event(self, event: Event) -> None:
```

Expand Down Expand Up @@ -189,6 +228,8 @@ While there are multiple ways to obtain current timestamps, here are two commonl

**UTC Timestamp:** This method returns a timezone-aware (UTC) timestamp:
```python
import pandas as pd

now: pd.Timestamp = self.clock.utc_now()
```

Expand Down Expand Up @@ -259,6 +300,14 @@ The following shows a general outline of available methods.
#### Account and positional information

```python
import decimal

from nautilus_trader.model.identifiers import Venue
from nautilus_trader.accounting.accounts.base import Account
from nautilus_trader.model.currency import Currency
from nautilus_trader.model.objects import Money
from nautilus_trader.model.identifiers import InstrumentId

def account(self, venue: Venue) -> Account

def balances_locked(self, venue: Venue) -> dict[Currency, Money]
Expand Down Expand Up @@ -316,6 +365,10 @@ The following examples show method implementations for a `Strategy`.

This example submits a `LIMIT` BUY order for emulation (see [OrderEmulator](advanced/emulated_orders.md)):
```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TriggerType
from nautilus_trader.model.orders import LimitOrder

def buy(self) -> None:
"""
Users simple buy method (example).
Expand All @@ -337,6 +390,10 @@ It's possible to specify both order emulation, and an execution algorithm.

This example submits a `MARKET` BUY order to a TWAP execution algorithm:
```python
from nautilus_trader.model.enums import OrderSide
from nautilus_trader.model.enums import TimeInForce
from nautilus_trader.model.identifiers import ExecAlgorithmId

def buy(self) -> None:
"""
Users simple buy method (example).
Expand Down Expand Up @@ -444,4 +501,3 @@ example the above config would result in a strategy ID of `MyStrategy-001`.
```{tip}
See the `StrategyId` [documentation](../api_reference/model/identifiers.md) for further details.
```

1 change: 1 addition & 0 deletions develop/_sources/getting_started/installation.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ To install a binary wheel from GitHub, first navigate to the [latest release](ht
Download the appropriate `.whl` for your operating system and Python version, then run:

pip install <file-name>.whl

6 changes: 6 additions & 0 deletions develop/_sources/integrations/betfair.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ data and execution clients. To achieve this, add a `BETFAIR` section to your cli
configuration(s):

```python
from nautilus_trader.config import TradingNodeConfig

config = TradingNodeConfig(
..., # Omitted
data_clients={
Expand All @@ -41,6 +43,10 @@ config = TradingNodeConfig(
Then, create a `TradingNode` and add the client factories:

```python
from nautilus_trader.adapters.betfair.factories import BetfairLiveDataClientFactory
from nautilus_trader.adapters.betfair.factories import BetfairLiveExecClientFactory
from nautilus_trader.live.node import TradingNode

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

Expand Down
Loading

0 comments on commit 78deb7f

Please sign in to comment.