Skip to content

Commit

Permalink
docs example result
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-zehentleitner committed Jun 7, 2024
1 parent a960ec9 commit 51c0057
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 13 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ class SmaCross(Strategy):
bt = Backtest(GOOG, SmaCross, commission=.002, exclusive_orders=True)
stats = bt.run()
bt.plot()
print(f"\r\nOverview:\r\n{stats}\r\n")
print(f"\r\nEquity:\r\n{stats['_equity_curve']}\r\n")
print(f"\r\nTrades:\r\n{stats['_trades']}\r\n")
```

Results in:

[![Backtesting HTML result](https://raw.githubusercontent.com/LUCIT-Systems-and-Development/lucit-backtesting/master/images/example_html_result.png)](https://lucit-backtesting.docs.lucit.tech/_static/example_result.html)

```
Overview:
Start 2004-08-19 00:00:00
End 2013-03-01 00:00:00
Duration 3116 days 00:00:00
Expand Down Expand Up @@ -133,6 +137,35 @@ _strategy SmaCross(n1=10, n2=20)
_equity_curve Equ...
_trades Size EntryB...
dtype: object
Equity:
Equity DrawdownPct DrawdownDuration
Date
2023-01-02 13:03:00 10000.00000 0.000000 NaT
2023-01-02 13:04:00 10000.00000 0.000000 NaT
2023-01-02 13:05:00 10000.00000 0.000000 NaT
2023-01-02 13:06:00 10000.00000 0.000000 NaT
2023-01-02 13:07:00 10000.00000 0.000000 NaT
... ... ... ...
2024-01-01 00:55:00 11585.32229 0.050322 NaT
2024-01-01 00:56:00 11585.32229 0.050322 NaT
2024-01-01 00:57:00 11585.32229 0.050322 NaT
2024-01-01 00:58:00 11585.32229 0.050322 NaT
2024-01-01 00:59:00 11585.32229 0.050322 51 days 18:57:00
Trades:
Size EntryBar ExitBar EntryPrice ExitPrice PnL ReturnPct EntryTime ExitTime Tag Duration
0 6 23305 23305 1524.62018 1517.480252 -42.839567 -0.004683 2023-01-18 17:28:00 2023-01-18 17:28:00 None 0 days 00:00:00
1 6 23308 23568 1522.60415 1521.180000 -8.544900 -0.000935 2023-01-18 17:31:00 2023-01-18 21:51:00 None 0 days 04:20:00
2 6 23569 32957 1525.95417 1543.780000 106.954980 0.011682 2023-01-18 21:52:00 2023-01-25 10:20:00 None 6 days 12:28:00
3 6 32958 40820 1546.69621 1542.810000 -23.317260 -0.002513 2023-01-25 10:21:00 2023-01-30 21:23:00 None 5 days 11:02:00
4 6 40821 43959 1550.01614 1690.310000 841.763160 0.090511 2023-01-30 21:24:00 2023-02-02 01:42:00 None 2 days 04:18:00
.. ... ... ... ... ... ... ... ... ... ... ...
78 5 488520 488665 2205.67724 2184.630000 -105.236200 -0.009542 2023-12-11 19:03:00 2023-12-11 21:28:00 None 0 days 02:25:00
79 5 488666 488673 2192.94917 2185.350000 -37.995850 -0.003465 2023-12-11 21:29:00 2023-12-11 21:36:00 None 0 days 00:07:00
80 5 488674 489911 2191.03344 2187.110000 -19.617200 -0.001791 2023-12-11 21:37:00 2023-12-12 18:14:00 None 0 days 20:37:00
81 5 489912 503782 2188.65633 2305.250000 582.968350 0.053272 2023-12-12 18:15:00 2023-12-22 09:25:00 None 9 days 15:10:00
82 5 514701 517609 2277.31150 2259.124026 -90.937372 -0.007986 2023-12-29 23:24:00 2023-12-31 23:52:00 None 2 days 00:28:00
```

## Bugs
Expand Down
33 changes: 33 additions & 0 deletions dev/sphinx/source/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ class SmaCross(Strategy):
bt = Backtest(GOOG, SmaCross, commission=.002, exclusive_orders=True)
stats = bt.run()
bt.plot()
print(f"\r\nOverview:\r\n{stats}\r\n")
print(f"\r\nEquity:\r\n{stats['_equity_curve']}\r\n")
print(f"\r\nTrades:\r\n{stats['_trades']}\r\n")
```

