Skip to content

Commit

Permalink
1.111.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Mar 15, 2021
2 parents 5238f1c + 8291520 commit 533c7ea
Show file tree
Hide file tree
Showing 118 changed files with 2,340 additions and 903 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ value_bars = BarSpecification(1_000_000, BarAggregation.VALUE, PriceType.MID)

Bars can be either internally or externally aggregated (alternative bar types are
only available by internal aggregation). External aggregation is normally for
standard bar periods as available from the provider through the adapter
integration.
standard bar periods as available from the provider through an integrations
adapter.

Custom data types can also be requested through a users custom handler, and fed
back to the strategies `on_data` method.
Expand Down
24 changes: 24 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# NautilusTrader 1.111.0 Beta - Release Notes

This release adds further enhancements to the platform.

## Breaking Changes
None

## Enhancements
- `RiskEngine` built out including configuration options hook and
`LiveRiskEngine` implementation.
- Add generic `Throttler`.
- Add details `dict` to `instrument_id` related requests to cover IB futures
contracts.
- Add missing Fiat currencies.
- Add additional Crypto currencies.
- Add ISO 4217 codes.
- Add currency names.

## Fixes
- Queue `put` coroutines in live engines when blocking at `maxlen` was not
creating a task on the event loop.

---

# NautilusTrader 1.110.0 Beta - Release Notes

This release applies one more major change to the identifier API. `Security` has
Expand Down
9 changes: 9 additions & 0 deletions docs/source/api_reference/common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ Logging
:members:
:member-order: bysource

Providers
---------

.. automodule:: nautilus_trader.common.providers
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource

Queue
-----

Expand Down
17 changes: 6 additions & 11 deletions docs/source/api_reference/live.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Data Client
:members:
:member-order: bysource


Data Engine
-----------

Expand All @@ -23,7 +22,6 @@ Data Engine
:members:
:member-order: bysource


Execution Client
----------------

Expand All @@ -33,7 +31,6 @@ Execution Client
:members:
:member-order: bysource


Execution Engine
----------------

Expand All @@ -43,21 +40,19 @@ Execution Engine
:members:
:member-order: bysource

Risk Engine
-----------

Node
----

.. automodule:: nautilus_trader.live.node
.. automodule:: nautilus_trader.live.risk_engine
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource

Node
----

Providers
---------

.. automodule:: nautilus_trader.live.providers
.. automodule:: nautilus_trader.live.node
:show-inheritance:
:inherited-members:
:members:
Expand Down
9 changes: 9 additions & 0 deletions docs/source/api_reference/risk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Risk
.. automodule:: nautilus_trader.risk


Engine
------

.. automodule:: nautilus_trader.risk.engine
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource

Sizing
------

Expand Down
4 changes: 2 additions & 2 deletions examples/backtest/crypto_ema_cross_ethusdt_trade_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

BINANCE = Venue("BINANCE")
instrument_id = InstrumentId(symbol=Symbol("ETH/USDT"), venue=BINANCE)
ETHUSDT_BINANCE = instruments.get(instrument_id)
ETHUSDT_BINANCE = instruments.find(instrument_id)

# Setup data container
data = BacktestDataContainer()
Expand All @@ -70,7 +70,7 @@
engine = BacktestEngine(
data=data,
strategies=[strategy], # List of 'any' number of strategies
use_tick_cache=True, # Pre-cache ticks for increased performance on repeated runs
use_data_cache=True, # Pre-cache data for increased performance on repeated runs
# exec_db_type="redis",
# bypass_logging=True
)
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_ema_cross_audusd_bars_from_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
engine = BacktestEngine(
data=data,
strategies=[strategy], # List of 'any' number of strategies
use_tick_cache=True, # Pre-cache ticks for increased performance on repeated runs
use_data_cache=True, # Pre-cache data for increased performance on repeated runs
# exec_db_type="redis",
# bypass_logging=True
)
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_ema_cross_audusd_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
engine = BacktestEngine(
data=data,
strategies=[strategy], # List of 'any' number of strategies
use_tick_cache=True, # Pre-cache ticks for increased performance on repeated runs
use_data_cache=True, # Pre-cache data for increased performance on repeated runs
# exec_db_type="redis",
# bypass_logging=True
)
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_ema_cross_gbpusd_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
engine = BacktestEngine(
data=data,
strategies=[strategy], # List of 'any' number of strategies
use_tick_cache=True, # Pre-cache ticks for increased performance on repeated runs
use_data_cache=True, # Pre-cache data for increased performance on repeated runs
# exec_db_type="redis",
# exec_db_flush=False,
# bypass_logging=True
Expand Down
2 changes: 1 addition & 1 deletion examples/backtest/fx_market_maker_gbpusd_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
engine = BacktestEngine(
data=data,
strategies=[strategy], # List of 'any' number of strategies
use_tick_cache=True,
use_data_cache=True,
# exec_db_type="redis",
# bypass_logging=True
)
Expand Down
2 changes: 2 additions & 0 deletions examples/live/binance_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/binance_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/bitmex_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/bitmex_ema_cross_stop_entry_with_trail.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/bitmex_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/bitmex_testnet_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/multi_venue_ema_cross_stop_entry_with_trail.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
2 changes: 2 additions & 0 deletions examples/live/oanda_ema_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"port": 6379,
},

"risk": {},

"strategy": {
"load_state": True, # Strategy state is loaded from the database on start
"save_state": True, # Strategy state is saved to the database on shutdown
Expand Down
16 changes: 8 additions & 8 deletions nautilus_trader/adapters/ccxt/data.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):

