---
title: "Trading and Orders"
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/22%20Trading%20and%20Orders
modified: 2026-11-23
index: https://www.quantconnect.com/llms.txt
---

# Trading and Orders

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Trading and Orders

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

## Pages in This Section

- [Key Concepts](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/key-concepts.md): LEAN has many methods to create, update, and cancel orders. You can fetch, update, and cancel manual orders with order tickets.
- [Order Management](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-factory.md)
- [Order Types](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types.md): You can place many different types of orders through the QCAlgorithm API. Click one of the following order types to learn more.
- [Pre-trade Risk Control](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/pre-trade-risk-control.md): LEAN performs pre-order checks to ensure that the order meets some requirements to ensure that the order is valid and can be executed.
- [Position Sizing](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/position-sizing.md): LEAN provides several methods to help you set specific portfolio weights for assets.
- [Liquidating Positions](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/liquidating-positions.md): The Liquidate method lets you liquidate individual assets or your entire portfolio. The method creates market orders to close positions.
- [Crypto Trades](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/crypto-trades.md): All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC.
- [Option Strategies](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/option-strategies.md): You can implement any of the following Option strategies in an algorithm. Click one to learn more.
- [Order Properties](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-properties.md): Order properties enable you to customize how the brokerage executes your orders. DefaultOrderProperties sets the default properties for your orders.
- [Order Events](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-events.md): As the state of your orders change, we notify you with OrderEvent objects through the OnOrderEvent and OnAssignmentOrderEvent event handlers.
- [Order Errors](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-errors.md): If an error occurs with one of your orders, LEAN logs the error message and stops executing.
- [Trade Statistics](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/trade-statistics.md): The TradeBuilder tracks your trades and calculates some statistics. You can adjust how it defines a trade and how it matches offsetting order fills.
- [Trading Calendar](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/trading-calendar.md): The TradingCalendar contains a variety of events relevant to the assets in your algorithm. We source the event data from Quantlib.
- [Financial Advisors](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/financial-advisors.md): Financial Advisor accounts enable certified professionals to use a single trading algorithm to manage several client accounts.
