From 78eeecb88cbcffa2456f847ace4d38c8d20f5677 Mon Sep 17 00:00:00 2001 From: Derek Melchin <38889814+DerekMelchin@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:01:44 -0500 Subject: [PATCH] Add draft for new historical data structure --- .../01 History Requests.html | 18 +++++ .../02 Warm Up Periods.html | 12 ++++ .../01 Getting Started/metadata.json | 12 ++++ .../02 History Requests/01 Introduction.html | 0 .../02 Flat DataFrames.html | 0 .../03 Trailing Time Periods.html | 0 .../04 Trailing Data Samples.html | 0 .../02 History Requests/05 Date Ranges.html | 0 .../02 History Requests/metadata.json | 12 ++++ .../03 History Responses/01 Introduction.html | 0 .../03 History Responses/02 DataFrames.html | 0 .../03 History Responses/03 Slices.html | 0 .../03 History Responses/04 Lists.html | 0 .../03 History Responses/metadata.json | 12 ++++ .../01 US Equities/01 Introduction.php | 0 .../01 US Equities/02 Trades.php | 0 .../01 US Equities/03 Quotes.php | 0 .../01 US Equities/04 Ticks.php | 0 .../01 US Equities/05 Slices.php | 0 .../01 US Equities/06 Splits.php | 0 .../01 US Equities/07 Dividends.php | 0 .../01 US Equities/08 Symbol Changes.php | 0 .../01 US Equities/09 Delistings.php | 0 .../01 US Equities/10 Universes.php | 0 .../01 US Equities/11 Alternative Data.php | 0 .../01 US Equities/12 Indicators.php | 0 .../01 US Equities/13 Short Availability.php | 0 .../01 US Equities/metadata.json | 12 ++++ .../05 Alternative Data/01 Introduction.php | 0 .../05 Alternative Data/02 Slices.php | 0 .../05 Alternative Data/03 Data Points.php | 0 .../05 Alternative Data/04 Universes.php | 0 .../05 Alternative Data/metadata.json | 12 ++++ .../06 Custom Data/01 Introduction.php | 0 .../06 Custom Data/02 Slices.php | 0 .../06 Custom Data/03 Data Points.php | 0 .../06 Custom Data/04 Universes.php | 0 .../06 Custom Data/metadata.json | 12 ++++ .../07 Warm Up Periods/01 Introduction.php | 1 + .../02 Set Warm Up Periods.html | 70 +++++++++++++++++++ .../03 Warm Up Vs Reality.html | 19 +++++ .../07 Warm Up Periods/04 Event Handler.html | 11 +++ .../07 Warm Up Periods/05 Limitations.html | 1 + .../07 Warm Up Periods/99 Examples.html | 11 +++ .../07 Warm Up Periods/metadata.json | 12 ++++ .../08 Rolling Window/01 Introduction.php | 1 + .../08 Rolling Window/02 Supported Types.php | 1 + .../08 Rolling Window/03 Add Data.php | 1 + .../08 Rolling Window/04 Warm Up.php | 1 + .../08 Rolling Window/05 Check Readiness.php | 1 + .../08 Rolling Window/06 Adjust Size.php | 1 + .../08 Rolling Window/07 Access Data.php | 1 + .../08 Combine with Indicators.php | 1 + .../09 Combine with Consolidators.php | 1 + .../10 Cast to Other Types.php | 1 + .../08 Rolling Window/11 Delete Data.php | 1 + .../08 Rolling Window/12 Examples.php | 1 + .../08 Rolling Window/metadata.json | 12 ++++ .../09 Common Errors/01 Introduction.html | 7 ++ 59 files changed, 258 insertions(+) create mode 100644 08 Drafts/05 Historical Data/01 Getting Started/01 History Requests.html create mode 100644 08 Drafts/05 Historical Data/01 Getting Started/02 Warm Up Periods.html create mode 100644 08 Drafts/05 Historical Data/01 Getting Started/metadata.json create mode 100644 08 Drafts/05 Historical Data/02 History Requests/01 Introduction.html create mode 100644 08 Drafts/05 Historical Data/02 History Requests/02 Flat DataFrames.html create mode 100644 08 Drafts/05 Historical Data/02 History Requests/03 Trailing Time Periods.html create mode 100644 08 Drafts/05 Historical Data/02 History Requests/04 Trailing Data Samples.html create mode 100644 08 Drafts/05 Historical Data/02 History Requests/05 Date Ranges.html create mode 100644 08 Drafts/05 Historical Data/02 History Requests/metadata.json create mode 100644 08 Drafts/05 Historical Data/03 History Responses/01 Introduction.html create mode 100644 08 Drafts/05 Historical Data/03 History Responses/02 DataFrames.html create mode 100644 08 Drafts/05 Historical Data/03 History Responses/03 Slices.html create mode 100644 08 Drafts/05 Historical Data/03 History Responses/04 Lists.html create mode 100644 08 Drafts/05 Historical Data/03 History Responses/metadata.json create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/01 Introduction.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/02 Trades.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/03 Quotes.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/04 Ticks.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/05 Slices.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/06 Splits.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/07 Dividends.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/08 Symbol Changes.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/09 Delistings.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/10 Universes.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/11 Alternative Data.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/12 Indicators.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/13 Short Availability.php create mode 100644 08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/metadata.json create mode 100644 08 Drafts/05 Historical Data/05 Alternative Data/01 Introduction.php create mode 100644 08 Drafts/05 Historical Data/05 Alternative Data/02 Slices.php create mode 100644 08 Drafts/05 Historical Data/05 Alternative Data/03 Data Points.php create mode 100644 08 Drafts/05 Historical Data/05 Alternative Data/04 Universes.php create mode 100644 08 Drafts/05 Historical Data/05 Alternative Data/metadata.json create mode 100644 08 Drafts/05 Historical Data/06 Custom Data/01 Introduction.php create mode 100644 08 Drafts/05 Historical Data/06 Custom Data/02 Slices.php create mode 100644 08 Drafts/05 Historical Data/06 Custom Data/03 Data Points.php create mode 100644 08 Drafts/05 Historical Data/06 Custom Data/04 Universes.php create mode 100644 08 Drafts/05 Historical Data/06 Custom Data/metadata.json create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/01 Introduction.php create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/02 Set Warm Up Periods.html create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/03 Warm Up Vs Reality.html create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/04 Event Handler.html create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/05 Limitations.html create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/99 Examples.html create mode 100644 08 Drafts/05 Historical Data/07 Warm Up Periods/metadata.json create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/01 Introduction.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/02 Supported Types.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/03 Add Data.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/04 Warm Up.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/05 Check Readiness.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/06 Adjust Size.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/07 Access Data.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/08 Combine with Indicators.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/09 Combine with Consolidators.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/10 Cast to Other Types.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/11 Delete Data.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/12 Examples.php create mode 100644 08 Drafts/05 Historical Data/08 Rolling Window/metadata.json create mode 100644 08 Drafts/05 Historical Data/09 Common Errors/01 Introduction.html diff --git a/08 Drafts/05 Historical Data/01 Getting Started/01 History Requests.html b/08 Drafts/05 Historical Data/01 Getting Started/01 History Requests.html new file mode 100644 index 0000000000..be0bd59ccb --- /dev/null +++ b/08 Drafts/05 Historical Data/01 Getting Started/01 History Requests.html @@ -0,0 +1,18 @@ +