# TODO: Possibly combine this with _watch_quotes
async def _watch_order_book(self, InstrumentId instrument_id, int level, int depth, dict kwargs):
cdef Instrument instrument = self._instrument_provider.get(instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(instrument_id)
if instrument is None:
self._log.error(f"Cannot subscribe to order book (no instrument for {instrument_id.symbol}).")
return
Expand Down Expand Up @@ -705,7 +705,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
self._log.exception(ex)

async def _watch_quotes(self, InstrumentId instrument_id):
cdef Instrument instrument = self._instrument_provider.get(instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(instrument_id)
if instrument is None:
self._log.error(f"Cannot subscribe to quote ticks (no instrument for {instrument_id.symbol}).")
return
Expand Down Expand Up @@ -806,7 +806,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
self._handle_quote_tick(tick)

async def _watch_trades(self, InstrumentId instrument_id):
cdef Instrument instrument = self._instrument_provider.get(instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(instrument_id)
if instrument is None:
self._log.error(f"Cannot subscribe to trade ticks (no instrument for {instrument_id.symbol}).")
return
Expand Down Expand Up @@ -877,7 +877,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
self._handle_trade_tick(tick)

async def _watch_ohlcv(self, BarType bar_type):
cdef Instrument instrument = self._instrument_provider.get(bar_type.instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(bar_type.instrument_id)
if instrument is None:
self._log.error(f"Cannot subscribe to bars (no instrument for {bar_type.instrument_id}).")
return
Expand Down Expand Up @@ -975,7 +975,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):

async def _request_instrument(self, InstrumentId instrument_id, UUID correlation_id):
await self._load_instruments()
cdef Instrument instrument = self._instrument_provider.get(instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(instrument_id)
if instrument is not None:
self._handle_instruments([instrument], correlation_id)
else:
Expand All @@ -992,7 +992,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
cdef InstrumentId instrument_id
cdef Instrument instrument
for instrument_id in self._subscribed_instruments:
instrument = self._instrument_provider.get(instrument_id)
instrument = self._instrument_provider.find_c(instrument_id)
if instrument is not None:
self._handle_instrument(instrument)
else:
Expand All @@ -1010,7 +1010,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
int limit,
UUID correlation_id,
):
cdef Instrument instrument = self._instrument_provider.get(instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(instrument_id)
if instrument is None:
self._log.error(f"Cannot request trade ticks (no instrument for {instrument_id}).")
return
Expand Down Expand Up @@ -1061,7 +1061,7 @@ cdef class CCXTDataClient(LiveMarketDataClient):
int limit,
UUID correlation_id,
):
cdef Instrument instrument = self._instrument_provider.get(bar_type.instrument_id)
cdef Instrument instrument = self._instrument_provider.find_c(bar_type.instrument_id)
if instrument is None:
self._log.error(f"Cannot request bars (no instrument for {bar_type.instrument_id}).")
return
Expand Down
4 changes: 2 additions & 2 deletions nautilus_trader/adapters/ccxt/execution.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ from nautilus_trader.adapters.ccxt.providers cimport CCXTInstrumentProvider
from nautilus_trader.common.clock cimport LiveClock
from nautilus_trader.common.logging cimport LogColor
from nautilus_trader.common.logging cimport Logger
from nautilus_trader.common.providers cimport InstrumentProvider
from nautilus_trader.core.correctness cimport Condition
from nautilus_trader.core.datetime cimport from_unix_time_ms
from nautilus_trader.core.datetime cimport to_unix_time_ms
from nautilus_trader.execution.reports cimport ExecutionStateReport
from nautilus_trader.live.execution_client cimport LiveExecutionClient
from nautilus_trader.live.execution_engine cimport LiveExecutionEngine
from nautilus_trader.live.providers cimport InstrumentProvider
from nautilus_trader.model.c_enums.liquidity_side cimport LiquiditySide
from nautilus_trader.model.c_enums.order_side cimport OrderSideParser
from nautilus_trader.model.c_enums.order_state cimport OrderState
Expand Down Expand Up @@ -206,7 +206,7 @@ cdef class CCXTExecutionClient(LiveExecutionClient):
self._log.error(f"Cannot resolve state for {repr(order.cl_ord_id)}, "
f"OrderId was 'NULL'.")
continue # Cannot resolve order
instrument = self._instrument_provider.get(order.symbol)
instrument = self._instrument_provider.find_c(order.symbol)
if instrument is None:
self._log.error(f"Cannot resolve state for {repr(order.cl_ord_id)}, "
f"instrument for {order.instrument_id} not found.")
Expand Down
7 changes: 6 additions & 1 deletion nautilus_trader/adapters/ccxt/providers.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
# limitations under the License.
# -------------------------------------------------------------------------------------------------

from nautilus_trader.live.providers cimport InstrumentProvider
from nautilus_trader.common.providers cimport InstrumentProvider
from nautilus_trader.model.c_enums.currency_type cimport CurrencyType
from nautilus_trader.model.currency cimport Currency
from nautilus_trader.model.identifiers cimport InstrumentId
from nautilus_trader.model.instrument cimport Instrument


cdef class CCXTInstrumentProvider(InstrumentProvider):
cdef object _client
cdef object _currencies

cdef readonly venue

cpdef Currency currency(self, str code)
cdef void _load_instruments(self) except *
cdef void _load_currencies(self) except *
cdef inline int _tick_size_to_precision(self, double tick_size) except *
Expand Down
Loading

0 comments on commit 533c7ea

Please sign in to comment.