Skip to content

Commit

Permalink
Release 1.170.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Mar 12, 2023
2 parents c44b7cb + d47a776 commit afdf8d9
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 71 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ jobs:
uses: actions/checkout@v3

# Rust setup (ensures latest stable)
- name: Set up Rust tool-chain
- name: Set up Rust tool-chain (Liux/Windows)
if: runner.os != 'macOS'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Set up Rust tool-chain (macOS)
if: runner.os == 'macOS'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

# Python setup
- name: Set up Python environment
uses: actions/setup-python@v4
Expand Down Expand Up @@ -78,18 +87,9 @@ jobs:
run: python -m pip install --upgrade pip setuptools wheel pre-commit poetry==1.3.2

# Setup Poetry caching
- name: Set output (Linux)
if: runner.os == 'Linux'
run: echo "dir=$(poetry config cache-dir)" >> $GITHUB_ENV

- name: Set output (macOS)
if: runner.os == 'macOS'
- name: Set output
run: echo "dir=$(poetry config cache-dir)" >> $GITHUB_ENV

- name: Set output (Windows)
if: runner.os == 'Windows'
run: echo "dir=$(poetry config cache-dir)" | Out-File -FilePath $env:GITHUB_ENV -Append >> $GITHUB_ENV

- name: Poetry cache
id: cached-poetry
uses: actions/cache@v3
Expand Down Expand Up @@ -159,18 +159,9 @@ jobs:
run: python -m pip install --upgrade pip setuptools wheel pre-commit poetry==1.3.2

# Setup Poetry caching
- name: Set output (Linux)
if: runner.os == 'Linux'
run: echo "dir=$(poetry config cache-dir)" >> $GITHUB_ENV

- name: Set output (macOS)
if: runner.os == 'macOS'
- name: Set output
run: echo "dir=$(poetry config cache-dir)" >> $GITHUB_ENV

- name: Set output (Windows)
if: runner.os == 'Windows'
run: echo "dir=$(poetry config cache-dir)" | Out-File -FilePath $env:GITHUB_ENV -Append >> $GITHUB_ENV

- name: Poetry cache
id: cached-poetry
uses: actions/cache@v3
Expand Down Expand Up @@ -231,12 +222,21 @@ jobs:
uses: actions/checkout@v3

# Rust setup (ensures latest stable)
- name: Set up Rust tool-chain
- name: Set up Rust tool-chain (Liux/Windows)
if: runner.os != 'macOS'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Set up Rust tool-chain (macOS)
if: runner.os == 'macOS'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