Follow these steps to get some historical data:

+ +
    +
  1. Create a new project.
  2. +

    The process to creating a new project depends on if you use the Cloud Platform, Local Platform, or CLI.

    + +
  3. In the initializeInitialize method, add an asset.
  4. +
    +
    var spy = AddEquity("SPY");
    +
    spy = self.add_equity('SPY')
    +
    + +
  5. Call the historyHistory method with the asset's Symbol and a lookback period.
  6. +
    +
    var history = History(spy.Symbol, 10, Resolution.Daily);
    +
    history = self.history(spy.symbol, 10, Resolution.DAILY)
    +
    +
\ No newline at end of file diff --git a/08 Drafts/05 Historical Data/01 Getting Started/02 Warm Up Periods.html b/08 Drafts/05 Historical Data/01 Getting Started/02 Warm Up Periods.html new file mode 100644 index 0000000000..97fa6354c8 --- /dev/null +++ b/08 Drafts/05 Historical Data/01 Getting Started/02 Warm Up Periods.html @@ -0,0 +1,12 @@ +

Follow these steps to add a warm-up period to the start of your algorithm:

+ +
    +
  1. Create a new project.
  2. +

    The process to creating a new project depends on if you use the Cloud Platform, Local Platform, or CLI.

    + +
  3. In the initializeInitialize method, call the set_warm_upSetWarmUp method with the warm-up duration.
  4. +
    +
    SetWarmUp(10, Resolution.Daily);
    +
    self.set_warm_up(10, Resolution.DAILY)
    +
    +
