Skip to content

Commit

Permalink
1.109.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Mar 10, 2021
2 parents 82dd10c + 1b504aa commit d8995b5
Show file tree
Hide file tree
Showing 87 changed files with 570 additions and 270 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ To contribute, the following steps should be followed;
- Keep PR's small and focused.
- Reference the related GitHub issue(s) in the PR comment.

Thank you for your interest in _NautilusTrader_!
Thank you for your interest in NautilusTrader!
23 changes: 23 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# NautilusTrader 1.109.0 Beta - Release Notes

The main thrust of this release is to refine and further bed down the changes
to the identifier model via `Security`, and fix some bugs.

Errors in the CCXT clients caused by the last release have been addressed.

## Breaking Changes
- `Security` now takes first class value object `Symbol`.
- `Security` `asset_class` and `asset_type` no longer optional.
- `SimulatedExchange.venue` changed to `SimulatedExchange.id`.

## Enhancements
- Ensure `TestTimer` advances monotonically increase.
- Add `AssetClass.BETTING`.

## Fixes
- CCXT data and execution clients regarding `security` vs `symbol` naming.
- `Security` equality and hashing.
- Various docstrings.

---

# NautilusTrader 1.108.0 Beta - Release Notes

This release executes a major refactoring of `Symbol` and how securities are
Expand Down
14 changes: 11 additions & 3 deletions examples/backtest/crypto_ema_cross_ethusdt_trade_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import OMSType
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol
from nautilus_trader.model.objects import Money
from tests.test_kit.providers import TestDataProvider

Expand All @@ -48,8 +49,15 @@
print("Loading instruments...")
instruments = CCXTInstrumentProvider(client=ccxt.binance(), load_all=True)

BINANCE = Venue("BINANCE")
ETHUSDT_BINANCE = instruments.get(Security("ETH/USDT", BINANCE, AssetClass.CRYPTO, AssetType.SPOT))
BINANCE = Exchange("BINANCE")
security = Security(
symbol=Symbol("ETH/USDT"),
venue=BINANCE,
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SPOT,
)

ETHUSDT_BINANCE = instruments.get(security)

# Setup data container
data = BacktestDataContainer()
Expand Down
11 changes: 10 additions & 1 deletion examples/live/binance_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -80,8 +81,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("ETH/USDT"),
venue=Exchange("BINANCE"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SPOT,
)

