Skip to content

Commit

Permalink
Release 1.160.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Nov 28, 2022
2 parents 4f3bde0 + 3efdb4f commit 9a90b77
Show file tree
Hide file tree
Showing 339 changed files with 4,437 additions and 3,304 deletions.
2 changes: 1 addition & 1 deletion .docker/jupyterlab.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GIT_TAG
FROM ghcr.io/nautechsystems/nautilus_trader:$GIT_TAG
COPY --from=ghcr.io/nautechsystems/nautilus_data:main /catalog /catalog
COPY --from=ghcr.io/nautechsystems/nautilus_data:main /opt/pysetup/catalog /catalog
RUN pip install jupyterlab
ENV NAUTILUS_PATH="/"
CMD ["python", "-m", "jupyterlab", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root", "-NotebookApp.token=''", "--NotebookApp.password=''", "examples/notebooks"]
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ venv*/

.DS_Store
!tests/integration_tests/adapters/betfair/responses/*.log
tests/test_kit/data/catalog/
tests/test_data/catalog/
PERF.JSON
*dask-worker-space*
output.json
Expand Down
40 changes: 27 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@ repos:
args: ["-L", "ot,zar,warmup"]

##############################################################################
# Python/Cython checks
# Python/Cython formatting and linting
##############################################################################
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
name: pyupgrade (ensure latest syntax)
args: ["--py39-plus"]

- repo: https://github.com/hadialqattan/pycln
rev: v2.1.2
hooks:
- id: pycln
name: pycln (Python unused imports)
exclude: "nautilus_trader/live/node.py|nautilus_trader/adapters/betfair/execution.py"
name: pycln (remove unused imports)

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.3.0
hooks:
- id: add-trailing-comma
name: add-trailing-comma
types: [python]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
Expand All @@ -59,18 +72,18 @@ repos:
args: ["--config", "pyproject.toml"]
exclude: "docs/_pygments/monokai.py"

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.982
# hooks:
# - id: mypy
# types_or: [python, pyi]
# entry: "poetry"
# args: ["run", "mypy", "--config", "pyproject.toml"]
# require_serial: true
# exclude: "^nautilus_core/"
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.991
# hooks:
# - id: mypy
# types_or: [python, pyi]
# entry: "poetry"
# args: ["run", "mypy", "--config", "pyproject.toml"]
# require_serial: true
# exclude: "^nautilus_core/"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
rev: v0.991
hooks:
- id: mypy
args: [
Expand Down Expand Up @@ -145,6 +158,7 @@ repos:
hooks:
- id: pydocstyle
files: ^nautilus_trader/
exclude: "nautilus_trader/test_kit"
args:
- "--ignore=D100,D102,D103,D104,D107,D105,D200,D203,D205,D212,D400,D413,D415"
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ A `Makefile` is provided to automate most installation and build tasks. It provi
Indicators and strategies can be developed in both Python and Cython (although if performance and latency sensitivity are import we recommend Cython).
The below are some examples of this:
- [indicator](/examples/indicators/ema_py.py) example written in Python
- [indicator](/examples/indicators/ema_python.py) example written in Python
- [indicator](/nautilus_trader/indicators/) examples written in Cython
- [strategy](/nautilus_trader/examples/strategies/) examples written in both Python and Cython
- [backtest](/examples/backtest/) examples using a `BacktestEngine` directly
Expand Down
42 changes: 34 additions & 8 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
# NautilusTrader 1.160.0 Beta

Released on 28th November 2022 (UTC).

### Breaking Changes
- Removed time portion from generated IDs (affects `ClientOrderId` and `PositionOrderId`)
- Renamed `orderbook.data.Order` to `orderbook.data.BookOrder` (reduce conflicts/confusion)
- Renamed `Instrument.get_cost_currency(...)` to `Instrument.get_settlement_currency(...)` (more accurate terminology)

### Enhancements
- Added emulated contingency orders capability to `OrderEmulator`
- Moved `test_kit` module to main package to support downstream project/package testing

### Fixes
- Fixed position event sequencing: now generates `PositionOpened` when reopening a closed position
- Fixed `LIMIT` order fill characteristics when immediately marketable as a taker
- Fixed `LIMIT` order fill characteristics when passively filled as a maker as quotes move through
- Fixed canceling OTO contingent orders when still in-flight
- Fixed `RiskEngine` notional check when selling cash assets (spot currency pairs)
- Fixed flush on closed file bug for persistence stream writers

---

# NautilusTrader 1.159.0 Beta

Released on 18th November (UTC).
Released on 18th November 2022 (UTC).

### Breaking Changes
- Removed FTX integration
- Renamed `SubmitOrderList.list` -> `SubmitOrderList.order_list`
- Renamed `SubmitOrderList.list` to `SubmitOrderList.order_list`
- Slight adjustment to bar aggregation (will not use the last close as the open)

### Enhancements
- Implemented `TRAILING_STOP_MARKET` orders for Binance Futures (beta)
- Added `OUO` One-Updates-Other `ContigencyType` with matching engine implementation
- Added `OUO` One-Updates-Other `ContingencyType` with matching engine implementation
- Added bar price fallback for exchange rate calculations, thanks @ghill2

### Fixes
- Fixed deallocation of Rust backing struct on Python exceptions causing segfaults
- Fixed dealloc of Rust backing struct on Python exceptions causing segfaults
- Fixed bar aggregation start times for bar specs outside typical intervals (60-SECOND rather than 1-MINUTE etc)
- Fixed backtest engine main loop ordering of time events with identically timestamped data
- Fixed `ModifyOrder` message `str` and `repr` when no quantity
- Fixed OCO contingency orders which were actually implemented as OUO for backtests
- Fixed various bugs for Interactive Brokers integration, thanks @limx0 and @rsmb7z
- Fixed pyarrow version parsing, thanks @ghill2
- Fixed returning venue from InstrumentId, thanks @rsmb7z

---

# NautilusTrader 1.158.0 Beta

Released on 3rd November (UTC).
Released on 3rd November 2022 (UTC).

### Breaking Changes
- Added `LiveExecEngineConfig.reconcilation` boolean flag to control if reconciliation is active
Expand All @@ -48,7 +74,7 @@ Released on 3rd November (UTC).

# NautilusTrader 1.157.0 Beta

Released on 24th October (UTC).
Released on 24th October 2022 (UTC).

### Breaking Changes
- None
Expand All @@ -73,7 +99,7 @@ This will be the final release with support for Python 3.8.
- Added `OrderSide.NONE` enum variant
- Added `PositionSide.NONE` enum variant
- Changed order of `TriggerType` enum variants
- Renamed `AggressorSide.UNKNOWN` -> `AggressorSide.NONE` (for consistency with other enums)
- Renamed `AggressorSide.UNKNOWN` to `AggressorSide.NONE` (for consistency with other enums)
- Renamed `Order.type` to `Order.order_type` (reduces ambiguity and aligns with Rust struct field)
- Renamed `OrderInitialized.type` to `OrderInitialized.order_type` reduces ambiguity)
- Renamed `Bar.type` to `Bar.bar_type` (reduces ambiguity and aligns with Rust struct field)
Expand Down Expand Up @@ -554,7 +580,7 @@ safety this type is now utilized for the `TradeTick.trade_id`.
- Renamed `execution_id` to `trade_id`
- Renamed `Order.trade_id` to `Order.last_trade_id` (for clarity)
- Renamed other variations and references of 'execution ID' to 'trade ID'
- Renamed `contigency` to `contingency_type`
- Renamed `contingency` to `contingency_type`

### Enhancements
- Introduced the `TradeId` type to enforce `trade_id` typing
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _build_distribution(extensions: list[Extension]) -> Distribution:
gdb_debug=PROFILE_MODE,
),
zip_safe=False,
)
),
)
return distribution

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"version_dropdown": True,
"version_json": "_static/version.json",
"version_info": {
"1.159.0 (develop)": "https://docs.nautilustrader.io",
"1.158.0 (latest)": "https://docs.nautilustrader.io/latest",
"1.160.0 (develop)": "https://docs.nautilustrader.io",
"1.159.0 (latest)": "https://docs.nautilustrader.io/latest",
},
"table_classes": ["plain"],
}
Expand Down
4 changes: 0 additions & 4 deletions docs/integrations/binance.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ trading, it's necessary to explicitly clarify the difference between `BTCUSDT` a
pair, and the `BTCUSDT` perpetual futures contract (this symbol is used for _both_ natively by Binance). Therefore, NautilusTrader appends `-PERP` to all native perpetual symbols.
E.g. for Binance Futures, the said instruments symbol is `BTCUSDT-PERP` within the Nautilus system boundary.

```{note}
This convention of appending `-PERP` to perpetual futures is also adopted by [FTX](ftx.md).
```

## Order types
| | Spot | Margin | Futures |
|------------------------|---------------------------------|---------------------------------|-------------------|
Expand Down
1 change: 0 additions & 1 deletion docs/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ this means there is some normalization and standardization needed.
betfair.md
binance.md
ftx.md
ib.md
```
2 changes: 1 addition & 1 deletion docs/user_guide/adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ InstrumentProviderConfig(load_all=True)
- Only those instruments explicitly specified in the configuration are loaded on start:

```python
InstrumentProviderConfig(load_ids=["BTCUSDT-PERP.FTX", "ETHUSDT-PERP.FTX"])
InstrumentProviderConfig(load_ids=["BTCUSDT-PERP.BINANCE", "ETHUSDT-PERP.BINANCE"])
```

## Data Clients
Expand Down
8 changes: 4 additions & 4 deletions docs/user_guide/instruments.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ currently a number of subclasses representing a range of _asset classes_ and _as

## Symbology
All instruments should have a unique `InstrumentId`, which is made up of both the native symbol, and venue ID, separated by a period.
For example, on the FTX crypto exchange, the Ethereum Perpetual Futures Contract has the instrument ID `ETH-PERP.FTX`.
For example, on the Binance Futures crypto exchange, the Ethereum Perpetual Futures Contract has the instrument ID `ETHUSDT-PERP.BINANCE`.

All native symbols _should_ be unique for a venue (this is not always the case e.g. Binance share native symbols between spot and futures markets),
and the `{symbol.venue}` combination _must_ be unique for a Nautilus system.
Expand Down Expand Up @@ -61,7 +61,7 @@ get instruments in exactly the same way through the central cache:
```python
from nautilus_trader.model.identifiers import InstrumentId

instrument_id = InstrumentId.from_str("ETH/USD.FTX")
instrument_id = InstrumentId.from_str("ETHUSDT-PERP.BINANCE")
instrument = self.cache.instrument(instrument_id)
```

Expand All @@ -74,8 +74,8 @@ Or subscribe to all instrument changes for an entire venue:
```python
from nautilus_trader.model.identifiers import Venue

ftx = Venue("FTX")
self.subscribe_instruments(ftx)
binance = Venue("BINANCE")
self.subscribe_instruments(binance)
```

When an update to the instrument(s) is received by the `DataEngine`, the object(s) will
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ order: MarketOrder = self.order_factory.market(
A _Limit_ order is placed on the limit order book at a specific price, and will only
execute at that price (or better).

In the following example we create a _Limit_ order on the FTX Crypto exchange to SELL 20 ETH-PERP Perpetual Futures
contracts at a limit price of 5000 USD, as a market maker.
In the following example we create a _Limit_ order on the Binance Futures Crypto exchange to SELL 20 ETHUSDT-PERP Perpetual Futures
contracts at a limit price of 5000 USDT, as a market maker.

```python
order: LimitOrder = self.order_factory.limit(
instrument_id=InstrumentId.from_str("ETH-PERP.FTX"),
instrument_id=InstrumentId.from_str("ETHUSDT-PERP.BINANCE"),
order_side=OrderSide.SELL,
quantity=Quantity.from_int(20),
price=Price.from_str("5000.00"),
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class MyStrategy(Strategy):
# trading strategy to initialize.

config = MyStrategyConfig(
instrument_id="ETH-PERP.FTX",
bar_type="ETH-PERP.FTX-1000-TICK[LAST]-INTERNAL",
instrument_id="ETHUSDT-PERP.BINANCE",
bar_type="ETHUSDT-PERP.BINANCE-1000-TICK[LAST]-INTERNAL",
trade_size=Decimal(1),
order_id_tag="001",
)
Expand Down
10 changes: 7 additions & 3 deletions examples/backtest/betfair_backtest_orderbook_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@
# Add instruments
instruments = [
BetfairTestStubs.betting_instrument(
market_id="1.180737206", selection_id="19248890", handicap="0.0"
market_id="1.180737206",
selection_id="19248890",
handicap="0.0",
),
BetfairTestStubs.betting_instrument(
market_id="1.180737206", selection_id="38848248", handicap="0.0"
market_id="1.180737206",
selection_id="38848248",
handicap="0.0",
),
]
engine.add_instrument(instruments[0])
Expand All @@ -79,7 +83,7 @@
instrument_id=instrument.id.value,
max_trade_size=10,
order_id_tag=instrument.selection_id,
)
),
)
for instrument in instruments
]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/live/betfair.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def main(market_id: str):
instrument_id=instrument.id.value,
max_trade_size=10,
order_id_tag=instrument.selection_id,
)
),
)
for instrument in instruments
]
Expand Down
2 changes: 1 addition & 1 deletion examples/live/betfair_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def main(market_id: str):
instrument_id=instrument.id.value,
max_trade_size=10,
order_id_tag=instrument.selection_id,
)
),
)
for instrument in instruments
]
Expand Down
1 change: 1 addition & 0 deletions examples/live/binance_futures_testnet_ema_cross_bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
bar_type="ETHUSDT-PERP.BINANCE-1-MINUTE-LAST-EXTERNAL",
fast_ema_period=10,
slow_ema_period=20,
bracket_distance_atr=1.0,
trade_size=Decimal("0.010"),
order_id_tag="001",
emulation_trigger="BID_ASK",
Expand Down
Loading

0 comments on commit 9a90b77

Please sign in to comment.