---
title: "Coinbase"
description: "This page explains the default security-level models and markets of the CoinbaseBrokerageModel."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/coinbase
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/coinbase.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/24%20Reality%20Modeling/05%20Brokerages/02%20Supported%20Models/14%20Coinbase
modified: 2026-10-31
index: https://www.quantconnect.com/llms.txt
---

# Coinbase

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Reality Modeling > Brokerages > [Supported Models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models.md) > Coinbase

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

## Introduction

This page explains the `CoinbaseBrokerageModel`, including the asset classes it supports, its default [security-level models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/key-concepts.md#02-Security-Level-Models), and its default markets.

```python
self.set_brokerage_model(BrokerageName.COINBASE, AccountType.CASH)
```

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Brokerages/CoinbaseBrokerageModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Common/Brokerages/CoinbaseBrokerageModel.cs).

## Asset Classes

The `CoinbaseBrokerageModel` supports trading [Crypto](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/crypto.md).

## Orders

The `CoinbaseBrokerageModel` supports several order types and order properties, but it doesn't support order updates.

### Order Types

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

| Order Type | Crypto |
| --- | --- |
| [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) |
| [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) |
| [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) Supported before 2019-03-23 in backtests. For reference, see the [Coinbase Market Structure Update](https://blog.coinbase.com/coinbase-pro-market-structure-update-fbd9d49f43d7) on the Coinbase website. |
| [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) |

### Order Properties

The `CoinbaseBrokerageModel` supports custom order properties. The following table describes the members of the `CoinbaseOrderProperties` object that you can set to customize order execution:

| Property | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `time_in_force` | `TimeInForce` | A [TimeInForce](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-properties.md#03-Time-In-Force) instruction to apply to the order. The `TimeInForce` is supported. | `TimeInForce.GOOD_TIL_CANCELED` |
| `post_only` | `bool` | A flag that signals the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled. |  |
| `self_trade_prevention_id` | `bool` | A flag that signals self-trade prevention is enabled for this order. Self-trade prevention helps prevent an order from crossing against the same user, reducing the risk of unintentional trades within the same account. |  |

```python
def initialize(self) -> None:
    # Set the default order properties
    self.default_order_properties = CoinbaseOrderProperties()
    self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED
    self.default_order_properties.post_only = False

def on_data(self, slice: Slice) -> None:
    # Use default order order properties
    self.limit_order(self._symbol, quantity, limit_price)

    # Override the default order properties
    order_properties = CoinbaseOrderProperties()
    order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED
    order_properties.post_only = True
    self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)
```

### Updates

The `CoinbaseBrokerageModel` doesn't support [limit order](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-orders.md) updates, but you can cancel an existing limit order and then create a new limit order with the desired arguments. For more information about this workaround, see the [Workaround for Brokerages That Don’t Support Updates](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md#workaround-for-brokerages-that-dont-support-updates).

## Fills

The `CoinbaseBrokerageModel` uses the [ImmediateFillModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/trade-fills/supported-models/immediate-model.md).

## Slippage

The `CoinbaseBrokerageModel` uses the [NullSlippageModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/slippage/supported-models.md#02-Null-Model).

## Fees

The `CoinbaseBrokerageModel` uses the [CoinbaseFeeModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/transaction-fees/supported-models.md#11-Coinbase-Model).

## Buying Power

The `CoinbaseBrokerageModel` uses the `CashBuyingPowerModel`. The brokerage model doesn't currently support margin trading.

## Settlement

The `CoinbaseBrokerageModel` uses the [ImmediateSettlementModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/settlement/supported-models.md#02-Immediate-Model).

## Margin Interest Rate

The `CoinbaseBrokerageModel` uses the [NullMarginInterestRateModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/margin-interest-rate/supported-models.md#02-Null-Model).

## Default Markets

The default market of the `CoinbaseBrokerageModel` is `Market.COINBASE`.

## Account Currency

The `CoinbaseBrokerageModel` doesn't set a default currency. To change the algorithm's currency from USD to a different currency, see [Set Account Currency](https://www.quantconnect.com/docs/v2/writing-algorithms/initialization.md#03-Set-Account-Currency).