Results in:

[![Backtesting HTML result](https://raw.githubusercontent.com/LUCIT-Systems-and-Development/lucit-backtesting/master/images/example_html_result.png)](https://lucit-backtesting.docs.lucit.tech/_static/example_result.html)

```
Overview:
Start 2004-08-19 00:00:00
End 2013-03-01 00:00:00
Duration 3116 days 00:00:00
Expand Down Expand Up @@ -133,6 +137,35 @@ _strategy SmaCross(n1=10, n2=20)
_equity_curve Equ...
_trades Size EntryB...
dtype: object
Equity:
Equity DrawdownPct DrawdownDuration
Date
2023-01-02 13:03:00 10000.00000 0.000000 NaT
2023-01-02 13:04:00 10000.00000 0.000000 NaT
2023-01-02 13:05:00 10000.00000 0.000000 NaT
2023-01-02 13:06:00 10000.00000 0.000000 NaT
2023-01-02 13:07:00 10000.00000 0.000000 NaT
... ... ... ...
2024-01-01 00:55:00 11585.32229 0.050322 NaT
2024-01-01 00:56:00 11585.32229 0.050322 NaT
2024-01-01 00:57:00 11585.32229 0.050322 NaT
2024-01-01 00:58:00 11585.32229 0.050322 NaT
2024-01-01 00:59:00 11585.32229 0.050322 51 days 18:57:00
Trades:
Size EntryBar ExitBar EntryPrice ExitPrice PnL ReturnPct EntryTime ExitTime Tag Duration
0 6 23305 23305 1524.62018 1517.480252 -42.839567 -0.004683 2023-01-18 17:28:00 2023-01-18 17:28:00 None 0 days 00:00:00
1 6 23308 23568 1522.60415 1521.180000 -8.544900 -0.000935 2023-01-18 17:31:00 2023-01-18 21:51:00 None 0 days 04:20:00
2 6 23569 32957 1525.95417 1543.780000 106.954980 0.011682 2023-01-18 21:52:00 2023-01-25 10:20:00 None 6 days 12:28:00
3 6 32958 40820 1546.69621 1542.810000 -23.317260 -0.002513 2023-01-25 10:21:00 2023-01-30 21:23:00 None 5 days 11:02:00
4 6 40821 43959 1550.01614 1690.310000 841.763160 0.090511 2023-01-30 21:24:00 2023-02-02 01:42:00 None 2 days 04:18:00
.. ... ... ... ... ... ... ... ... ... ... ...
78 5 488520 488665 2205.67724 2184.630000 -105.236200 -0.009542 2023-12-11 19:03:00 2023-12-11 21:28:00 None 0 days 02:25:00
79 5 488666 488673 2192.94917 2185.350000 -37.995850 -0.003465 2023-12-11 21:29:00 2023-12-11 21:36:00 None 0 days 00:07:00
80 5 488674 489911 2191.03344 2187.110000 -19.617200 -0.001791 2023-12-11 21:37:00 2023-12-12 18:14:00 None 0 days 20:37:00
81 5 489912 503782 2188.65633 2305.250000 582.968350 0.053272 2023-12-12 18:15:00 2023-12-22 09:25:00 None 9 days 15:10:00
82 5 514701 517609 2277.31150 2259.124026 -90.937372 -0.007986 2023-12-29 23:24:00 2023-12-31 23:52:00 None 2 days 00:28:00
```

## Bugs
Expand Down
2 changes: 1 addition & 1 deletion docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
33 changes: 33 additions & 0 deletions docs/_sources/readme.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ class SmaCross(Strategy):
bt = Backtest(GOOG, SmaCross, commission=.002, exclusive_orders=True)
stats = bt.run()
bt.plot()
print(f"\r\nOverview:\r\n{stats}\r\n")
print(f"\r\nEquity:\r\n{stats['_equity_curve']}\r\n")
print(f"\r\nTrades:\r\n{stats['_trades']}\r\n")
```

Results in:

[![Backtesting HTML result](https://raw.githubusercontent.com/LUCIT-Systems-and-Development/lucit-backtesting/master/images/example_html_result.png)](https://lucit-backtesting.docs.lucit.tech/_static/example_result.html)

```
Overview:
Start 2004-08-19 00:00:00
End 2013-03-01 00:00:00
Duration 3116 days 00:00:00
Expand Down Expand Up @@ -133,6 +137,35 @@ _strategy SmaCross(n1=10, n2=20)
_equity_curve Equ...
_trades Size EntryB...
dtype: object

Equity:
Equity DrawdownPct DrawdownDuration
Date
2023-01-02 13:03:00 10000.00000 0.000000 NaT
2023-01-02 13:04:00 10000.00000 0.000000 NaT
2023-01-02 13:05:00 10000.00000 0.000000 NaT
2023-01-02 13:06:00 10000.00000 0.000000 NaT
2023-01-02 13:07:00 10000.00000 0.000000 NaT
... ... ... ...
2024-01-01 00:55:00 11585.32229 0.050322 NaT
2024-01-01 00:56:00 11585.32229 0.050322 NaT
2024-01-01 00:57:00 11585.32229 0.050322 NaT
2024-01-01 00:58:00 11585.32229 0.050322 NaT
2024-01-01 00:59:00 11585.32229 0.050322 51 days 18:57:00

Trades:
Size EntryBar ExitBar EntryPrice ExitPrice PnL ReturnPct EntryTime ExitTime Tag Duration
0 6 23305 23305 1524.62018 1517.480252 -42.839567 -0.004683 2023-01-18 17:28:00 2023-01-18 17:28:00 None 0 days 00:00:00
1 6 23308 23568 1522.60415 1521.180000 -8.544900 -0.000935 2023-01-18 17:31:00 2023-01-18 21:51:00 None 0 days 04:20:00
2 6 23569 32957 1525.95417 1543.780000 106.954980 0.011682 2023-01-18 21:52:00 2023-01-25 10:20:00 None 6 days 12:28:00
3 6 32958 40820 1546.69621 1542.810000 -23.317260 -0.002513 2023-01-25 10:21:00 2023-01-30 21:23:00 None 5 days 11:02:00
4 6 40821 43959 1550.01614 1690.310000 841.763160 0.090511 2023-01-30 21:24:00 2023-02-02 01:42:00 None 2 days 04:18:00
.. ... ... ... ... ... ... ... ... ... ... ...
78 5 488520 488665 2205.67724 2184.630000 -105.236200 -0.009542 2023-12-11 19:03:00 2023-12-11 21:28:00 None 0 days 02:25:00
79 5 488666 488673 2192.94917 2185.350000 -37.995850 -0.003465 2023-12-11 21:29:00 2023-12-11 21:36:00 None 0 days 00:07:00
80 5 488674 489911 2191.03344 2187.110000 -19.617200 -0.001791 2023-12-11 21:37:00 2023-12-12 18:14:00 None 0 days 20:37:00
81 5 489912 503782 2188.65633 2305.250000 582.968350 0.053272 2023-12-12 18:15:00 2023-12-22 09:25:00 None 9 days 15:10:00
82 5 514701 517609 2277.31150 2259.124026 -90.937372 -0.007986 2023-12-29 23:24:00 2023-12-31 23:52:00 None 2 days 00:28:00
```

## Bugs
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/code_of_conduct.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
2 changes: 1 addition & 1 deletion docs/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ <h3>Navigation</h3>
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
&copy; <a href="/license.html">Copyright</a> 2024-2024, LUCIT Systems and Development. All Rights Reserved..
See <a href="/license.html">License</a> for more information.<br />
Last updated on Jun 07 2024 at 10:42 (CET).
Last updated on Jun 07 2024 at 10:51 (CET).
<a href="https://github.com/LUCIT-Systems-and-Development/lucit-backtesting/issues/new/choose">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
Expand Down
Loading

0 comments on commit 51c0057

Please sign in to comment.