---
title: "Key Concepts"
description: "LEAN has many methods to create, update, and cancel orders. You can fetch, update, and cancel manual orders with order tickets."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/key-concepts
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/key-concepts.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/22%20Trading%20and%20Orders/01%20Key%20Concepts
modified: 2026-10-29
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) > Trading and Orders > Key Concepts

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

## Introduction

LEAN has dozens of methods to create, update, and cancel orders. You can place orders automatically with [helper methods](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/position-sizing.md) or manually through methods on the algorithm API. You can fetch, update, and cancel manual orders with [order tickets](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md). As the state of your orders change, LEAN creates [events](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-events.md) that notify your algorithm.

In backtesting, LEAN simulates order fills with historical data, but you can create your own fill, fee, slippage, and margin models via plugin points. You control how optimistic or pessimistic order fills are with transaction model classes. For more information about these types of models, see [Reality Modeling](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/key-concepts.md).

## Orders and Tickets

When you call one of the order methods to place an order, LEAN performs [pre-order checks](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/pre-trade-risk-control.md) to ensure that the order meets some requirements and uses the last known price to check you have [enough capital](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/buying-power.md). To see the requirements of each order, see the **Requirements** section of [the documentation for the order types](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/key-concepts.md#03-Order-Types) and the **Orders** section of your [brokerage model](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models.md). If you can place the order, LEAN creates `Order` and [OrderTicket](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md) objects. The order ticket is sent to your brokerage. As the brokerage processes your order, it returns another order ticket and it's compared against the order to see if the order is satisfied. Orders fill asynchronously in live trading, so if you want to change an order, you must request it with the order ticket. Order changes are not guaranteed since your order may fill by the time brokerage receives the request.

![Flow of ordering and filling between algorithm and brokerage](https://cdn.quantconnect.com/i/tu/orders-and-tickets2.webp)

## Order Types

LEAN supports the following order types:

- [Market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-orders.md)
- [Limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-orders.md)
- [Limit if touched](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-if-touched-orders.md)
- [Stop market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-market-orders.md)
- [Stop limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-limit-orders.md)
- [Trailing stop](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/trailing-stop-orders.md)
- [Market on open](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-open-orders.md)
- [Market on close](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-close-orders.md)
- [Combo market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-market-orders.md)
- [Combo limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-limit-orders.md)
- [Combo leg limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-leg-limit-orders.md)
- [Contingent](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/contingent-orders.md)
- [Option exercise](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/option-exercise-orders.md)

## Symbol Properties

The `symbol_properties` are a property of the `Security` object. LEAN uses some of the `symbol_properties` to prevent invalid orders, and to [calculate order quantities](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/position-sizing.md) for a given target.

`SymbolProperties` objects have the following properties:

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

To get the `symbol_properties`, use the property on the `Security` object.

```python
symbol_properties = self.securities["BTCUSD"].symbol_properties
lot_size = symbol_properties.lot_size
minimum_order_size = symbol_properties.minimum_order_size
minimum_price_variation = symbol_properties.minimum_price_variation
```

LEAN uses the `minimum_price_variation` to round the `limit_price`, `stop_price`, and the `trigger_price`.

## Quote Currency

The quote currency is the currency you must give the seller to buy an asset. For currency trades, the quote currency is the currency ticker on the right side of the currency pair. For other types of assets, the quote currency is usually USD, but the quote currency for India Equities is INR. To get the quote currency of a `Security`, use the `quote_currency` property.

```python
aapl_quote_currency = self.securities["AAPL"].quote_currency # USD
btcusdt_quote_currency = self.securities["BTCUSDT"].quote_currency # USDT
```

The `quote_currency` is a `Cash` object, which have the following properties:

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

You can use the `conversion_rate` property to calculate the value of the minimum price movement in the account currency

```python
cfd = self.securities["SG30SGD"]
quote_currency = cfd.quote_currency # SGD
contract_mutiplier = cfd.symbol_properties.contract_multiplier
minimum_price_variation = cfd.symbol_properties.minimum_price_variation

# Value of a pip in account currency
pip = minimum_price_variation * contract_mutiplier * quote_currency.conversion_rate
```

## Trade Models

[Reality models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/key-concepts.md) make backtests as realistic as possible to how the strategy would perform in live trading.

## Split Adjustment

If a split event occurs before your order is filled, the unfilled portion of the order is adjusted automatically, where its quantity is multiplied by the split factor and the limit/stop/trigger price (if any) is divided by the split factor.

## Open Order Margin Requirements

When an order fills, LEAN uses the [portfolio](https://www.quantconnect.com/docs/v2/writing-algorithms/portfolio/key-concepts.md) information to check if you have [enough capital](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/buying-power.md) to maintain the remaining open orders. If you don't, they are canceled.

The following table shows the order events of three orders of SPY 240109C00470000:

| Time | Id | Type | Price | Quantity | Status |
| --- | --- | --- | --- | --- | --- |
| 2024-01-08 09:31 | 1 | Buy Market | 0.91 | 20 | `FILLED` |
| 2024-01-08 09:31 | 2 | Sell Stop Market | 0.81 | -20 | `SUBMITTED` |
| 2024-01-08 10:31 | 3 | Sell Market | 1.50 | -10 | `FILLED` |
| 2024-01-08 10:31 | 2 | Sell Stop Market | 0.81 | -20 | `INVALID` |

When the sell market order fills at 10:31, LEAN checks the sell stop order and sets its status to `OrderStatus.INVALID` due to insufficient buying power to complete it.

## Asynchronous Execution

In live trading, we send your orders to the API of your brokerage and wait for their response to update the [status of the order ticket](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-events.md#03-Order-States) from `NEW` to `SUBMITTED`, `CANCELED`, or `INVALID`. When you place multiple orders, waiting for responses from the brokerage delays the last orders of the batch. To avoid this delay, you can place orders asynchronously. When you place an order asynchronously, LEAN sends the order to your brokerage and immediately continues executing your algorithm without waiting for a response. When the response from the brokerage arrives, LEAN updates the status of the order ticket accordingly, and your algorithm receives an [order event](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-events.md).

## Live Trading Considerations

In live trading, orders fill asynchronously. We send your order to the API of your brokerage and wait for their response to update the state of your algorithm and portfolio. The timing of live order fills doesn't depend on the resolution of your security subscriptions. When your order fills, the fill price and fee is set by your brokerage. You can add event handlers to your algorithm to [monitor the brokerage connection](https://www.quantconnect.com/docs/v2/writing-algorithms/live-trading/brokerages.md#04-Monitor-the-Brokerage-Connection) and [brokerage messages](https://www.quantconnect.com/docs/v2/writing-algorithms/live-trading/brokerages.md#05-Monitor-Brokerage-Messages).

In backtesting, the trade fill timing depends on the resolution of your security subscription. For example, if you subscribe to a security with minute resolution data, the algorithm only receives data in one-minute [time slices](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/timeslices.md). As a result, the [fill model](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/trade-fills/key-concepts.md) can only evaluate if the order should fill on a minute-by-minute frequency.