\ No newline at end of file diff --git a/08 Drafts/05 Historical Data/01 Getting Started/metadata.json b/08 Drafts/05 Historical Data/01 Getting Started/metadata.json new file mode 100644 index 0000000000..50008c54cb --- /dev/null +++ b/08 Drafts/05 Historical Data/01 Getting Started/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "", + "keywords": "", + "og:description": "", + "og:title": "Getting Started - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Getting Started - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/___________.png" + } +} diff --git a/08 Drafts/05 Historical Data/02 History Requests/01 Introduction.html b/08 Drafts/05 Historical Data/02 History Requests/01 Introduction.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/02 History Requests/02 Flat DataFrames.html b/08 Drafts/05 Historical Data/02 History Requests/02 Flat DataFrames.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/02 History Requests/03 Trailing Time Periods.html b/08 Drafts/05 Historical Data/02 History Requests/03 Trailing Time Periods.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/02 History Requests/04 Trailing Data Samples.html b/08 Drafts/05 Historical Data/02 History Requests/04 Trailing Data Samples.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/02 History Requests/05 Date Ranges.html b/08 Drafts/05 Historical Data/02 History Requests/05 Date Ranges.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/02 History Requests/metadata.json b/08 Drafts/05 Historical Data/02 History Requests/metadata.json new file mode 100644 index 0000000000..4c43ad14a5 --- /dev/null +++ b/08 Drafts/05 Historical Data/02 History Requests/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "You can use a direct historical data request at any time throughout your algorithm. It returns all of the data you request as a single object.", + "keywords": "historical data, trade data, quote data, custom data, live trading", + "og:description": "You can use a direct historical data request at any time throughout your algorithm. It returns all of the data you request as a single object.", + "og:title": "History Requests - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "History Requests - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/history-requests.png" + } +} diff --git a/08 Drafts/05 Historical Data/03 History Responses/01 Introduction.html b/08 Drafts/05 Historical Data/03 History Responses/01 Introduction.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/03 History Responses/02 DataFrames.html b/08 Drafts/05 Historical Data/03 History Responses/02 DataFrames.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/03 History Responses/03 Slices.html b/08 Drafts/05 Historical Data/03 History Responses/03 Slices.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/03 History Responses/04 Lists.html b/08 Drafts/05 Historical Data/03 History Responses/04 Lists.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/03 History Responses/metadata.json b/08 Drafts/05 Historical Data/03 History Responses/metadata.json new file mode 100644 index 0000000000..50008c54cb --- /dev/null +++ b/08 Drafts/05 Historical Data/03 History Responses/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "", + "keywords": "", + "og:description": "", + "og:title": "Getting Started - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Getting Started - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/___________.png" + } +} diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/01 Introduction.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/01 Introduction.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/02 Trades.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/02 Trades.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/03 Quotes.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/03 Quotes.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/04 Ticks.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/04 Ticks.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/05 Slices.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/05 Slices.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/06 Splits.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/06 Splits.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/07 Dividends.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/07 Dividends.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/08 Symbol Changes.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/08 Symbol Changes.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/09 Delistings.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/09 Delistings.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/10 Universes.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/10 Universes.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/11 Alternative Data.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/11 Alternative Data.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/12 Indicators.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/12 Indicators.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/13 Short Availability.php b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/13 Short Availability.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/metadata.json b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/metadata.json new file mode 100644 index 0000000000..50008c54cb --- /dev/null +++ b/08 Drafts/05 Historical Data/04 Asset Classes/01 US Equities/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "", + "keywords": "", + "og:description": "", + "og:title": "Getting Started - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Getting Started - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/___________.png" + } +} diff --git a/08 Drafts/05 Historical Data/05 Alternative Data/01 Introduction.php b/08 Drafts/05 Historical Data/05 Alternative Data/01 Introduction.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/05 Alternative Data/02 Slices.php b/08 Drafts/05 Historical Data/05 Alternative Data/02 Slices.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/05 Alternative Data/03 Data Points.php b/08 Drafts/05 Historical Data/05 Alternative Data/03 Data Points.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/05 Alternative Data/04 Universes.php b/08 Drafts/05 Historical Data/05 Alternative Data/04 Universes.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/05 Alternative Data/metadata.json b/08 Drafts/05 Historical Data/05 Alternative Data/metadata.json new file mode 100644 index 0000000000..50008c54cb --- /dev/null +++ b/08 Drafts/05 Historical Data/05 Alternative Data/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "", + "keywords": "", + "og:description": "", + "og:title": "Getting Started - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Getting Started - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/___________.png" + } +} diff --git a/08 Drafts/05 Historical Data/06 Custom Data/01 Introduction.php b/08 Drafts/05 Historical Data/06 Custom Data/01 Introduction.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/06 Custom Data/02 Slices.php b/08 Drafts/05 Historical Data/06 Custom Data/02 Slices.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/06 Custom Data/03 Data Points.php b/08 Drafts/05 Historical Data/06 Custom Data/03 Data Points.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/06 Custom Data/04 Universes.php b/08 Drafts/05 Historical Data/06 Custom Data/04 Universes.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/08 Drafts/05 Historical Data/06 Custom Data/metadata.json b/08 Drafts/05 Historical Data/06 Custom Data/metadata.json new file mode 100644 index 0000000000..50008c54cb --- /dev/null +++ b/08 Drafts/05 Historical Data/06 Custom Data/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "", + "keywords": "", + "og:description": "", + "og:title": "Getting Started - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Getting Started - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/___________.png" + } +} diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/01 Introduction.php b/08 Drafts/05 Historical Data/07 Warm Up Periods/01 Introduction.php new file mode 100644 index 0000000000..0d19cf12ab --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/01 Introduction.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/02 Set Warm Up Periods.html b/08 Drafts/05 Historical Data/07 Warm Up Periods/02 Set Warm Up Periods.html new file mode 100644 index 0000000000..f1f008a8d9 --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/02 Set Warm Up Periods.html @@ -0,0 +1,70 @@ +

