---
title: "Handling Data"
description: "LEAN passes the data you request to the OnData method so you can make trading decisions. The Slice object groups the data together with a timestamp."
canonical: https://www.quantconnect.com/docs/v2/drafts/india-equity/handling-data
markdown: https://www.quantconnect.com/docs/v2/drafts/india-equity/handling-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/08%20Drafts/99%20India%20Equity/02%20Handling%20Data
modified: 2026-10-31
index: https://www.quantconnect.com/llms.txt
---

# Handling Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > Drafts > [India Equity](https://www.quantconnect.com/docs/v2/drafts/india-equity.md) > Handling Data

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

LEAN passes the data you request to the `on_data` method so you can make trading decisions. The `Slice` object that the `on_data` method receives groups all the data together at a single moment in time. To access the `Slice` outside of the `on_data` method, use the `current_slice` property of your algorithm.

All the data formats use `DataDictionary` objects to group data by `Symbol` and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the `TradeBars` `DataDictionary` is made up of `TradeBar` objects. To access individual data points in the dictionary, you can index the dictionary with the security ticker or `symbol`, but we recommend you use the `symbol`.

To view the resolutions that are available for India Equity data, see [Resolutions](https://www.quantconnect.com/docs/v2/drafts/india-equity/requesting-data.md#03-Resolutions).

## Trades

`TradeBar` objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

![Tradebar decomposition](https://cdn.quantconnect.com/docs/i/dataformat-tradebar.png)

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

```python
def on_data(self, slice: Slice) -> None:
    # Obtain the mapped TradeBar of the symbol if any
    trade_bar = slice.bars.get(self._symbol)   # None if not found
```

You can also iterate through the `TradeBars` dictionary. The keys of the dictionary are the `Symbol` objects and the values are the `TradeBar` objects.

```python
def on_data(self, slice: Slice) -> None:
    # Iterate all received Symbol-TradeBar key-value pairs
    for symbol, trade_bar in slice.bars.items():
        close_price = trade_bar.close
```

`TradeBar` objects have the following properties:

*Members of `QuantConnect.Data.Market.TradeBar` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Data.Market.TradeBar&language=python*
