---
title: "Key Concepts"
description: "A security is an individual financial asset that you might trade on an exchange. LEAN models these unique assets with a Security object."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/key-concepts
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/key-concepts.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/03%20Securities/01%20Key%20Concepts
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# Key Concepts

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Securities > Key Concepts

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

## Introduction

A security is an individual financial asset that you can trade on an exchange. LEAN models these unique assets with a `Security` object, which the `add_equity`, `add_crypto`, and similar methods return. The `securities` property of the `QCAlgorithm` class is a dictionary where the keys are `Symbol` objects and the values are `Security` objects. The `securities` dictionary contains all of the securities that have been in the algorithm during its lifetime.

```python
# Add the SPY.
self._symbol = self.add_equity("SPY").symbol
```

## Price

To get the current price of a security, index the `securities` dictionary and then access the `price` member.

```python
# Get the price of the security.
price = self.securities[self._symbol].price
```

## Holdings

The `Holdings` property of a `Security` object contains information about the [investment state and history](https://www.quantconnect.com/docs/v2/writing-algorithms/portfolio/key-concepts.md) of the security.

```python
# Use the holdings object to get information on the asset position, such as the quantity and average price.
holdings = self.securities[self._symbol].holdings
quantity = holdings.quantity
```

Alternatively, you can get the current holdings of a security with the `portfolio` dictionary.

```python
# Get the quantity of a security you hold through the portfolio dictionary.
holdings = self.portfolio[self._symbol]
quantity = holdings.quantity
```

## Reality Models

`Security` objects contain references to the [security level reality models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/key-concepts.md). To customize the behavior of each security, configure its reality models.

## Tradable Status

The `is_tradable` property shows whether you can trade a security. The property value is true when the security is in the universe, even if the data starts at a later day. Indices, canonical Option securities, and continuous Futures contracts are not tradable. In live mode, [custom data objects](https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/streaming-data/key-concepts.md) are also not tradable, even if the custom data represents a tradable asset.

```python
# Check if the security is tradable.
tradable = self.securities[self._symbol].is_tradable
```

## Symbol Properties

The `symbol_properties` property of a `Security` contains properties for that specific security, such as the lot size and the minimum price variation.

```python
# Round orders to a brokerage's lot size and minimum price variation using the symbol_properties.
symbol_properties = self.securities[self._symbol].symbol_properties
lot_size = symbol_properties.lot_size
minimum_price_variation = symbol_properties.minimum_price_variation
```

## Market Hours

The `exchange` property of a `Security` contains information about the exchange that lists the security. For example, the `exchange.hours` property contains information on the [trading days and hours](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/market-hours.md).

```python
# Using the exchange object, check if the exchange's regular trading hours are open at the given time.
exchange = self.securities[self._symbol].exchange
hours = exchange.hours
is_open_now = hours.is_open(self.time, extended_market_hours=False)
```

## Custom Security Properties

You can add attributes to the `Security` object. For example, you can add an [exponential moving average](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/supported-indicators/exponential-moving-average.md).

```python
# Add an EMA indicator to the SPY Equity object.
equity = self.add_equity("SPY")
equity.ema = self.ema(equity.symbol, 10, Resolution.DAILY)
```

This feature is helpful because you can get the `Security` object from the `securities` object.

```python
# Get the SPY Equity object from the securities object to get the EMA indicator.
ema = self.securities["SPY"].ema.current.value
```

## Properties

The `Security` type has the following properties:

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

## Examples

The following examples demonstrate some common practices for securities.

### Example 1: Accessing Properties

The following example shows how to access various propeties of the `Security` object.

```python
class SecuritiesUsageAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)

        self.spy = self.add_equity("SPY")

    def on_data(self, slice: Slice) -> None:
        # OHLCV data.
        price = self.spy.close
        volume = self.spy.volume
        # Quote data.
        quote_size = self.spy.bid_size
        quote_price = self.spy.ask_price
        # Symbol Properties.
        lot_size = self.spy.symbol_properties.lot_size
        # Fundamentals cached data.
        pe_ratio = self.spy.fundamentals.valuation_ratios.pe_ratio
        # Properties, e.g. is tradeble, is market open, leverage, ...
        market_open = Extensions.is_market_open(self.spy, extended_market_hours=False)
        leverage = self.spy.leverage
        # Models, e.g. margin model, buying power model, ...
        margin_model = self.spy.margin_model
        # Portfolio Holdings reference.
        holding = self.spy.holdings
```