+You can set a warm-up period based on a period of time or a number of bars. To set a warm-up, in your algorithm's Initializeinitialize method, call the SetWarmUpset_warm_up method.

+ +
+
// Wind time back 7 days from start
+SetWarmUp(TimeSpan.FromDays(7));
+
+// Feed in 100 bars before start date
+SetWarmUp(100);
+
+
# Wind time back 7 days from start
+self.set_warm_up(timedelta(7))
+
+# Feed in 100 bars before start date
+self.set_warm_up(100)
+
+
+ +

If you pass a timedeltaTimeSpan argument, the warm-up period consists of that timedeltaTimeSpan before the start date and pipes in data that matches the resolution of your data subscriptions.

+ +

If you pass just an integer argument, LEAN calculates the start of the warm-up period for each of your security subscriptions by using the number of bars you specify, the resolution of each security, and the trading calendar of each security. After it calculates the start time of the warm-up period for each security, it sets the earliest start time as the start of the algorithm warm-up period. For instance, in the following example, the warm-up period consists of 100 minute resolution bars for SPY and as many second resolution bars for BTCUSD that occur from the start of the SPY warm-up period to the algorithm StartDatestart_date.

+ +
+
AddEquity("SPY", Resolution.Minute, fillForward: false);
+AddCrypto("BTCUSD", Resolution.Second, fillForward: false);
+SetWarmUp(100);
+
+
self.add_equity("SPY", Resolution.MINUTE, fill_forward=False)
+self.add_crypto("BTCUSD", Resolution.SECOND, fill_forward=False)
+self.set_warm_up(100)
+
+
+ +

To use a specific resolution of data for the warm-up period, pass a resolution argument to the SetWarmUpset_warm_up method.

+ +
+
// Feed in 100 days of daily data before the start date
+SetWarmUp(TimeSpan.FromDays(100), Resolution.Daily);
+
+// Feed in data for 100 trading days of daily data before the start date
+SetWarmUp(100, Resolution.Daily);
+
# Feed in 100 days of daily data before the start date
+self.set_warm_up(timedelta(days=100), Resolution.DAILY)
+
+# Feed in data for 100 trading days before the start date
+self.set_warm_up(100, Resolution.DAILY)
+
+ +

