-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #487 from Lumiwealth/dev
docs updatee
- Loading branch information
Showing
324 changed files
with
7,590 additions
and
1,460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 889a56d9d3058a1633d681a13410595e | ||
config: a7e3393e95f5c868a7c5563e296474bb | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
2 changes: 1 addition & 1 deletion
2
docsrc/backtesting.all.rst → ...ces/backtesting.backtest_function.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Backtesting Function | ||
--------------------------- | ||
|
||
Here is a description of the backtest function and all of its parameters. This is true for any kind of backtesting that you will be doing. | ||
|
||
.. autofunction:: strategies.strategy.Strategy.backtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Indicators Files | ||
================ | ||
|
||
The **Indicators HTML** and **Indicators CSV** files contain data on the indicators used in the strategy. These files are unique because they use two key functions: | ||
|
||
- **add_marker()**: Adds markers to the indicators. For more details, refer to `add_marker <../docs/strategy_methods.chart/strategies.strategy.Strategy.add_marker.html>`_. | ||
- **add_line()**: Adds lines to the indicators. For more details, refer to `add_line <../docs/strategy_methods.chart/strategies.strategy.Strategy.add_line.html>`_. | ||
|
||
These functions help in visualizing how the indicators influenced the strategy's decisions and performance. Key information includes: | ||
|
||
- **Indicator Values:** The values of each indicator at different points in time. | ||
|
||
.. figure:: _static/images/indicators_example.png | ||
:alt: Indicators example | ||
:width: 600px | ||
:align: center |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Logs CSV | ||
======== | ||
|
||
The **Logs CSV** file logs all events and actions taken by the strategy during the backtest. It is useful for debugging and understanding the decision-making process of the strategy. | ||
|
||
These files collectively provide a comprehensive view of the backtest, allowing for detailed analysis and refinement of trading strategies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
Backtesting | ||
************************ | ||
|
||
Lumibot has three modes for backtesting. | ||
Lumibot has three modes for backtesting: | ||
|
||
#. Yahoo Backtesting: Daily stock backtesting with data from Yahoo. | ||
#. Pandas Backtesting: Intra-day and inter-day testing of stocks and futures using CSV data supplied by you. | ||
#. Polygon Backtesting: Intra-day and inter-day testing of stocks and futures using Polygon data from polygon.io | ||
1. **Yahoo Backtesting:** Daily stock backtesting with data from Yahoo. | ||
2. **Pandas Backtesting:** Intra-day and inter-day testing of stocks and futures using CSV data supplied by you. | ||
3. **Polygon Backtesting:** Intra-day and inter-day testing of stocks and futures using Polygon data from polygon.io. | ||
|
||
It is recommended to use the Yahoo Backtesting for daily stock backtesting, or Polygon Backtesting for intra-day and inter-day testing of stocks, options, crypto and FOREX. Pandas Backtesting is an advanced feature that allows you to test any type of data you have in CSV format but requires more work to setup and is not recommended for most users. | ||
It is recommended to use Yahoo Backtesting for daily stock backtesting, or Polygon Backtesting for intra-day and inter-day testing of stocks, options, crypto, and FOREX. Pandas Backtesting is an advanced feature that allows you to test any type of data you have in CSV format but requires more work to setup and is not recommended for most users. | ||
|
||
Files Generated from Backtesting | ||
================================ | ||
|
||
When you run a backtest, several important files are generated, each prefixed by the strategy name and the date. These files provide detailed insights into the performance and behavior of the strategy. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
backtesting.all | ||
backtesting.tearsheet_html | ||
backtesting.trades_files | ||
backtesting.indicators_files | ||
backtesting.logs_csv | ||
backtesting.backtesting_function | ||
backtesting.yahoo | ||
backtesting.pandas | ||
backtesting.polygon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Tearsheet HTML | ||
============== | ||
|
||
.. note:: | ||
The **Tearsheet HTML** is one of the most important files generated and is created using the `quantstats-lumi` library. It includes a variety of metrics such as: | ||
|
||
- **Average Annual Return:** The yearly return of the strategy. | ||
- **Total Return:** The overall return from the start to the end of the backtest period. | ||
- **Sharpe Ratio:** A measure of risk-adjusted return. | ||
- **RoMaD (Return over Maximum Drawdown):** A ratio that compares return to the maximum drawdown. | ||
- **Sortino Ratio:** A variation of the Sharpe ratio that differentiates harmful volatility from total overall volatility. | ||
- **Max Drawdown:** The maximum observed loss from a peak to a trough of a portfolio, before a new peak is attained. | ||
- **Longest Drawdown Duration:** The longest period during which the portfolio has not reached a new peak. | ||
|
||
These metrics are accompanied by various graphs such as: | ||
|
||
- **Cumulative Returns vs Benchmark:** Shows the strategy's cumulative returns compared to a benchmark. | ||
- **Cumulative Returns (Log Scaled):** A log-scaled version of cumulative returns for better visualization of exponential growth. | ||
|
||
.. figure:: _static/images/tearsheet_condor_martingale.png | ||
:alt: Tearsheet example 1 | ||
:width: 600px | ||
:align: center | ||
|
||
.. figure:: _static/images/tearsheet_crypto_bbands_v2.png | ||
:alt: Tearsheet example 2 | ||
:width: 600px | ||
:align: center | ||
|
||
.. important:: | ||
These tearsheets showcase different strategies we offer. Each strategy is tailored to achieve specific goals: | ||
|
||
- **Condor Martingale Strategy:** Creates an Iron Condor with a defined delta, adjusting quantities based on previous performance. It uses a 1 DTE Iron Condor expiring daily. | ||
- **Crypto BBands v2 Strategy:** Uses Bollinger Bands and exponential moving averages to determine buy and sell points. | ||
|
||
Interested in implementing these strategies? Visit our website at `Lumiwealth <https://www.lumiwealth.com/?utm_source=documentation&utm_medium=referral&utm_campaign=lumibot_backtesting_section>`_ to access the code and start optimizing your investments. For any questions, email us at [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Trades Files | ||
============ | ||
|
||
The **Trades HTML** and **Trades CSV** files provide detailed information about each trade executed by the strategy. This includes: | ||
|
||
- **Buy and Sell Orders:** The times and prices at which buy or sell orders were placed, along with the asset involved (e.g., option strike price or stock ticker). | ||
- **Portfolio Value:** The value of the portfolio at each time point. | ||
- **Cash:** The amount of cash available at each time point. | ||
|
||
.. figure:: _static/images/trades_example.png | ||
:alt: Trades example | ||
:width: 600px | ||
:align: center |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.