India Equity

Requesting Data

Introduction

Request India Equity data in your algorithm to receive a feed of asset prices in the OnDataon_data method. Historical data for backtesting is unavailable. To trade India Equities live, you can use one of the brokerage data providers.

Create Subscriptions

To create an India Equity subscription, in the Initializeinitialize method, call the AddEquityadd_equity method. The AddEquityadd_equity method returns an Equity object, which contains a Symbolsymbol property. Save a reference to the Symbolsymbol so you can use it in OnDataon_data to access the security data in the Slice.

_symbol = AddEquity("YESBANK", market: Market.India).Symbol;
self._symbol = self.add_equity("YESBANK", market=Market.INDIA).symbol

If you set the brokerage model to an India brokerage, you don't need to pass a market argument. To view the integrated brokerages that offer India Equities, see Brokerages.

Resolutions

The following table shows the available resolutions and data formats for India Equity subscriptions:

ResolutionTradeBarQuoteBarTrade TickQuote Tick
TickTICK

SecondSECOND

MinuteMINUTEgreen check
HourHOURgreen check
DailyDAILYgreen check

The default resolution for India Equity subscriptions is Resolution.MinuteResolution.MINUTE. To change the resolution, pass a resolution argument to the AddEquityadd_equity method.

_symbol = AddEquity("YESBANK", Resolution.Daily, Market.India).Symbol;
self._symbol = self.add_equity("YESBANK", Resolution.DAILY, Market.INDIA).symbol

To create custom resolution periods, see Consolidating Data.

Supported Markets

LEAN groups all of the India Equity exchanges under Market.IndiaMarket.INDIA. To set the market for a security, pass a market argument to the AddEquityadd_equity method.

_symbol = AddEquity("YESBANK", market: Market.India).Symbol;
self._symbol = self.add_equity("YESBANK", market=Market.INDIA).symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice, LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForwardfill_forward argument to false when you create the security subscription.

_symbol = AddEquity("YESBANK", market: Market.India, fillForward: false).Symbol;
self._symbol = self.add_equity("YESBANK", market=Market.INDIA, fill_forward=False).symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The amount of margin that's available depends on the brokerage model you use. For more information about the margin requirements of each brokerage, see the Margin section of the brokerage guides. To change the amount of leverage you can use for a security, pass a leverage argument to the AddEquityadd_equity method.

_symbol = AddEquity("YESBANK", market: Market.India, leverage: 3).Symbol;
self._symbol = self.add_equity("YESBANK", market=Market.INDIA, leverage=3).symbol

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHoursextended_market_hours argument when you create the security subscription.

_symbol = AddEquity("YESBANK", market: Market.India, extendedMarketHours: true).Symbol;
self._symbol = self.add_equity("YESBANK", market=Market.India, extended_market_hours=True).Symbol

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours.

Data Normalization

The data normalization mode defines how historical data is adjusted for corporate actions. The data normalization mode affects the data that LEAN passes to OnDataon_data and the data from history request. By default, LEAN adjusts India Equity data for splits and dividends to produce a smooth price curve, but the following data normalization modes are available:

If you use AdjustedADJUSTED, SplitAdjustedSPLIT_ADJUSTED, or TotalReturnTOTAL_RETURN, we use the entire split and dividend history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

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;
self._symbol = add_equity("YESBANK", market=Market.INDIA, data_normalization_mode=DataNormalizationMode.RAW).symbol

The ScaledRawSCALED_RAW data normalization is only for history requests. When you use ScaledRawSCALED_RAW, we use the split and dividend history before the algorithm's current time to adjust historical prices. The ScaledRawSCALED_RAW data normalization model enables you to warm up indicators with adjusted data when you subscribe to RawRAW security data.

Properties

The AddEquityadd_equity method returns an Equity object, which have the following properties:

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: