diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/01 Requesting Data/11 Data Normalization.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/01 Requesting Data/11 Data Normalization.php index ff0be7bd4f..f442915f01 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/01 Requesting Data/11 Data Normalization.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/01 Requesting Data/11 Data Normalization.php @@ -4,7 +4,7 @@ -

To set the data normalization mode for a security, pass a dataNormalizationMode argument to the AddEquityadd_equity method.

+

To set the data normalization mode for a security, pass a dataNormalizationModedata_normalization_mode argument to the AddEquityadd_equity method.

_symbol = AddEquity("SPY", dataNormalizationMode: DataNormalizationMode.Raw).Symbol;
diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/03 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/03 Trades.php index 189ac2a321..b042aa583f 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/03 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/03 Trades.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/04 Quotes.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/04 Quotes.php index 93b3dab182..666557a64e 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/04 Quotes.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/04 Quotes.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/05 Ticks.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/05 Ticks.php index b10d5d3f84..a806ba1574 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/05 Ticks.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/02 Handling Data/05 Ticks.php @@ -1,8 +1,8 @@ - -

If we detect a tick that may be suspicious, we set its Suspicious flag to true.

+

If we detect a tick that may be suspicious, we set its Suspicioussuspicious flag to true.

diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/01 Requesting Data/09 Data Normalization.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/01 Requesting Data/09 Data Normalization.php index 59572585ba..a036c98d3d 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/01 Requesting Data/09 Data Normalization.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/01 Requesting Data/09 Data Normalization.php @@ -4,7 +4,7 @@ -

To set the data normalization mode for a security, pass a dataNormalizationMode argument to the AddEquityadd_equity method..

+

To set the data normalization mode for a security, pass a dataNormalizationModedata_normalization_mode argument to the AddEquityadd_equity method..

_symbol = AddEquity("YESBANK", market: Market.India, dataNormalizationMode: DataNormalizationMode.Raw).Symbol;
diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/02 Handling Data/02 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/02 Handling Data/02 Trades.php index 463b186243..bb4d771a89 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/02 Handling Data/02 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/02 India Equity/02 Handling Data/02 Trades.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/03 Equity Options/02 Handling Data/02 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/03 Equity Options/02 Handling Data/02 Trades.php index 7773ac7281..fcc18f8cfd 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/03 Equity Options/02 Handling Data/02 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/03 Equity Options/02 Handling Data/02 Trades.php @@ -1,4 +1,4 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/04 Quotes.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/04 Quotes.php index 93b3dab182..2e33e917e5 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/04 Quotes.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/04 Quotes.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/05 Ticks.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/05 Ticks.php index 0595f8a481..fdc6307f66 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/05 Ticks.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/04 Crypto/02 Handling Data/05 Ticks.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/03 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/03 Trades.php index 463b186243..bb4d771a89 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/03 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/03 Trades.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/04 Quotes.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/04 Quotes.php index 93b3dab182..2e33e917e5 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/04 Quotes.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/04 Quotes.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/05 Ticks.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/05 Ticks.php index 0595f8a481..fdc6307f66 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/05 Ticks.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/05 Crypto Futures/02 Handling Data/05 Ticks.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/02 Quotes.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/02 Quotes.php index 61f87f4a81..e09a71be8a 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/02 Quotes.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/02 Quotes.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/03 Ticks.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/03 Ticks.php index a19ed9e28b..12eca6b287 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/03 Ticks.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/06 Forex/02 Handling Data/03 Ticks.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/07 Futures/02 Handling Data/02 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/07 Futures/02 Handling Data/02 Trades.php index 7773ac7281..fcc18f8cfd 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/07 Futures/02 Handling Data/02 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/07 Futures/02 Handling Data/02 Trades.php @@ -1,4 +1,4 @@ -Tick objects represent a price for the Index at a moment in time. Tick objects have the following properties:

-

Index ticks have a non-zero value for the Price property, but they have a zero value for the BidPrice, BidSize, AskPrice, and AskSize properties.

+

Index ticks have a non-zero value for the Priceprice property, but they have a zero value for the BidPricebid_price, BidSizebid_size, AskPriceask_price, and AskSizeask_size properties.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice, index the Ticks property of the Slice with a Symbol. The Slice may not contain data for your Symbol at every time step. To avoid issues, check if the Slice contains data for your Index before you index the Slice with the Index Symbol.

diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/10 Index Options/02 Handling Data/02 Trades.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/10 Index Options/02 Handling Data/02 Trades.php index 7773ac7281..fcc18f8cfd 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/10 Index Options/02 Handling Data/02 Trades.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/10 Index Options/02 Handling Data/02 Trades.php @@ -1,4 +1,4 @@ - diff --git a/03 Writing Algorithms/03 Securities/99 Asset Classes/11 CFD/02 Handling Data/03 Ticks.php b/03 Writing Algorithms/03 Securities/99 Asset Classes/11 CFD/02 Handling Data/03 Ticks.php index 13e61e050a..97d2c8c6a4 100644 --- a/03 Writing Algorithms/03 Securities/99 Asset Classes/11 CFD/02 Handling Data/03 Ticks.php +++ b/03 Writing Algorithms/03 Securities/99 Asset Classes/11 CFD/02 Handling Data/03 Ticks.php @@ -1,6 +1,6 @@ - diff --git a/03 Writing Algorithms/12 Universes/02 Settings/07 Data Normalization Mode.php b/03 Writing Algorithms/12 Universes/02 Settings/07 Data Normalization Mode.php index ea804b2433..34b98b05fd 100644 --- a/03 Writing Algorithms/12 Universes/02 Settings/07 Data Normalization Mode.php +++ b/03 Writing Algorithms/12 Universes/02 Settings/07 Data Normalization Mode.php @@ -12,7 +12,7 @@

Futures

-

In the case of Futures, the data normalization mode affects how historical data of two contracts is stitched together to form the continuous contract. To view all the available options, see Data Normalization. The default value is DataNormalizationMode.Adjusted. To change the data normalization mode, in the Initialize method, pass a dataNormalizationMode argument to the AddFutureadd_future method.

+

In the case of Futures, the data normalization mode affects how historical data of two contracts is stitched together to form the continuous contract. To view all the available options, see Data Normalization. The default value is DataNormalizationMode.Adjusted. To change the data normalization mode, in the Initialize method, pass a dataNormalizationModedata_normalization_mode argument to the AddFutureadd_future method.

AddFuture(Futures.Currencies.BTC, dataNormalizationMode: DataNormalizationMode.BackwardsRatio);
diff --git a/03 Writing Algorithms/12 Universes/04 Equity Options/02 Create Universes.php b/03 Writing Algorithms/12 Universes/04 Equity Options/02 Create Universes.php index c41859c7f9..ca0c53b7a1 100644 --- a/03 Writing Algorithms/12 Universes/04 Equity Options/02 Create Universes.php +++ b/03 Writing Algorithms/12 Universes/04 Equity Options/02 Create Universes.php @@ -89,7 +89,7 @@ -

If you already have a subscription to the underlying Equity but it's not Raw data normalization, LEAN automatically changes it to Raw.

+

If you already have a subscription to the underlying Equity but it's not RawRAW data normalization, LEAN automatically changes it to RawRAW.

To override the default pricing model of the Option, set a pricing model.

diff --git a/03 Writing Algorithms/12 Universes/06 Futures/11 Create Universes.html b/03 Writing Algorithms/12 Universes/06 Futures/11 Create Universes.html index 3f9e7228a1..8cd78eae74 100644 --- a/03 Writing Algorithms/12 Universes/06 Futures/11 Create Universes.html +++ b/03 Writing Algorithms/12 Universes/06 Futures/11 Create Universes.html @@ -63,7 +63,7 @@

Argument: dataMappingMode

-

Argument: dataNormalizationMode

+

Argument: dataNormalizationModedata_normalization_mode

The price scaling mode to use for the continuous future contract

Data Type: DataNormalizationMode?DataNormalizationMode/NoneType | Default Value: Nonenull

diff --git a/03 Writing Algorithms/12 Universes/06 Futures/12 Continous Contracts.php b/03 Writing Algorithms/12 Universes/06 Futures/12 Continous Contracts.php index d3215ee246..a5f12421db 100644 --- a/03 Writing Algorithms/12 Universes/06 Futures/12 Continous Contracts.php +++ b/03 Writing Algorithms/12 Universes/06 Futures/12 Continous Contracts.php @@ -14,7 +14,7 @@
-

