---
title: "QuantConnect Paper Trading"
description: "QuantConnect Paper Trading lets you run live, real-time data into your algorithm but execute trades using fictional capital."
canonical: https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages/quantconnect-paper-trading
markdown: https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages/quantconnect-paper-trading.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/01%20Cloud%20Platform/10%20Live%20Trading/02%20Brokerages/01%20QuantConnect%20Paper%20Trading
modified: 2026-11-02
index: https://www.quantconnect.com/llms.txt
---

# QuantConnect Paper Trading

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Cloud Platform](https://www.quantconnect.com/docs/v2/cloud-platform.md) > [Live Trading](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading.md) > [Brokerages](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages.md) > QuantConnect Paper Trading

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

## Introduction

QuantConnect enables you to run your algorithms in live mode with real-time market data.

QuantConnect Paper Trading lets you run [live, real-time data](https://www.quantconnect.com/docs/v2/cloud-platform/datasets.md) into your algorithm but execute trades using fictional capital. Instead of your orders being routed to an exchange when you're paper trading, your order fills are simulated. Use paper trading to test your algorithm without risking real money and to ensure your backtest wasn't overfit before deploying with real money. You can use the paper trading brokerage without needing to sign up for a real brokerage account. If you don't set a brokerage model in your algorithm with the `set_brokerage_model` method, the paper trading brokerage uses the `DefaultBrokerageModel` to simulate trades.

To view the implementation of the QuantConnect Paper Trading brokerage, see [PaperBrokerage.cs](https://github.com/QuantConnect/Lean/blob/master/Brokerages/Paper/PaperBrokerage.cs) in the LEAN GitHub repository. To view the implementation of the backtesting brokerage, see [BacktestingBrokerage.cs](https://github.com/QuantConnect/Lean/blob/master/Brokerages/Backtesting/BacktestingBrokerage.cs) in the LEAN GitHub repository.

## Account Types

The QuantConnect Paper Trading brokerage supports cash and margin accounts. To set the account type in an algorithm, see the [paper trading brokerage model documentation](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md).

If you pass a different `BrokerageName` to the `set_brokerage_model` method, the new brokerage model defines the account types that are available.

## Asset Classes

The QuantConnect Paper Trading brokerage supports the following asset classes:

- [US Equities](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity.md)
- [Equity Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/equity-options.md)
- [Crypto](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/crypto.md)
- [Forex](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/forex.md)
- [CFD](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/cfd.md)
- [Futures](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures.md)
- [Future Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/future-options.md)
- [Index Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/index-options.md)

If you set the [brokerage model](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/key-concepts.md) to a model other than the [DefaultBrokerageModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md), the new brokerage model defines the asset classes you can trade.

## Data Feeds

We can only provide paper trading on the assets for which we have a [live data provider](https://www.quantconnect.com/docs/v2/cloud-platform/datasets.md).

## Orders

The following sections describe how the `DefaultBrokerageModel` handles orders. If you set the brokerage model to a different model, the new brokerage model defines how orders are handled.

### Order Types

The following table describes the available order types for each asset class that the `DefaultBrokerageModel` supports:

| Order Type | US Equity | Crypto | Crypto Futures | Forex | CFD | Futures | Futures Options |
| --- | --- | --- | --- | --- | --- | --- | --- |
| [Market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Limit if touched](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-if-touched-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Stop market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-market-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Stop limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-limit-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Market on open](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-open-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |  |  |
| [Market on close](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-close-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Combo market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-market-orders.md) |  |  |  |  |  |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Combo limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-limit-orders.md) |  |  |  |  |  |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Combo leg limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/combo-leg-limit-orders.md) |  |  |  |  |  |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Exercise Option](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/option-exercise-orders.md) |  |  |  |  |  |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |

In live trading, the [QuantConnect data provider](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect.md) supplies US Equity Options and US Index Options data. Future Options orders require a third-party data provider that supports Future Options. To view the data providers that support Options, see [Datasets](https://www.quantconnect.com/docs/v2/cloud-platform/datasets.md).

### Time In Force

The `DefaultBrokerageModel` supports the following [TimeInForce](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-properties.md#03-Time-In-Force) instructions:

- `DAY`
- `good_til_canceled`
- `good_til_date`

### Updates

The `DefaultBrokerageModel` supports [order updates](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md#04-Update-Orders).

### Handling Splits

If you're using raw [data normalization](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/requesting-data.md#11-Data-Normalization) and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a [stock split](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/corporate-actions.md#02-Splits) occurs, the following properties of your orders automatically adjust to reflect the stock split:

- Quantity
- Limit price
- Stop price
- Trigger price

## Fees

The following table shows the fees that the `DefaultBrokerageModel` charges for each of the supported asset classes:

| Asset Class | Fee |
| --- | --- |
| Equities | $0.005/share with a $1 minimum fee |
| Crypto | $0 |
| Forex | $0 |
| CFDs | $0 |
| Futures | $1.85/contract |
| Future Options | $1.85/contract |

There is no fee to exercise Option contracts.

If you set the brokerage model to a model other than the `DefaultBrokerageModel`, the new brokerage model defines the order fees.

To see the fee models that the `DefaultBrokerageModel` uses, see [Fees](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#06-Fees).

## Margin

We model [buying power](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#07-Buying-Power) and [margin calls](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/margin-calls.md) to ensure your algorithm stays within the margin requirements. If you set the brokerage model to a different model, the new brokerage model defines how margin is modeled.

## Slippage

Orders through the `DefaultBrokerageModel` do not experience slippage in backtests or paper trading. For more information about the slippage model the `DefaultBrokerageModel` uses, see [Slippage](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#05-Slippage).

## Fills

The `DefaultBrokerageModel` fills market orders immediately and completely. When available, bid and ask spread will be used for the fill prices.

To view how we model realistic order fills, see [Fills](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#04-Fills).

## Settlements

If you trade with a margin account, trades settle immediately

To view how we model settlement for paper trades, see [Settlement](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#08-Settlement).

## Brokerage Models

The QuantConnect Paper Trading brokerage uses the `DefaultBrokerageModel` by default, but you can use any of the [brokerage models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models.md).

## Deposits and Withdrawals

The QuantConnect Paper Trading brokerage supports deposits and withdrawals.

```python
# Deposit 100 units of account currency and withdraw 1 ETH.
self.porfolio.cash_book.add(self.account_currency, 100)
self.porfolio.cash_book.add("ETH", -1)
```

## Demo Algorithm

The following algorithm demonstrates the functionality of the QuantConnect Paper Trading brokerage:

```python
# Demonstrate QuantConnect Paper Trading brokerage functionality with an EMA crossover strategy on SPY.
class QuantConnectPaperTradingDemoAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.set_cash(100000)
        self.set_brokerage_model(BrokerageName.QUANT_CONNECT_BROKERAGE, AccountType.MARGIN)
        symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._fast = self.ema(symbol, 10, Resolution.DAILY)
        self._slow = self.ema(symbol, 50, Resolution.DAILY)

    def on_data(self, slice: Slice) -> None:
        if not self._slow.is_ready:
            return
        if self._fast.current.value > self._slow.current.value and not self.portfolio.invested:
            self.set_holdings("SPY", 1)
        elif self._fast.current.value < self._slow.current.value and self.portfolio.invested:
            self.liquidate()
```

## Deploy Live Algorithms

You must have an available [live trading node](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/resources.md#04-Live-Trading-Nodes) for each live trading algorithm you deploy.

Follow these steps to deploy a live paper trading algorithm:

1. [Open the project](https://www.quantconnect.com/docs/v2/cloud-platform/projects/getting-started.md#02-View-All-Projects) that you want to deploy.
2. Click the ![Deploy live icon](https://cdn.quantconnect.com/i/tu/deploy-live-icon.png) **Deploy Live** icon.
3. On the Deploy Live page, click the **Brokerage** field and then click **Paper Trading** from the drop-down menu.
4. In the **Region** section, click the [region](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/getting-started.md#07-Redundancy) where you want to run the algorithm.
5. Click the **Node** field and then click the live trading node that you want to use from the drop-down menu.
6. (Optional) In the **Data Provider** section, click **Show** and change the data provider or add additional providers.
7. (Optional) Follow these steps to start the algorithm with existing cash holdings ([see video](https://vimeo.com/703024505)):
   1. In the **Algorithm Cash State** section, click **Show**.
   2. Click **Add Currency**.
   3. Enter the currency ticker (for example, USD or BTC) and a quantity.
8. (Optional) Follow these steps to start the algorithm with existing position holdings ([see video](https://vimeo.com/703024505)):
   1. In the **Algorithm Holdings State** section, click **Show**.
   2. Click **Add Holding**.
   3. Enter the symbol ID, symbol, quantity, and average price.
9. (Optional) [Set up notifications](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/notifications.md).
10. Configure the **Automatically restart algorithm** setting.
   By enabling [automatic restarts](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/deployment.md#07-Automatic-Restarts), the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection.
11. Click **Deploy**.

The deployment process can take up to 5 minutes. When the algorithm deploys, the [live results page](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/results.md) displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

Restarts, including automatic restarts and redeployments, don't save the state of your algorithm. To learn what a restart recovers and how to persist the rest, see [State Persistence](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/deployment.md#10-State-Persistence).