If you pass a timedeltaTimeSpan and a resolution, the warm-up period consists of the time period and resolution you set, regardless of the resolution of your data subscriptions.

+ +

If you pass an integer and a resolution, the warm-up period consists of the number of bars and resolution you set, regardless of the resolution of your data subscriptions. In this case, LEAN calculates the start of the warm-up period for each of your security subscriptions just like it does when you only pass an integer argument. After it calculates the start time of the warm-up period for each security, it sets the earliest start time as the start of the algorithm warm-up period.

If you pass a resolution argument and you registered indicators or consolidators for automatic updates, the warm-up period resolution must be less than or equal to the lowest resolution of your automatic indicators and consolidators. For instance, in the following example, the indicators use minute resolution data, so you can set the warm-up period to use tick, second, or minute resolution data.

+ +
+
_spy = AddEquity("SPY", Resolution.Minute, fillForward: false).Symbol;
+_btc = AddCrypto("BTCUSD", Resolution.Second, fillForward: false).Symbol;
+
+_spySma = SMA(_spy, 10);
+_btcSMA = SMA(_btc, 10, Resolution.Minute);
+
+SetWarmUp(100, Resolution.Minute);
+
+
self._spy = self.add_equity("SPY", Resolution.MINUTE, fill_forward=False).symbol
+self._btc = self.add_crypto("BTCUSD", Resolution.SECOND, fill_forward=False).symbol
+
+self._spy_sma = self.sma(self._spy, 10)
+self._btc_sma = self.sma(self._btc, 10, Resolution.MINUTE)
+
+self.set_warm_up(100, Resolution.MINUTE)
+
+
diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/03 Warm Up Vs Reality.html b/08 Drafts/05 Historical Data/07 Warm Up Periods/03 Warm Up Vs Reality.html new file mode 100644 index 0000000000..9165876aa8 --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/03 Warm Up Vs Reality.html @@ -0,0 +1,19 @@ +

You may need to distinguish warm-up data from real data. To check if the algorithm is currently in a warm up period, use the IsWarmingUpis_warming_up property.

+
+
// In Initialize
+var emaFast = EMA("IBM", 50);
+var emaSlow = EMA("IBM", 100);
+SetWarmup(100);
+
+// In OnData: Don't run if the indicators aren't ready
+if (IsWarmingUp) return;
+
+
# In Initialize
+self._ema_fast = self.ema("IBM", 50);
+self._ema_slow = self.ema("IBM", 100);
+self.set_warmup(100);
+
+// In OnData: Don't run if the indicators aren't ready
+if self.is_warming_up: return
+
+
diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/04 Event Handler.html b/08 Drafts/05 Historical Data/07 Warm Up Periods/04 Event Handler.html new file mode 100644 index 0000000000..9643028114 --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/04 Event Handler.html @@ -0,0 +1,11 @@ + +

The OnWarmupFinishedon_warmup_finished event handler executes when the warm up period ends, even if you don't set a warm up period.

+
+
public override void OnWarmupFinished()
+{
+    // Done warming up
+}
+
+
def on_warmup_finished(self) -> None:
+    pass # Done warming up
+
\ No newline at end of file diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/05 Limitations.html b/08 Drafts/05 Historical Data/07 Warm Up Periods/05 Limitations.html new file mode 100644 index 0000000000..eccf72d9d1 --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/05 Limitations.html @@ -0,0 +1 @@ +

You can't place trades during the warm-up period because they would be operating on fictional fast-forwarded data.