strategy = EMACross(
security=Security("ETH/USDT", Exchange("BINANCE"), AssetClass.CRYPTO, AssetType.SPOT),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
fast_ema_period=10,
slow_ema_period=20,
Expand Down
13 changes: 11 additions & 2 deletions examples/live/binance_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -80,8 +81,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("ETH/USDT"),
venue=Exchange("BINANCE"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SPOT,
)

strategy = VolatilityMarketMaker(
security=Security("ETH/USDT", Venue("BINANCE"), AssetClass.CRYPTO, AssetType.SPOT),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("0.05"),
atr_period=20,
Expand Down
13 changes: 11 additions & 2 deletions examples/live/bitmex_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -80,8 +81,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("BTC/USD"),
venue=Exchange("BITMEX"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SWAP,
)

strategy = EMACross(
security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
fast_ema_period=10,
slow_ema_period=20,
Expand Down
13 changes: 11 additions & 2 deletions examples/live/bitmex_ema_cross_stop_entry_with_trail.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -79,8 +80,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("BTC/USD"),
venue=Exchange("BITMEX"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SWAP,
)

strategy = EMACrossStopEntryTrail(
security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("100"),
fast_ema_period=10,
Expand Down
13 changes: 11 additions & 2 deletions examples/live/bitmex_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -80,8 +81,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("BTC/USD"),
venue=Exchange("BITMEX"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SWAP,
)

strategy = VolatilityMarketMaker(
security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("100"),
atr_period=20,
Expand Down
13 changes: 11 additions & 2 deletions examples/live/bitmex_testnet_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -80,8 +81,16 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security = Security(
symbol=Symbol("BTC/USD"),
venue=Exchange("BITMEX"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SWAP,
)

strategy = VolatilityMarketMaker(
security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP),
security=security,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("10"),
atr_period=20,
Expand Down
25 changes: 22 additions & 3 deletions examples/live/multi_venue_ema_cross_stop_entry_with_trail.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
from nautilus_trader.model.enums import AssetType
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Exchange
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Venue
from nautilus_trader.model.identifiers import Symbol

# The configuration dictionary can come from anywhere such as a JSON or YAML
# file. Here it is hardcoded into the example for clarity.
Expand Down Expand Up @@ -87,17 +88,34 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security1 = Security(
symbol=Symbol("ETH/USDT"),
venue=Exchange("BINANCE"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SPOT,
)

strategy1 = EMACross(
security=Security("ETH/USDT", Venue("BINANCE"), AssetClass.CRYPTO, AssetType.SPOT),
security=security1,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("0.02"),
fast_ema_period=10,
slow_ema_period=20,
order_id_tag="003",
)

# ------------------------------------------------------------------------------

security2 = Security(
symbol=Symbol("BTC/USD"),
venue=Exchange("BITMEX"),
asset_class=AssetClass.CRYPTO,
asset_type=AssetType.SWAP,
)

strategy2 = EMACrossStopEntryTrail(
security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP),
security=security2,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
trade_size=Decimal("100"),
fast_ema_period=10,
Expand All @@ -107,6 +125,7 @@
order_id_tag="004",
)

# ------------------------------------------------------------------------------
# Instantiate the node passing a list of strategies and configuration
node = TradingNode(strategies=[strategy1, strategy2], config=config)

Expand Down
33 changes: 30 additions & 3 deletions examples/live/oanda_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from nautilus_trader.model.enums import BarAggregation
from nautilus_trader.model.enums import PriceType
from nautilus_trader.model.identifiers import Security
from nautilus_trader.model.identifiers import Symbol
from nautilus_trader.model.identifiers import Venue

# The configuration dictionary can come from anywhere such as a JSON or YAML
Expand Down Expand Up @@ -78,26 +79,52 @@
# Instantiate your strategies to pass into the trading node. You could add
# custom options into the configuration file or even use another configuration
# file.

security1 = Security(
symbol=Symbol("AUD/USD"),
venue=Venue("OANDA"),
asset_class=AssetClass.FX,
asset_type=AssetType.SPOT,
)

strategy1 = EMACross(
security=Security("AUD/USD", Venue("OANDA"), AssetClass.FX, AssetType.SPOT),
security=security1,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.MID),
fast_ema_period=10,
slow_ema_period=20,
trade_size=Decimal(10000),
order_id_tag="001",
)

# ------------------------------------------------------------------------------

security2 = Security(
symbol=Symbol("EUR/USD"),
venue=Venue("OANDA"),
asset_class=AssetClass.FX,
asset_type=AssetType.SPOT,
)

strategy2 = EMACross(
security=Security("EUR/USD", Venue("OANDA"), AssetClass.FX, AssetType.SPOT),
security=security2,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.MID),
fast_ema_period=10,
slow_ema_period=20,
trade_size=Decimal(10000),
order_id_tag="002",
)

# ------------------------------------------------------------------------------

security3 = Security(
symbol=Symbol("GBP/USD"),
venue=Venue("OANDA"),
asset_class=AssetClass.FX,
asset_type=AssetType.SPOT,
)

strategy3 = EMACross(
security=Security("GBP/USD", Venue("OANDA"), AssetClass.FX, AssetType.SPOT),
security=security3,
bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.MID),
fast_ema_period=10,
slow_ema_period=20,
Expand Down
2 changes: 1 addition & 1 deletion examples/strategies/blank.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, security: Security):
Parameters
----------
security : Security
The security for the strategy.
The security identifier for the strategy.
"""
# The order_id_tag should be unique at the 'trader level', here we are
Expand Down
2 changes: 1 addition & 1 deletion nautilus_trader/adapters/binance/execution.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ cdef class BinanceExecutionClient(CCXTExecutionClient):
try:
# Submit order and await response
await self._client.create_order(
symbol=order.security.symbol,
symbol=order.security.symbol.value,
type=order_type,
side=OrderSideParser.to_str(order.side),
amount=str(order.quantity),
Expand Down
2 changes: 1 addition & 1 deletion nautilus_trader/adapters/bitmex/execution.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ cdef class BitmexExecutionClient(CCXTExecutionClient):
try:
# Submit order and await response
await self._client.create_order(
symbol=order.security.symbol,
symbol=order.security.symbol.value,
type=order_type,
side=OrderSideParser.to_str(order.side).capitalize(),
amount=str(order.quantity),
Expand Down
Loading

0 comments on commit d8995b5

Please sign in to comment.