Skip to content

Commit

Permalink
Release 1.134.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Nov 21, 2021
2 parents f9e8bd8 + 7abc2e3 commit 2d602dd
Show file tree
Hide file tree
Showing 77 changed files with 3,500 additions and 579 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
plugins = Cython.Coverage
source = nautilus_trader
omit = nautilus_trader/examples/*
omit = nautilus_trader/adapters/binance*,nautilus_trader/adapters/ftx*,nautilus_trader/adapters/ib*,nautilus_trader/examples*

[report]
fail_under = 0
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ PERF.JSON
*dask-worker-space*
output.json
.ipynb_checkpoints
examples/backtest/notebooks/catalog
examples/backtest/notebooks/catalog
nautilus_trader/**/.gitignore
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ repos:
exclude: "nautilus_trader/adapters/betfair/parsing.py|nautilus_trader/adapters/betfair/execution.py|tests/integration_tests/adapters/betfair/test_kit.py"

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

- repo: https://github.com/psf/black
rev: 21.10b0
rev: 21.11b0
hooks:
- id: black
args: [
--line-length=100,
]

- repo: https://github.com/pycqa/isort
rev: 5.10.0
rev: 5.10.1
hooks:
- id: isort
args: [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ including FX, Equities, Futures, Options, CFDs, Crypto and Betting - across mult
- **Reliable:** Type safety through Cython. Redis backed performant state persistence.
- **Flexible:** OS independent, runs on Linux, macOS, Windows. Deploy using Docker.
- **Integrated:** Modular adapters mean any REST/FIX/WebSocket API can be integrated.
- **Advanced:** Time-in-force options `GTD`, `IOC`, `FOK` etc, advanced order types and triggers, `post-only`, `reduce-only`, `hidden`. Contingency order lists including `OCO`, `OTO` etc.
- **Advanced:** Time-in-force options `GTD`, `IOC`, `FOK` etc, advanced order types and triggers, `post-only`, `reduce-only`, and icebergs. Contingency order lists including `OCO`, `OTO` etc.
- **Backtesting:** Run with multiple venues, instruments and strategies simultaneously using historical quote tick, trade tick, bar, order book and custom data with nanosecond resolution.
- **Multi-venue:** Multiple venue capabilities facilitate market making and statistical arbitrage strategies.
- **AI Agent Training:** Backtest engine fast enough to be used to train AI trading agents (RL/ES).
Expand Down
21 changes: 21 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# NautilusTrader 1.134.0 Beta - Release Notes

Released on 22nd, November 2021

## Breaking Changes
- Changed `hidden` order option to `display_qty` to support iceberg orders.
- Renamed `Trader.component_ids()` to `Trader.actor_ids()`.
- Renamed `Trader.component_states()` to `Trader.actor_states()`.
- Renamed `Trader.add_component()` to `Trader.add_actor()`.
- Renamed `Trader.add_components()` to `Trader.add_actors()`.
- Renamed `Trader.clear_components()` to `Trader.clear_actors()`.

## Enhancements
- Added initial implementation of Binance SPOT integration (beta stage testing).
- Added support for display quantity/iceberg orders.

## Fixes
- Fixed `Actor` clock time advancement in backtest engine.

---

# NautilusTrader 1.133.0 Beta - Release Notes

Released on 8th, November 2021
Expand Down
Binary file removed docs/artwork/nautech-systems-logo.png
Binary file not shown.
Binary file modified docs/artwork/ns-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
# Configure the trading node
config_node = TradingNodeConfig(
trader_id="TESTER-001",
log_level="DEBUG",
cache_database=None,
log_level="INFO",
# cache_database=CacheDatabaseConfig(),
data_clients={
"BINANCE": {
# "api_key": "YOUR_BINANCE_API_KEY",
Expand Down Expand Up @@ -61,10 +61,10 @@
# Configure your strategy
strat_config = EMACrossConfig(
instrument_id="ETHUSDT.BINANCE",
bar_type="ETHUSDT.BINANCE-100-TICK-LAST-INTERNAL",
bar_type="ETHUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL",
fast_ema_period=10,
slow_ema_period=20,
trade_size=Decimal("0.01"),
trade_size=Decimal("0.005"),
order_id_tag="001",
)
# Instantiate your strategy
Expand Down
85 changes: 85 additions & 0 deletions examples/live/binance_example_market_maker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env python3
# -------------------------------------------------------------------------------------------------
# Copyright (C) 2015-2021 Nautech Systems Pty Ltd. All rights reserved.
# https://nautechsystems.io
#
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------------------------------------

from decimal import Decimal

from nautilus_trader.adapters.binance.factories import BinanceLiveDataClientFactory
from nautilus_trader.adapters.binance.factories import BinanceLiveExecutionClientFactory
from nautilus_trader.examples.strategies.volatility_market_maker import VolatilityMarketMaker
from nautilus_trader.examples.strategies.volatility_market_maker import VolatilityMarketMakerConfig
from nautilus_trader.live.node import TradingNode
from nautilus_trader.live.node import TradingNodeConfig


# *** THIS IS A TEST STRATEGY WITH NO ALPHA ADVANTAGE WHATSOEVER. ***
# *** IT IS NOT INTENDED TO BE USED TO TRADE LIVE WITH REAL MONEY. ***

# Configure the trading node
config_node = TradingNodeConfig(
trader_id="TESTER-001",
log_level="INFO",
# cache_database=CacheDatabaseConfig(),
data_clients={
"BINANCE": {
# "api_key": "YOUR_BINANCE_API_KEY",
# "api_secret": "YOUR_BINANCE_API_SECRET",
# "account_id": "YOUR_BINANCE_ACCOUNT_ID", (optional)
"sandbox_mode": False, # If client uses the testnet
},
},
exec_clients={
"BINANCE": {
# "api_key": "YOUR_BINANCE_API_KEY",
# "api_secret": "YOUR_BINANCE_API_SECRET",
# "account_id": "YOUR_BINANCE_ACCOUNT_ID", (optional)
"sandbox_mode": False, # If client uses the testnet,
},
},
timeout_connection=5.0,
timeout_reconciliation=5.0,
timeout_portfolio=5.0,
timeout_disconnection=5.0,
check_residuals_delay=2.0,
)
# Instantiate the node with a configuration
node = TradingNode(config=config_node)

# Configure your strategy
strat_config = VolatilityMarketMakerConfig(
instrument_id="ETHUSDT.BINANCE",
bar_type="ETHUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL",
atr_period=20,
atr_multiple=6.0,
trade_size=Decimal("0.01"),
)
# Instantiate your strategy
strategy = VolatilityMarketMaker(config=strat_config)

# Add your strategies and modules
node.trader.add_strategy(strategy)

# Register your client factories with the node (can take user defined factories)
node.add_data_client_factory("BINANCE", BinanceLiveDataClientFactory)
node.add_exec_client_factory("BINANCE", BinanceLiveExecutionClientFactory)
node.build()


# Stop and dispose of the node with SIGINT/CTRL+C
if __name__ == "__main__":
try:
node.start()
finally:
node.dispose()
2 changes: 1 addition & 1 deletion nautilus_trader/accounting/accounts/base.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cdef class Account:
# -- COMMANDS --------------------------------------------------------------------------------------

cpdef void apply(self, AccountState event) except *
cpdef void update_balances(self, list balances) except *
cpdef void update_balances(self, list balances, bint allow_zero=*) except *
cpdef void update_commissions(self, Money commission) except *

# -- CALCULATIONS ----------------------------------------------------------------------------------
Expand Down
20 changes: 17 additions & 3 deletions nautilus_trader/accounting/accounts/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ cdef class Account:
self._events.append(event)
self.update_balances(event.balances)

cpdef void update_balances(self, list balances) except *:
cpdef void update_balances(self, list balances, bint allow_zero=True) except *:
"""
Update the account balances.
Expand All @@ -391,6 +391,9 @@ cdef class Account:
Parameters
----------
balances : list[AccountBalance]
The balances for the update.
allow_zero : bool, default True
If zero balances are allowed (will then just clear the assets balance).
Raises
------
Expand All @@ -402,8 +405,19 @@ cdef class Account:

cdef AccountBalance balance
for balance in balances:
if balance.total.as_decimal() <= 0:
raise RuntimeError("account blow up (balance zero).")
total: Decimal = balance.total.as_decimal()
if total <= 0:
if total < 0:
raise RuntimeError(
f"account blow up (balance was {balance.total}).",
)
if total == 0 and not allow_zero:
raise RuntimeError(
f"account blow up (balance was {balance.total}).",
)
else:
# Clear asset balance
self._balances.pop(balance.currency, None)
self._balances[balance.currency] = balance

cpdef void update_commissions(self, Money commission) except *:
Expand Down
Loading

0 comments on commit 2d602dd

Please sign in to comment.