# Python setup
- name: Set up Python environment
uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/backtest_fx_usdjpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"from nautilus_trader.backtest.models import FillModel\n",
"from nautilus_trader.backtest.modules import FXRolloverInterestConfig\n",
"from nautilus_trader.backtest.modules import FXRolloverInterestModule\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.config.common import RiskEngineConfig\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACross\n",
"from nautilus_trader.examples.strategies.ema_cross import EMACrossConfig\n",
Expand All @@ -29,7 +28,8 @@
"from nautilus_trader.model.identifiers import Venue\n",
"from nautilus_trader.model.objects import Money\n",
"from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler\n",
"from nautilus_trader.test_kit.providers import TestDataProvider"
"from nautilus_trader.test_kit.providers import TestDataProvider\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/external_data_backtest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"from nautilus_trader.model.data.tick import QuoteTick\n",
"from nautilus_trader.model.objects import Price, Quantity\n",
"\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.backtest.node import BacktestNode, BacktestVenueConfig, BacktestDataConfig, BacktestRunConfig, BacktestEngineConfig\n",
"from nautilus_trader.config.common import ImportableStrategyConfig\n",
"from nautilus_trader.persistence.catalog import ParquetDataCatalog\n",
"from nautilus_trader.persistence.external.core import process_files, write_objects\n",
"from nautilus_trader.persistence.external.readers import TextReader"
"from nautilus_trader.persistence.external.readers import TextReader\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"from nautilus_trader.model.data.tick import QuoteTick\n",
"from nautilus_trader.model.objects import Price, Quantity\n",
"\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider\n",
"from nautilus_trader.backtest.node import BacktestNode, BacktestVenueConfig, BacktestDataConfig, BacktestRunConfig, BacktestEngineConfig\n",
"from nautilus_trader.config.common import ImportableStrategyConfig\n",
"from nautilus_trader.persistence.catalog import ParquetDataCatalog\n",
"from nautilus_trader.persistence.external.core import process_files, write_objects\n",
"from nautilus_trader.persistence.external.readers import TextReader"
"from nautilus_trader.persistence.external.readers import TextReader\n",
"from nautilus_trader.test_kit.providers import TestInstrumentProvider"
]
},
{
Expand Down
44 changes: 22 additions & 22 deletions nautilus_core/Cargo.lock

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

2 changes: 1 addition & 1 deletion nautilus_trader/adapters/betfair/parsing/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async def generate_trades_list(
self._log.warn(f"Found no existing order for {venue_order_id}")
return []
fill = filled["clearedOrders"][0]
ts_event = int(pd.Timestamp(fill["lastMatchedDate"]).to_datetime64())
ts_event = pd.Timestamp(fill["lastMatchedDate"]).value
return [
TradeReport(
client_order_id=self.venue_order_id_to_client_order_id[venue_order_id],
Expand Down
2 changes: 1 addition & 1 deletion nautilus_trader/adapters/betfair/parsing/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ async def generate_trades_list(
self._log.warn(f"Found no existing order for {venue_order_id}")
return []
fill = filled[0]
ts_event = int(pd.Timestamp(fill.lastMatchedDate).to_datetime64())
ts_event = pd.Timestamp(fill.lastMatchedDate).value
return [
TradeReport(
account_id=AccountId("BETFAIR"),
Expand Down
4 changes: 2 additions & 2 deletions nautilus_trader/backtest/engine.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -887,14 +887,14 @@ cdef class BacktestEngine:
start = unix_nanos_to_dt(start_ns)
else:
start = pd.to_datetime(start, utc=True)
start_ns = int(start.to_datetime64())
start_ns = start.value
if end is None:
# Set `end` to end of data
end_ns = self._data[-1].ts_init
end = unix_nanos_to_dt(end_ns)
else:
end = pd.to_datetime(end, utc=True)
end_ns = int(end.to_datetime64())
end_ns = end.value
Condition.true(start_ns < end_ns, "start was >= end")
Condition.not_empty(self._data, "data")

Expand Down
2 changes: 2 additions & 0 deletions nautilus_trader/model/orders/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ cdef dict _ORDER_STATE_TABLE = {
(OrderStatus.ACCEPTED, OrderStatus.FILLED): OrderStatus.FILLED,
(OrderStatus.CANCELED, OrderStatus.PARTIALLY_FILLED): OrderStatus.PARTIALLY_FILLED, # Real world possibility
(OrderStatus.CANCELED, OrderStatus.FILLED): OrderStatus.FILLED, # Real world possibility
(OrderStatus.PENDING_UPDATE, OrderStatus.REJECTED): OrderStatus.REJECTED, # Real world possibility
(OrderStatus.PENDING_UPDATE, OrderStatus.ACCEPTED): OrderStatus.ACCEPTED,
(OrderStatus.PENDING_UPDATE, OrderStatus.CANCELED): OrderStatus.CANCELED,
(OrderStatus.PENDING_UPDATE, OrderStatus.EXPIRED): OrderStatus.EXPIRED,
Expand All @@ -98,6 +99,7 @@ cdef dict _ORDER_STATE_TABLE = {
(OrderStatus.PENDING_UPDATE, OrderStatus.PENDING_CANCEL): OrderStatus.PENDING_CANCEL,
(OrderStatus.PENDING_UPDATE, OrderStatus.PARTIALLY_FILLED): OrderStatus.PARTIALLY_FILLED,
(OrderStatus.PENDING_UPDATE, OrderStatus.FILLED): OrderStatus.FILLED,
(OrderStatus.PENDING_CANCEL, OrderStatus.REJECTED): OrderStatus.REJECTED, # Real world possibility
(OrderStatus.PENDING_CANCEL, OrderStatus.PENDING_CANCEL): OrderStatus.PENDING_CANCEL, # Allow multiple requests
(OrderStatus.PENDING_CANCEL, OrderStatus.CANCELED): OrderStatus.CANCELED,
(OrderStatus.PENDING_CANCEL, OrderStatus.ACCEPTED): OrderStatus.ACCEPTED, # Allows failed cancel requests
Expand Down
4 changes: 3 additions & 1 deletion nautilus_trader/system/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ def __init__( # noqa (too complex)
f"environment {environment} not recognized", # pragma: no cover (design-time error)
)

# Setup the logger with a `LiveClock` initially,
# which is later swapped out for a `TestClock` in the `BacktestEngine`.
self._logger = Logger(
clock=self._clock,
clock=self._clock if isinstance(self._clock, LiveClock) else LiveClock(),
trader_id=self._trader_id,
machine_id=self._machine_id,
instance_id=self._instance_id,
Expand Down
4 changes: 2 additions & 2 deletions nautilus_trader/trading/filters.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ cdef class EconomicNewsEventFilter:

cdef int index = 0
row = events.iloc[index]
cdef uint64_t ts_event = int(pd.Timestamp(events.index[index]).to_datetime64())
cdef uint64_t ts_event = pd.Timestamp(events.index[index]).value
return NewsEvent(
NewsImpact[row["Impact"]],
row["Name"],
Expand Down Expand Up @@ -528,7 +528,7 @@ cdef class EconomicNewsEventFilter:

cdef int index = -1
row = events.iloc[index]
cdef uint64_t ts_event = int(pd.Timestamp(events.index[index]).to_datetime64())
cdef uint64_t ts_event = pd.Timestamp(events.index[index]).value
return NewsEvent(
NewsImpact[row["Impact"]],
row["Name"],
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

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

5 changes: 1 addition & 4 deletions tests/unit_tests/persistence/external/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ def test_repartition_dataset(self):
{
"value": np.arange(5),
"instrument_id": ["a", "a", "a", "b", "b"],
"ts_init": [
int(ts.to_datetime64())
for ts in pd.date_range(start_date, periods=5, tz="UTC")
],
"ts_init": [ts.value for ts in pd.date_range(start_date, periods=5, tz="UTC")],
},
)
write_parquet(
Expand Down
Loading

0 comments on commit afdf8d9

Please sign in to comment.