Skip to content

Commit

Permalink
Release 1.163.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Dec 17, 2022
2 parents 981d8e2 + 4beaa59 commit 7ef9941
Show file tree
Hide file tree
Showing 50 changed files with 1,909 additions and 431 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ repos:
name: pycln (remove unused imports)

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

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: v5.11.3
hooks:
- id: isort
types_or: [python, cython]
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ EXTRAS?="betfair docker ib redis"
.PHONY: pytest pytest-coverage

install:
poetry install --extras ${EXTRAS}

install-dev:
poetry install --with dev,test,docs --extras ${EXTRAS}
poetry install --with dev,test --extras ${EXTRAS}

install-just-deps:
poetry install --with dev,test,docs --extras ${EXTRAS} --no-root
poetry install --with dev,test --extras ${EXTRAS} --no-root

build: nautilus_trader
poetry run python build.py
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
| `master` | ![version](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fnautechsystems%2Fnautilus_trader%2Fmaster%2Fversion.json) | [![build](https://github.com/nautechsystems/nautilus_trader/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/nautechsystems/nautilus_trader/actions/workflows/build.yml) |
| `develop` | ![version](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fnautechsystems%2Fnautilus_trader%2Fdevelop%2Fversion.json) | [![build](https://github.com/nautechsystems/nautilus_trader/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/nautechsystems/nautilus_trader/actions/workflows/build.yml) |

| Platform | Rust | Python |
|:-----------------|:----------|:-------|
| Linux (x86_64) | `1.65.0+` | `3.9+` |
| macOS (x86_64) | `1.65.0+` | `3.9+` |
| Windows (x86_64) | `1.65.0+` | `3.9+` |
| Platform | Rust | Python |
|:------------------|:----------|:-------|
| Linux (x86\_64) | `1.66.0+` | `3.9+` |
| macOS (x86\_64) | `1.66.0+` | `3.9+` |
| Windows (x86\_64) | `1.66.0+` | `3.9+` |

- **Website:** https://nautilustrader.io
- **Docs:** https://docs.nautilustrader.io
Expand Down Expand Up @@ -205,15 +205,15 @@ point we will follow a formal process for releases, with deprecation periods for
## Makefile
A `Makefile` is provided to automate most installation and build tasks. It provides the following targets:
- `make install` -- Installs the package using poetry
- `make install-dev` -- Installs the package using poetry (including all dev and test dependencies)
A `Makefile` is provided to automate most installation and build tasks for development. It provides the following targets:
- `make install` -- Installs the main, dev and test dependencies then installs the package using poetry
- `make install-just-deps` -- Installs just the main, dev and test dependencies (does not install package)
- `make build` -- Runs the Cython build script
- `make clean` -- Cleans all non-source artifacts from the repository
- `make docs` -- Builds the documentation HTML using Sphinx
- `make pre-commit` -- Runs the pre-commit checks over all files
- `make pytest` -- Ensures all test dependencies are installed and runs all tests with pytest (except performance)
- `make pytest-coverage` -- Same as `make pytest` and additionally runs test coverage and produces a report
- `make pytest` -- Ensures all test dependencies are installed and runs all tests with `pytest` (except performance tests)
- `make pytest-coverage` -- Same as `make pytest` and additionally runs with test coverage and produces a report
## Examples
Expand Down
18 changes: 18 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# NautilusTrader 1.163.0 Beta

Released on 17th December 2022 (UTC).

### Breaking Changes
None

### Enhancements
None

### Fixes
- Fixed `MARKET_IF_TOUCHED` and `LIMIT_IF_TOUCHED` trigger and modify behavior
- Fixed `MatchingEngine` updates of stop order types
- Fixed combinations of passive or immediate trigger vs passive or immediate fill behavior
- Fixed memory leaks from passing string pointers from Rust, thanks @twitu

---

# NautilusTrader 1.162.0 Beta

Released on 12th December 2022 (UTC).
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.162.0 (develop)": "https://docs.nautilustrader.io",
"1.161.0 (latest)": "https://docs.nautilustrader.io/latest",
"1.163.0 (develop)": "https://docs.nautilustrader.io",
"1.162.0 (latest)": "https://docs.nautilustrader.io",
},
"table_classes": ["plain"],
}
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/backtest_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
" config=EMACrossConfig(\n",
" instrument_id=instrument.id.value,\n",
" bar_type=\"EUR/USD.SIM-15-MINUTE-BID-INTERNAL\",\n",
" fast_ema=10,\n",
" slow_ema=20,\n",
" fast_ema_period=10,\n",
" slow_ema_period=20,\n",
" trade_size=Decimal(100_000),\n",
" ),\n",
" ),\n",
Expand Down
16 changes: 8 additions & 8 deletions nautilus_core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nautilus_core/common/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl TestTimer {
interval_ns,
start_time_ns,
stop_time_ns,
next_time_ns: start_time_ns + interval_ns as u64,
next_time_ns: start_time_ns + interval_ns,
is_expired: false,
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ impl Iterator for TestTimer {
}
}

self.next_time_ns += self.interval_ns as u64;
self.next_time_ns += self.interval_ns;

Some(item)
}
Expand Down
11 changes: 5 additions & 6 deletions nautilus_core/core/src/cvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ pub struct CVec {
}

impl CVec {
pub fn default() -> Self {
pub fn empty() -> Self {
CVec {
// explicitly type cast the pointer to some type
// to satisfy the compiler. Since the pointer is
// null it works for any type.
// Explicitly type cast the pointer to some type to satisfy the
// compiler. Since the pointer is null it works for any type.
ptr: null() as *const bool as *mut c_void,
len: 0,
cap: 0,
Expand All @@ -53,7 +52,7 @@ impl CVec {
impl<T> From<Vec<T>> for CVec {
fn from(data: Vec<T>) -> Self {
if data.is_empty() {
CVec::default()
CVec::empty()
} else {
let len = data.len();
let cap = data.capacity();
Expand All @@ -79,7 +78,7 @@ pub extern "C" fn cvec_drop(cvec: CVec) {

#[no_mangle]
pub extern "C" fn cvec_new() -> CVec {
CVec::default()
CVec::empty()
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions nautilus_core/model/src/orderbook/ladder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ impl Ladder {
pub fn new(side: OrderSide) -> Self {
Ladder {
side,
levels: Box::new(BTreeMap::new()),
cache: Box::new(HashMap::new()),
levels: Box::<BTreeMap<BookPrice, Level>>::default(),
cache: Box::<HashMap<u64, BookPrice>>::default(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions nautilus_core/model/src/orderbook/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ impl Level {
pub fn new(price: BookPrice) -> Self {
Level {
price,
orders: Box::new(Vec::new()),
orders: Box::<Vec<Order>>::default(),
}
}

pub fn from_order(order: Order) -> Self {
let mut level = Level {
price: order.to_book_price(),
orders: Box::new(vec![]),
orders: Box::<Vec<Order>>::default(),
};
level.add(order);
level
Expand Down
4 changes: 2 additions & 2 deletions nautilus_core/persistence/src/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ pub unsafe extern "C" fn parquet_reader_next_chunk(
let chunk = reader.next();
// Leak reader value back otherwise it will be dropped after this function
Box::into_raw(reader);
chunk.map_or_else(CVec::default, |data| data.into())
chunk.map_or_else(CVec::empty, |data| data.into())
}
ParquetType::TradeTick => {
let mut reader = Box::from_raw(reader as *mut ParquetReader<TradeTick>);
let chunk = reader.next();
// Leak reader value back otherwise it will be dropped after this function
Box::into_raw(reader);
chunk.map_or_else(CVec::default, |data| data.into())
chunk.map_or_else(CVec::empty, |data| data.into())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion nautilus_core/persistence/tests/test_parquet_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn test_parquet_reader() {
});

let mut total = 0;
let mut chunk = CVec::default();
let mut chunk = CVec::empty();
unsafe {
loop {
chunk = parquet_reader_next_chunk(reader, ParquetType::QuoteTick);
Expand Down
29 changes: 20 additions & 9 deletions nautilus_trader/backtest/matching_engine.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
# -------------------------------------------------------------------------------------------------

from libc.stdint cimport int64_t
from libc.stdint cimport uint64_t

from nautilus_trader.backtest.models cimport FillModel
Expand Down Expand Up @@ -47,8 +48,12 @@ from nautilus_trader.model.orderbook.book cimport OrderBook
from nautilus_trader.model.orderbook.data cimport OrderBookData
from nautilus_trader.model.orders.base cimport Order
from nautilus_trader.model.orders.limit cimport LimitOrder
from nautilus_trader.model.orders.limit_if_touched cimport LimitIfTouchedOrder
from nautilus_trader.model.orders.market cimport MarketOrder
from nautilus_trader.model.orders.market_if_touched cimport MarketIfTouchedOrder
from nautilus_trader.model.orders.market_to_limit cimport MarketToLimitOrder
from nautilus_trader.model.orders.stop_limit cimport StopLimitOrder
from nautilus_trader.model.orders.stop_market cimport StopMarketOrder
from nautilus_trader.model.orders.trailing_stop_limit cimport TrailingStopLimitOrder
from nautilus_trader.model.orders.trailing_stop_market cimport TrailingStopMarketOrder
from nautilus_trader.model.position cimport Position
Expand Down Expand Up @@ -80,6 +85,10 @@ cdef class OrderMatchingEngine:
"""The message bus for the matching engine.\n\n:returns: `MessageBus`"""

cdef MatchingCore _core
cdef bint _has_targets
cdef int64_t _target_bid
cdef int64_t _target_ask
cdef int64_t _target_last
cdef Bar _last_bid_bar
cdef Bar _last_ask_bar

Expand Down Expand Up @@ -118,27 +127,30 @@ cdef class OrderMatchingEngine:
cdef void _process_market_order(self, MarketOrder order) except *
cdef void _process_market_to_limit_order(self, MarketToLimitOrder order) except *
cdef void _process_limit_order(self, LimitOrder order) except *
cdef void _process_stop_market_order(self, Order order) except *
cdef void _process_stop_limit_order(self, Order order) except *
cdef void _process_stop_market_order(self, StopMarketOrder order) except *
cdef void _process_stop_limit_order(self, StopLimitOrder order) except *
cdef void _process_market_if_touched_order(self, MarketIfTouchedOrder order) except *
cdef void _process_limit_if_touched_order(self, LimitIfTouchedOrder order) except *
cdef void _process_trailing_stop_market_order(self, TrailingStopMarketOrder order) except *
cdef void _process_trailing_stop_limit_order(self, TrailingStopLimitOrder order) except *
cdef void _update_limit_order(self, Order order, Quantity qty, Price price) except *
cdef void _update_stop_market_order(self, Order order, Quantity qty, Price trigger_price) except *
cdef void _update_stop_limit_order(self, Order order, Quantity qty, Price price, Price trigger_price) except *
cdef void _update_stop_market_order(self, StopMarketOrder order, Quantity qty, Price trigger_price) except *
cdef void _update_stop_limit_order(self, StopLimitOrder order, Quantity qty, Price price, Price trigger_price) except *
cdef void _update_market_if_touched_order(self, MarketIfTouchedOrder order, Quantity qty, Price trigger_price) except *
cdef void _update_limit_if_touched_order(self, LimitIfTouchedOrder order, Quantity qty, Price price, Price trigger_price) except *
cdef void _update_trailing_stop_order(self, Order order) except *

# -- ORDER PROCESSING -----------------------------------------------------------------------------

cpdef void iterate(self, uint64_t timestamp_ns) except *
cpdef list _determine_limit_price_and_volume(self, Order order, LiquiditySide liquidity_side)
cpdef list _determine_limit_price_and_volume(self, Order order)
cpdef list _determine_market_price_and_volume(self, Order order)
cpdef void _fill_market_order(self, Order order, LiquiditySide liquidity_side) except *
cpdef void _fill_limit_order(self, Order order, LiquiditySide liquidity_side) except *
cpdef void _fill_market_order(self, Order order) except *
cpdef void _fill_limit_order(self, Order order) except *

cpdef void _apply_fills(
self,
Order order,
LiquiditySide liquidity_side,
list fills,
PositionId venue_position_id,
Position position,
Expand All @@ -150,7 +162,6 @@ cdef class OrderMatchingEngine:
Position position,
Quantity last_qty,
Price last_px,
LiquiditySide liquidity_side,
) except *

# -- IDENTIFIER GENERATORS ------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 7ef9941

Please sign in to comment.