\ No newline at end of file diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/99 Examples.html b/08 Drafts/05 Historical Data/07 Warm Up Periods/99 Examples.html new file mode 100644 index 0000000000..62169a494d --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/99 Examples.html @@ -0,0 +1,11 @@ +
+
Demonstration Algorithms
+ + + WarmupAlgorithm.py Python + + + + WarmupAlgorithm.cs C# + +
diff --git a/08 Drafts/05 Historical Data/07 Warm Up Periods/metadata.json b/08 Drafts/05 Historical Data/07 Warm Up Periods/metadata.json new file mode 100644 index 0000000000..4235bc6090 --- /dev/null +++ b/08 Drafts/05 Historical Data/07 Warm Up Periods/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "LEAN supports an automated fast-forward system called \"Warm Up\". It simulates winding back the clock from the time you deploy the algorithm.", + "keywords": "historical data, warm up, algorithmic trading", + "og:description": "LEAN supports an automated fast-forward system called \"Warm Up\". It simulates winding back the clock from the time you deploy the algorithm.", + "og:title": "Warm Up Periods - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Warm Up Periods - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/warm-up-periods.png" + } +} diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/01 Introduction.php b/08 Drafts/05 Historical Data/08 Rolling Window/01 Introduction.php new file mode 100644 index 0000000000..47f45efbe2 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/01 Introduction.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/02 Supported Types.php b/08 Drafts/05 Historical Data/08 Rolling Window/02 Supported Types.php new file mode 100644 index 0000000000..56e5ed6527 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/02 Supported Types.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/03 Add Data.php b/08 Drafts/05 Historical Data/08 Rolling Window/03 Add Data.php new file mode 100644 index 0000000000..7757b719df --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/03 Add Data.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/04 Warm Up.php b/08 Drafts/05 Historical Data/08 Rolling Window/04 Warm Up.php new file mode 100644 index 0000000000..eca0e33023 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/04 Warm Up.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/05 Check Readiness.php b/08 Drafts/05 Historical Data/08 Rolling Window/05 Check Readiness.php new file mode 100644 index 0000000000..a1009dff68 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/05 Check Readiness.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/06 Adjust Size.php b/08 Drafts/05 Historical Data/08 Rolling Window/06 Adjust Size.php new file mode 100644 index 0000000000..f3a7c60076 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/06 Adjust Size.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/07 Access Data.php b/08 Drafts/05 Historical Data/08 Rolling Window/07 Access Data.php new file mode 100644 index 0000000000..239cb7c116 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/07 Access Data.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/08 Combine with Indicators.php b/08 Drafts/05 Historical Data/08 Rolling Window/08 Combine with Indicators.php new file mode 100644 index 0000000000..4e17ff885c --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/08 Combine with Indicators.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/09 Combine with Consolidators.php b/08 Drafts/05 Historical Data/08 Rolling Window/09 Combine with Consolidators.php new file mode 100644 index 0000000000..78da95693d --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/09 Combine with Consolidators.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/10 Cast to Other Types.php b/08 Drafts/05 Historical Data/08 Rolling Window/10 Cast to Other Types.php new file mode 100644 index 0000000000..885cd90953 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/10 Cast to Other Types.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/11 Delete Data.php b/08 Drafts/05 Historical Data/08 Rolling Window/11 Delete Data.php new file mode 100644 index 0000000000..c0bcb62860 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/11 Delete Data.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/12 Examples.php b/08 Drafts/05 Historical Data/08 Rolling Window/12 Examples.php new file mode 100644 index 0000000000..fac02b1ae1 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/12 Examples.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/08 Drafts/05 Historical Data/08 Rolling Window/metadata.json b/08 Drafts/05 Historical Data/08 Rolling Window/metadata.json new file mode 100644 index 0000000000..0e4e6a6327 --- /dev/null +++ b/08 Drafts/05 Historical Data/08 Rolling Window/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "A RollingWindow is an array of a fixed-size that holds trailing data. It's more efficient to store data than to make many historical data requests.", + "keywords": "historical data, rolling window, trailing data, indicators, consolidators", + "og:description": "A RollingWindow is an array of a fixed-size that holds trailing data. It's more efficient to store data than to make many historical data requests.", + "og:title": "Rolling Window - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Rolling Window - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/historical-data/rolling-window.png" + } +} diff --git a/08 Drafts/05 Historical Data/09 Common Errors/01 Introduction.html b/08 Drafts/05 Historical Data/09 Common Errors/01 Introduction.html new file mode 100644 index 0000000000..9b3494f524 --- /dev/null +++ b/08 Drafts/05 Historical Data/09 Common Errors/01 Introduction.html @@ -0,0 +1,7 @@ +add Live Trading +Other data providers +Trading disabled in warm-up + Limitations of quantconnect provider +Limitations of brokerages +E.g. IB is slow and leads to timeout if we request or warm up too many symbols (e.g. options) +Indicator readiness.