To configure how LEAN identifies the current Future contract in the continuous series and how it forms the adjusted price between each contract, provide dataMappingMode, dataNormalizationMode, and contractDepthOffset arguments to the AddFutureadd_future method. The Future object that the AddFutureadd_future method returns contains a Mapped property that references the current contract in the continuous contract series. As the contracts roll over, the Mapped property references the next contract in the series and you receive a SymbolChangedEvent object in the OnDataon_data method. The SymbolChangedEvent references the old contract Symbol and the new contract Symbol. You can use SymbolChangedEvents to roll over contracts.

+

To configure how LEAN identifies the current Future contract in the continuous series and how it forms the adjusted price between each contract, provide dataMappingMode, dataNormalizationModedata_normalization_mode, and contractDepthOffset arguments to the AddFutureadd_future method. The Future object that the AddFutureadd_future method returns contains a Mapped property that references the current contract in the continuous contract series. As the contracts roll over, the Mapped property references the next contract in the series and you receive a SymbolChangedEvent object in the OnDataon_data method. The SymbolChangedEvent references the old contract Symbol and the new contract Symbol. You can use SymbolChangedEvents to roll over contracts.

public override void OnData(Slice slice)
@@ -47,7 +47,7 @@
 

In backtesting, the SymbolChangedEvent occurs at midnight Eastern Time (ET). In live trading, the live data for continuous contract mapping arrives at 6/7 AM ET, so that's when it occurs.

Data Normalization Modes

-

The dataNormalizationMode argument defines how the price series of two contracts are stitched together when the contract rollovers occur. The following DataNormalizatoinMode enumeration members are available for continuous contracts:

+

The dataNormalizationModedata_normalization_mode argument defines how the price series of two contracts are stitched together when the contract rollovers occur. The following DataNormalizatoinMode enumeration members are available for continuous contracts:

We use the entire Futures history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

diff --git a/03 Writing Algorithms/28 Indicators/02 Key Concepts/10 Reset Indicators.html b/03 Writing Algorithms/28 Indicators/02 Key Concepts/10 Reset Indicators.html index 66fbbfdd1f..347b0cae96 100644 --- a/03 Writing Algorithms/28 Indicators/02 Key Concepts/10 Reset Indicators.html +++ b/03 Writing Algorithms/28 Indicators/02 Key Concepts/10 Reset Indicators.html @@ -11,7 +11,7 @@ If you are live trading Equities or backtesting Equities without the adjusted data normalization mode, reset your indicators when splits and dividends occur. If a split or dividend occurs, the data in your indicators becomes invalid because it doesn't account for the price adjustments that the split or dividend causes. - To replace your indicator history with the newly-adjusted prices, call the Reset method and then warm up the indicator with ScaledRaw data from a history request. + To replace your indicator history with the newly-adjusted prices, call the Reset method and then warm up the indicator with ScaledRawSCALED_RAW data from a history request.

diff --git a/03 Writing Algorithms/34 Algorithm Framework/03 Alpha/01 Key Concepts/06 Insights.html b/03 Writing Algorithms/34 Algorithm Framework/03 Alpha/01 Key Concepts/06 Insights.html index fbc9cd5002..f27cfebf49 100644 --- a/03 Writing Algorithms/34 Algorithm Framework/03 Alpha/01 Key Concepts/06 Insights.html +++ b/03 Writing Algorithms/34 Algorithm Framework/03 Alpha/01 Key Concepts/06 Insights.html @@ -33,7 +33,7 @@

Create Insights

var insight = Insight.Price("IBM", Resolution.Minute, 20, InsightDirection.Up);
-

In the Price method, the period argument can be a timedeltaTimeSpan object, a DateTimedatetime object, or a function that receives a DateTimedatetime object and returns the expiry DateTimedatetime.

+

In the Priceprice method, the period argument can be a timedeltaTimeSpan object, a DateTimedatetime object, or a function that receives a DateTimedatetime object and returns the expiry DateTimedatetime.

Group Insights

Sometimes an algorithm's performance relies on multiple insights being traded together, like in pairs trading and options straddles. These types insights should be grouped. Insight groups signal to the Execution model that the insights need to be acted on as a single unit to maximize the alpha created.

diff --git a/04 Research Environment/03 Datasets/04 US Equity/07 Data Normalization.php b/04 Research Environment/03 Datasets/04 US Equity/07 Data Normalization.php index 106d5e5359..03642d7038 100644 --- a/04 Research Environment/03 Datasets/04 US Equity/07 Data Normalization.php +++ b/04 Research Environment/03 Datasets/04 US Equity/07 Data Normalization.php @@ -5,7 +5,7 @@ include(DOCS_RESOURCES."/securities/data-normalization.php"); ?> -

