You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user_guide/backtest_example.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Complete Backtest Example
2
2
3
-
This notebook runs through a complete backtest example using raw data (external to nautilus) to a parameterised run
3
+
This notebook runs through a complete backtest example using raw data (external to Nautilus) to a single backtest run.
4
4
5
5
<!-- #region tags=[] -->
6
6
@@ -29,7 +29,7 @@ from nautilus_trader.persistence.external.readers import TextReader
29
29
30
30
## Getting some raw data
31
31
32
-
Before we start the notebook - as a once off we need to download some sample data for backtesting
32
+
Before we start the notebook - as a once off we need to download some sample data for backtesting.
33
33
34
34
For this notebook we will use FX data from `histdata.com`, simply go to https://www.histdata.com/download-free-forex-historical-data/?/ascii/tick-data-quotes/ and select an FX pair, and one or more months of data to download.
35
35
@@ -40,7 +40,7 @@ Once you have downloaded the data, set the variable `DATA_DIR` below to the dire
40
40
DATA_DIR="~/Downloads/"
41
41
```
42
42
43
-
Run the cell below; you should see the files that you downloaded
43
+
Run the cell below; you should see the files that you downloaded:
Copy file name to clipboardExpand all lines: docs/user_guide/core_concepts.md
+30-12
Original file line number
Diff line number
Diff line change
@@ -6,27 +6,42 @@ performance with a high quality user experience, within the bounds of a robust P
6
6
- Backtesting trading strategies
7
7
- Deploying trading strategies live
8
8
9
+
The projects codebase provides a framework for implementing systems to achieve the above. You will find
10
+
the default `backtest` and `live` system implementations in their respectively named subpackages. All examples
11
+
will also either utilize the default backtest or live system implementations.
12
+
9
13
## System Architecture
14
+
15
+
### Common core
16
+
NautilusTrader has been designed to share as much common code between backtest and live systems as possible. This
17
+
is formalized in the `system` subpackage, where you will find the `NautilusKernel` class, providing a common core system kernel.
18
+
19
+
A _ports and adapters_ architectural style allows modular components to be 'plugged into' the
20
+
core system, providing many hook points for user defined / custom implementations.
21
+
22
+
### Messaging
23
+
To facilitate this modularity and loose coupling, an extremely efficient `MessageBus` passes data, commands and events as messages between components.
24
+
10
25
From a high level architectural view, it's important to understand that the platform has been designed to run efficiently
11
26
on a single thread, for both backtesting and live trading. A lot of research and testing
12
27
resulted in arriving at this design, as it was found the overhead of context switching between threads
13
28
didn't pay off in better performance.
14
29
15
-
For live trading, extremely high performance (benchmarks pending) can be achieved running asynchronously on a single [event loop](https://docs.python.org/3/library/asyncio-eventloop.html),
16
-
especially leveraging the [uvloop](https://github.com/MagicStack/uvloop) implementation (available for Linux and macOS only).
30
+
When considering the logic of how your trading will work within the system boundary, you can expect each component to consume messages
31
+
in a predictable synchronous way (_similar_ to the [actor model](https://en.wikipedia.org/wiki/Actor_model)).
17
32
18
33
```{note}
19
-
Of interest is the LMAX exchange architectire, which achieves award winning performance running on
34
+
Of interest is the LMAX exchange architecture, which achieves award winning performance running on
20
35
a single thread. You can read about their _disruptor_ pattern based architecture in [this interesting article](https://martinfowler.com/articles/lmax.html) by Martin Fowler.
21
36
```
22
37
23
-
When considering the logic of how your trading will work within the system boundary, you can expect each component to consume messages
24
-
in a predictable synchronous way (_similar_ to the [actor model](https://en.wikipedia.org/wiki/Actor_model)).
25
-
26
38
## Trading Live
27
39
A `TradingNode` can host a fleet of trading strategies, with data able to be ingested from multiple data clients, and order execution handled through multiple execution clients.
28
40
Live deployments can use both demo/paper trading accounts, or real accounts.
29
41
42
+
For live trading, extremely high performance (benchmarks pending) can be achieved running asynchronously on a single [event loop](https://docs.python.org/3/library/asyncio-eventloop.html),
43
+
especially leveraging the [uvloop](https://github.com/MagicStack/uvloop) implementation (available for Linux and macOS only).
44
+
30
45
## Data Types
31
46
The following market data types can be requested historically, and also subscribed to as live streams when available from a data publisher, and implemented in an integrations adapter.
32
47
-`OrderBookDelta`
@@ -44,10 +59,13 @@ The following PriceType options can be used for bar aggregations;
44
59
-`LAST`
45
60
46
61
The following BarAggregation options are possible;
62
+
-`MILLISECOND`
47
63
-`SECOND`
48
64
-`MINUTE`
49
65
-`HOUR`
50
66
-`DAY`
67
+
-`WEEK`
68
+
-`MONTH`
51
69
-`TICK`
52
70
-`VOLUME`
53
71
-`VALUE` (a.k.a Dollar bars)
@@ -58,16 +76,16 @@ The following BarAggregation options are possible;
58
76
-`VALUE_IMBALANCE`
59
77
-`VALUE_RUNS`
60
78
61
-
The price types and bar aggregations can be combined with step sizes >= 1 in any way through `BarSpecification`.
62
-
This enables maximum flexibility and now allows alternative bars to be produced for live trading.
79
+
The price types and bar aggregations can be combined with step sizes >= 1 in any way through a `BarSpecification`.
80
+
This enables maximum flexibility and now allows alternative bars to be aggregated for live trading.
63
81
64
82
## Account Types
65
83
The following account types are available for both live and backtest environments;
66
84
67
-
-`Cash` single-currency (base currency).
68
-
-`Cash` multi-currency.
69
-
-`Margin` single-currency (base currency).
70
-
-`Margin` multi-currency.
85
+
-`Cash` single-currency (base currency)
86
+
-`Cash` multi-currency
87
+
-`Margin` single-currency (base currency)
88
+
-`Margin` multi-currency
71
89
72
90
## Order Types
73
91
The following order types are available (when possible on an exchange);
0 commit comments