Skip to content

Commit f713b55

Browse files
authored
1.122.0
See release notes.
2 parents bd41532 + 6cdf728 commit f713b55

File tree

258 files changed

+5249
-4184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+5249
-4184
lines changed

RELEASES.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
# NautilusTrader 1.122.0 Beta - Release Notes
2+
3+
This release includes numerous breaking changes with a view to enhancing the core
4+
functionality and API of the platform. The data and execution caches have been
5+
unified for simplicity. There have also been large changes to the accounting
6+
functionality, with 'hooks' added in preparation for accurate calculation and
7+
handling of margins.
8+
9+
## Breaking Changes
10+
- Renamed `Account.balance()` to `Account.balance_total()`.
11+
- Consolidated`TradingStrategy.data` into `TradingStrategy.cache`.
12+
- Consolidated `TradingStrategy.execution` into `TradingStrategy.cache`.
13+
- Moved `redis` subpackage into `infrastructure`.
14+
- Moved some accounting methods back to `Instrument`.
15+
- Removed `Instrument.market_value()`.
16+
- Renamed `Portfolio.market_values()` to `Portfolio.net_exposures()`.
17+
- Renamed `Portfolio.market_value()` to `Portfolio.net_exposure()`.
18+
- Renamed `InMemoryExecutionDatabase` to `BypassCacheDatabase`.
19+
- Renamed `Position.relative_qty` to `Position.net_qty`.
20+
- Renamed `default_currency` to `base_currency`.
21+
- Removed `cost_currency` property from `Instrument`.
22+
23+
## Enhancements
24+
- `ExecutionClient` now has the option of calculating account state.
25+
- Unified data and execution caches into single `Cache`.
26+
- Improved configuration options and naming.
27+
- Simplified `Portfolio` component registration.
28+
- Simplified wiring of `Cache` into components.
29+
- Added `repr` to execution messages.
30+
- Added `AccountType` enum.
31+
- Added `cost_currency` to `Position`.
32+
- Added `get_cost_currency()` to `Instrument`.
33+
- Added `get_base_currency()` to `Instrument`.
34+
35+
## Fixes
36+
- Fixed `Order.is_working` for `PENDING_CANCEL` and `PENDING_REPLACE` states.
37+
- Fixed loss of precision for nanosecond timestamps in Redis.
38+
- Fixed state reconciliation when uninstantiated client.
39+
40+
---
41+
142
# NautilusTrader 1.121.0 Beta - Release Notes
243

344
In this release there has been a major change to the use of inlines for method
@@ -85,7 +126,7 @@ natural flow of command and event messages.
85126
## Breaking Changes
86127
- Serializations involving `Money`.
87128
- Changed usage of `Price` and `Quantity`.
88-
- Renamed `BypassExecutionDatabase` to `InMemoryExecutionDatabase`.
129+
- Renamed `BypassExecutionDatabase` to `BypassCacheDatabase`.
89130

90131
## Enhancements
91132
- Rewired `RiskEngine` and `ExecutionEngine` sequence.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Cache
2+
=====
3+
4+
.. automodule:: nautilus_trader.cache
5+
6+
Base
7+
----
8+
9+
.. automodule:: nautilus_trader.cache.base
10+
:show-inheritance:
11+
:inherited-members:
12+
:members:
13+
:member-order: bysource
14+
15+
Cache
16+
-----
17+
18+
.. automodule:: nautilus_trader.cache.cache
19+
:show-inheritance:
20+
:inherited-members:
21+
:members:
22+
:member-order: bysource
23+
24+
Database
25+
--------
26+
27+
.. automodule:: nautilus_trader.cache.database
28+
:show-inheritance:
29+
:inherited-members:
30+
:members:
31+
:member-order: bysource
32+
33+
Identifier
34+
----------
35+
36+
.. automodule:: nautilus_trader.cache.identifier
37+
:show-inheritance:
38+
:inherited-members:
39+
:members:
40+
:member-order: bysource

docs/source/api_reference/core.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Datetime
2222
:member-order: bysource
2323

2424
Finite-State Machine (FSM)
25-
--------------------------------
25+
--------------------------
2626

2727
.. automodule:: nautilus_trader.core.fsm
2828
:show-inheritance:

docs/source/api_reference/data.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@ Aggregation
1313
:members:
1414
:member-order: bysource
1515

16-
Base
17-
----
18-
19-
.. automodule:: nautilus_trader.data.base
20-
:show-inheritance:
21-
:inherited-members:
22-
:members:
23-
:member-order: bysource
24-
25-
Cache
26-
-----
27-
28-
.. automodule:: nautilus_trader.data.cache
29-
:show-inheritance:
30-
:inherited-members:
31-
:members:
32-
:member-order: bysource
33-
3416
Client
3517
------
3618

docs/source/api_reference/execution.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,6 @@ Execution
44
.. automodule:: nautilus_trader.execution
55

66

7-
Base
8-
----
9-
10-
.. automodule:: nautilus_trader.execution.base
11-
:show-inheritance:
12-
:inherited-members:
13-
:members:
14-
:member-order: bysource
15-
16-
Cache
17-
-----
18-
19-
.. automodule:: nautilus_trader.execution.cache
20-
:show-inheritance:
21-
:inherited-members:
22-
:members:
23-
:member-order: bysource
24-
257
Client
268
------
279

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Infrastructure
2+
==============
3+
4+
.. automodule:: nautilus_trader.infrastructure
5+
6+
Cache
7+
-----
8+
9+
.. automodule:: nautilus_trader.infrastructure.cache
10+
:show-inheritance:
11+
:inherited-members:
12+
:members:
13+
:member-order: bysource

docs/source/api_reference/model.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@ Identifiers
7676
:members:
7777
:member-order: bysource
7878

79-
Instrument
80-
----------
81-
82-
.. automodule:: nautilus_trader.model.instrument
83-
:show-inheritance:
84-
:inherited-members:
85-
:members:
86-
:member-order: bysource
87-
8879
Objects
8980
-------
9081

docs/source/api_reference/serialization.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Base
1313
:members:
1414
:member-order: bysource
1515

16-
1716
Serializers
1817
-----------
1918

docs/source/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,15 @@ Index
112112

113113
api_reference/analysis
114114
api_reference/backtest
115+
api_reference/cache
115116
api_reference/common
116117
api_reference/core
117118
api_reference/data
118119
api_reference/execution
119120
api_reference/indicators
121+
api_reference/infrastructure
120122
api_reference/live
121123
api_reference/model
122-
api_reference/redis
123124
api_reference/risk
124125
api_reference/serialization
125126
api_reference/trading

examples/backtest/crypto_ema_cross_ethusdt_trade_ticks.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@
1515
# -------------------------------------------------------------------------------------------------
1616

1717
from decimal import Decimal
18-
import pathlib
18+
import os
1919
import sys
2020

2121
import ccxt
2222
import pandas as pd
2323

2424

2525
sys.path.insert(
26-
0, str(pathlib.Path(__file__).parents[2])
26+
0, str(os.path.abspath(__file__ + "/../../../"))
2727
) # Allows relative imports from examples
2828

2929
from examples.strategies.ema_cross_simple import EMACross
3030
from nautilus_trader.adapters.ccxt.providers import CCXTInstrumentProvider
3131
from nautilus_trader.backtest.engine import BacktestEngine
3232
from nautilus_trader.backtest.models import FillModel
3333
from nautilus_trader.model.bar import BarSpecification
34-
from nautilus_trader.model.currencies import BTC
34+
from nautilus_trader.model.currencies import ETH
3535
from nautilus_trader.model.currencies import USDT
36+
from nautilus_trader.model.enums import AccountType
3637
from nautilus_trader.model.enums import BarAggregation
3738
from nautilus_trader.model.enums import OMSType
3839
from nautilus_trader.model.enums import PriceType
@@ -80,7 +81,9 @@
8081
venue=BINANCE,
8182
venue_type=VenueType.EXCHANGE,
8283
oms_type=OMSType.NETTING,
83-
starting_balances=[Money(1_000_000, USDT), Money(1, BTC)],
84+
account_type=AccountType.CASH, # Spot cash account
85+
base_currency=None, # Multi-currency account
86+
starting_balances=[Money(1_000_000, USDT), Money(10, ETH)],
8487
fill_model=fill_model,
8588
)
8689

0 commit comments

Comments
 (0)