When you request historical data, the Historyhistory method uses the data normalization of your security subscription. To get historical data with a different data normalization, pass a dataNormalizationMode argument to the Historyhistory method.

+

When you request historical data, the Historyhistory method uses the data normalization of your security subscription. To get historical data with a different data normalization, pass a dataNormalizationModedata_normalization_mode argument to the Historyhistory method.

var history = qb.History(qb.Securities.Keys, qb.Time-TimeSpan.FromDays(10), qb.Time, dataNormalizationMode: DataNormalizationMode.SplitAdjusted);
history = qb.history(qb.securities.keys, qb.time-timedelta(days=10), qb.time, dataNormalizationMode=DataNormalizationMode.SPLIT_ADJUSTED)
diff --git a/04 Research Environment/03 Datasets/12 Futures/03 Create Subscriptions.php b/04 Research Environment/03 Datasets/12 Futures/03 Create Subscriptions.php index f11d4c6685..3b4e31e078 100644 --- a/04 Research Environment/03 Datasets/12 Futures/03 Create Subscriptions.php +++ b/04 Research Environment/03 Datasets/12 Futures/03 Create Subscriptions.php @@ -37,7 +37,7 @@ Resolution.MinuteResolution.MINUTE - dataNormalizationMode + dataNormalizationModedata_normalization_mode DataNormalizationMode.Adjusted diff --git a/07 Meta/01 Change Log/02 Documentation Updates.html b/07 Meta/01 Change Log/02 Documentation Updates.html index 979f040656..7c5e023a0d 100644 --- a/07 Meta/01 Change Log/02 Documentation Updates.html +++ b/07 Meta/01 Change Log/02 Documentation Updates.html @@ -791,7 +791,7 @@

2023-10-09

2023-10-06

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

\ No newline at end of file diff --git a/Resources/securities/tradebar.php b/Resources/securities/tradebar.php index e334db04ae..afe630898b 100644 --- a/Resources/securities/tradebar.php +++ b/Resources/securities/tradebar.php @@ -2,7 +2,7 @@ Tradebar decomposition

TradeBar objects have the following properties:

-

To get the TradeBar objects in the Slice, index the Slice or index the Barsbars property of the Slice with the Symbol. If the doesn't actively trade or you are in the same time step as when you added the subscription, the Slice may not contain data for your Symbol. To avoid issues, check if the Slice contains data for your before you index the Slice with the Symbol.

+

To get the TradeBar objects in the Slice, index the Slice or index the Barsbars property of the Slice with the Symbolsymbol. If the doesn't actively trade or you are in the same time step as when you added the subscription, the Slice may not contain data for your Symbolsymbol. To avoid issues, check if the Slice contains data for your before you index the Slice with the Symbolsymbol.

public override void OnData(Slice slice)
@@ -13,9 +13,8 @@
     }
 }
 
-
def OnData(self, slice: Slice) -> None:
-    if  in slice.Bars:
-        trade_bar = slice.Bars[]
+
def on_data(self, slice: Slice) -> None:
+    trade_bar = slice.bars.get()   # None if not found
@@ -31,6 +30,6 @@ } }
def OnData(self, slice: Slice) -> None:
-    for symbol, trade_bar in slice.Bars.items():
-        close_price = trade_bar.Close
+ for symbol, trade_bar in slice.bars.items(): + close_price = trade_bar.close
\ No newline at end of file diff --git a/code-generators/enum-table-generator.py b/code-generators/enum-table-generator.py index 826cb4610c..779e35e83c 100644 --- a/code-generators/enum-table-generator.py +++ b/code-generators/enum-table-generator.py @@ -186,9 +186,8 @@ def HtmlGeneration(obj_name, sorted_obj, extra=''): items = [y[0] for y in market if y[1] == x] items = [y[0] for y in market_data if y[0].lower() in items] items = [y for y in items if y.lower() not in ["ftx", "ftxus", "fxcm", "gdax"]] - + items = set(items + [x for x in items]) with open(f"{destination}/market-{x}.html", "w", encoding="utf-8") as file: x = "Futures" if x == "future" else x file.write(f"""

The following Market enumeration members are available for {x.title().replace("Option", "Options").replace("option", " Options").replace("Index", "Indices").replace("Indices Options", "Index Options")}:

-
""") \ No newline at end of file