Live Management

Create Live Algorithm

Introduction

Create a live algorithm.

Request

Project, compile and brokerage login information for deploying a live algorithm. The /live/create API accepts requests in the following format:

CreateLiveAlgorithmRequest Model - Request to create a live algorithm.
versionId string
example: -1

The version of the Lean used to run the algorithm. -1 is master, however, sometimes this can create problems with live deployments. If you experience problems using, try specifying the version of Lean you would like to use.
projectId integer
Project Id.
compileId string
Compile Id.
nodeId string
Id of the node that will run the algorithm.
brokerage object Enum
Brokerage configurations to be used in the live algorithm. Options : ['QuantConnectSettings', 'InteractiveBrokersSettings', 'BinanceSettings', 'BinanceFuturesUSDMSettings', 'BinanceFuturesCOINSettings', 'BinanceUSSettings', 'TradierSettings', 'BitfinexSettings', 'CoinbaseSettings', 'KrakenSettings', 'BybitSettings', 'OandaSettings', 'ZerodhaSettings', 'SamcoSettings', 'WolverineSettings', 'TDAmeritradeSettings', 'TradingTechnologiesSettings', 'RBIBrokerageSettings', 'TerminalLinkSettings']
dataProviders object
Dictionary of data provider configurations to be used in the live algorithm.
Example
{
  "versionId": "-1",
  "projectId": 0,
  "compileId": "string",
  "nodeId": "string",
  "brokerage": {
    "id": "string",
    "holdings": [
      {
        "symbolId": "string",
        "symbol": "string",
        "quantity": 0,
        "averagePrice": 0
      }
    ],
    "cash": [
      {
        "amount": 0,
        "currency": "string"
      }
    ]
  },
  "dataProviders": {
    "QuantConnectBrokerage": {
      "id": "string",
      "holdings": [
        {
          "symbolId": "string",
          "symbol": "string",
          "quantity": 0,
          "averagePrice": 0
        }
      ],
      "cash": [
        {
          "amount": 0,
          "currency": "string"
        }
      ]
    }
  }
}
QuantConnectSettings Model - QuantConnect settings for using it as a brokerage or data provider.
id string
ID of QuantConnect, this is QuantConnectBrokerage.
holdings BrokerageHolding Array
List of holdings for the brokerage.
cash CashAmount Array
List of cash amount.
Example
{
  "id": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ],
  "cash": [
    {
      "amount": 0,
      "currency": "string"
    }
  ]
}
InteractiveBrokersSettings Model - Settings for using Interactive Brokers as brokerage or data provider.
id string
ID of InteractiveBrokers, this is InteractiveBrokersBrokerage.
ib-user-name string
Your Interactive Brokers username.
ib-password string
Your Interactive Brokers password.
ib-trading-mode string Enum
Represents the types of environments supported by Interactive Brokers for trading. Options : ['live', 'paper']
ib-account string
Your Interactive Brokers account id.
ib-weekly-restart-utc-time string($date)
Weekly restart UTC time (hh:mm:ss).
Example
{
  "id": "string",
  "ib-user-name": "string",
  "ib-password": "string",
  "ib-trading-mode": "live",
  "ib-account": "string",
  "ib-weekly-restart-utc-time": "2021-11-26T15:18:27.693Z"
}
BinanceSettings Model
id string
ID of the brokerage, this is, BinanceBrokerage.
binance-exchange-name string
Binance exchange, this is, Binance.
binance-api-secret string
Your Binance API secret.
binance-api-key string
Your Binance API key.
binance-api-url string
Binance configuration for spot/margin. The value for this property is https://api.binance.com.
binance-websocket-url string
Binance configuration for spot/margin. The value for this property is wss://stream.binance.com:9443/ws.
holdings BrokerageHolding Array
List of holdings for the brokerage.
description object
/.
Example
{
  "id": "string",
  "binance-exchange-name": "string",
  "binance-api-secret": "string",
  "binance-api-key": "string",
  "binance-api-url": "string",
  "binance-websocket-url": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ],
  "description": 
}
BinanceFuturesUSDMSettings Model
id string
ID of the brokerage, this is, BinanceBrokerage.
binance-exchange-name string
Binance exchange, this is, Binance-USDM-Futures.
binance-api-secret string
Your Binance API secret.
binance-api-key string
Your Binance API key.
binance-fapi-url string
Binance Futures configuration for spot/margin. The value for this property is https://fapi.binance.com.
binance-fwebsocket-url string
Binance Futures configuration for spot/margin. The value for this property is wss://fstream.binance.com/ws.
holdings BrokerageHolding Array
List of holdings for the brokerage.
description object
/.
Example
{
  "id": "string",
  "binance-exchange-name": "string",
  "binance-api-secret": "string",
  "binance-api-key": "string",
  "binance-fapi-url": "string",
  "binance-fwebsocket-url": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ],
  "description": 
}
BinanceFuturesCOINSettings Model
id string
ID of the brokerage, this is, BinanceBrokerage.
binance-exchange-name string
Binance exchange, this is, Binance-COIN-Futures.
binance-api-secret string
Your Binance API secret.
binance-api-key string
Your Binance API key.
binance-dapi-url string
Binance Futures configuration for spot/margin. The value for this property is https://dapi.binance.com.
binance-dwebsocket-url string
Binance Futures configuration for spot/margin. The value for this property is wss://dstream.binance.com/ws.
holdings BrokerageHolding Array
List of holdings for the brokerage.
description object
/.
Example
{
  "id": "string",
  "binance-exchange-name": "string",
  "binance-api-secret": "string",
  "binance-api-key": "string",
  "binance-dapi-url": "string",
  "binance-dwebsocket-url": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ],
  "description": 
}
BinanceUSSettings Model
id string
ID of the brokerage, this is, BinanceBrokerage.
binance-exchange-name string
Binance exchange, this is, BinanceUS.
binanceus-api-secret string
Your Binance US API secret.
binanceus-api-key string
Your Binance US API key.
binanceus-api-url string
Binance US configuration for spot/margin. The value for this property is https://api.binance.us.
binanceus-websocket-url string
Binance US configuration for spot/margin. The value for this property is wss://stream.binance.us:9443/ws.
holdings BrokerageHolding Array
List of holdings for the brokerage.
description object
/.
Example
{
  "id": "string",
  "binance-exchange-name": "string",
  "binanceus-api-secret": "string",
  "binanceus-api-key": "string",
  "binanceus-api-url": "string",
  "binanceus-websocket-url": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ],
  "description": 
}
TradierSettings Model - Settings for using Tradier as a data provider.
id string
ID of the brokerage, this is, TradierBrokerage.
tradier-account-id string
Your Tradier account id.
tradier-access-token string
Your Tradier access token.
tradier-environment string Enum
Whether the developer sandbox should be used. Options : ['live', 'paper']
Example
{
  "id": "string",
  "tradier-account-id": "string",
  "tradier-access-token": "string",
  "tradier-environment": "live"
}
BitfinexSettings Model - Settings for using Bitfinex as a data provider or brokerage.
id string
ID of the brokerage, this is, BitfinexBrokerage.
bitfinex-api-key string
Your Bitfinex API key.
bitfinex-api-secret string
Your Bitfinex API secret.
Example
{
  "id": "string",
  "bitfinex-api-key": "string",
  "bitfinex-api-secret": "string"
}
CoinbaseSettings Model - Settings for using Coinbase as a data provider or brokerage.
id string
ID of the brokerage, this is, CoinbaseBrokerage.
coinbase-api-key string
Your Coinbase Advanced Trade API key.
coinbase-api-secret string
Your Coinbase Advanced Trade API secret.
coinbase-url string
Coinbase URL, this is, wss://advanced-trade-ws.coinbase.com.
coinbase-rest-api string
Coinbase REST API, this is, https://api.coinbase.com.
holdings BrokerageHolding Array
List of holdings for the brokerage.
Example
{
  "id": "string",
  "coinbase-api-key": "string",
  "coinbase-api-secret": "string",
  "coinbase-url": "string",
  "coinbase-rest-api": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ]
}
KrakenSettings Model - Settings for using Kraken as a data provider.
id string
ID of the brokerage, this is, KrakenBrokerage.
kraken-api-key string
Your Kraken API key.
kraken-api-secret string
Your Kraken API secret.
kraken-verification-tier string
Your Kraken Verification Tier.
Example
{
  "id": "string",
  "kraken-api-key": "string",
  "kraken-api-secret": "string",
  "kraken-verification-tier": "string"
}
BybitSettings Model - Settings for using Bybit as a data provider or brokerage.
id string
ID of the brokerage, this is, BybitBrokerage.
bybit-api-key string
Your Bybit API key.
bybit-api-secret string
Your Bybit API secret.
bybit-vip-level string
Your Bybit VIP Level.
bybit-use-testnet string Enum
Whether the testnet should be used. Options : ['live', 'paper']
bybit-api-url string
Bybit API URL, this is, https://api-testnet.bybit.com.
bybit-websocket-url string
Bybit Websocket URL, this is, wss://stream.bybit.com.
holdings BrokerageHolding Array
List of holdings for the brokerage.
Example
{
  "id": "string",
  "bybit-api-key": "string",
  "bybit-api-secret": "string",
  "bybit-vip-level": "string",
  "bybit-use-testnet": "live",
  "bybit-api-url": "string",
  "bybit-websocket-url": "string",
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ]
}
OandaSettings Model - Settings for using Oanda as a data provider or brokerage.
id string
ID of the brokerage, this is, OandaBrokerage.
oanda-account-id string
Your OANDA account id can be found on your OANDA Account Statement page (https://www.oanda.com/account/statement/). It follows the following format '###-###-######-###'.
oanda-access-token string
Your OANDA API token. You can generate an API token from the Manage API Access page (https://www.oanda.com/account/tpa/personal_token).
oanda-environment string Enum
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade. Options : ['Practice', 'Trade']
Example
{
  "id": "string",
  "oanda-account-id": "string",
  "oanda-access-token": "string",
  "oanda-environment": "Practice"
}
ZerodhaSettings Model - Settings for using Zerodha as a data provider or brokerage.
id string
Brokerage ID, this is, ZerodhaBrokerage.
zerodha-api-key string
Your Kite Connect API key.
zerodha-access-token string
Your Kite Connect access token.
zerodha-product-type string Enum
The product type must be set to MIS if you are targeting intraday products, CNC if you are targeting delivery products or NRML if you are targeting carry forward products. Options : ['mis', 'cnc', 'nrml']
zerodha-trading-segment string Enum
The trading segment must be set to 'equity' if you are trading equities on NSE or BSE, or 'commodity' if you are trading commodities on MCX. Options : ['equity', 'commodity']
zerodha-history-subscription bool
Whether you have a history API subscription for Zerodha.
Example
{
  "id": "string",
  "zerodha-api-key": "string",
  "zerodha-access-token": "string",
  "zerodha-product-type": "mis",
  "zerodha-trading-segment": "equity",
  "zerodha-history-subscription": 
}
SamcoSettings Model - Settings for using Samco as a data provider or brokerage.
id string
Brokerage ID, this is, SamcoBrokerage.
samco-client-id string
Your Samco account Client ID.
samco-client-password string
Your Samco account password.
samco-year-of-birth int
Your year of birth (YYYY) registered with Samco.
samco-product-type string Enum
MIS if you are targeting intraday products, CNC if you are targeting delivery products, NRML if you are targeting carry forward products. Options : ['mis', 'cnc', 'nrml']
samco-trading-segment string Enum
\'equity\' if you are trading equities on NSE or BSE, commodity if you are trading \'commodities\' on MCX. Options : ['equity', 'commodity']
Example
{
  "id": "string",
  "samco-client-id": "string",
  "samco-client-password": "string",
  "samco-year-of-birth": ,
  "samco-product-type": "mis",
  "samco-trading-segment": "equity"
}
WolverineSettings Model - Settings for using Wolverine Execution Services as a brokerage.
id string
Brokerage ID, this is, WolverineBrokerage.
wolverine-on-behalf-of-comp-id string
Value used to identify the trading firm.
wolverine-account string
Wolverine Execution Services account name.
cash CashAmount Array
List of cash amount.
holdings BrokerageHolding Array
List of holdings for the brokerage.
Example
{
  "id": "string",
  "wolverine-on-behalf-of-comp-id": "string",
  "wolverine-account": "string",
  "cash": [
    {
      "amount": 0,
      "currency": "string"
    }
  ],
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ]
}
TDAmeritradeSettings Model - Settings for using TDAmeritrade as a data provider or brokerage.
id string
Brokerage ID, this is, TDAmeritradeBrokerage.
tdameritrade-api-key string
Your TDAmeritrade API key.
tdameritrade-access-token string
Your TDAmeritrade OAuth Access Token.
tdameritrade-account-number string
Your TDAmeritrade account number.
Example
{
  "id": "string",
  "tdameritrade-api-key": "string",
  "tdameritrade-access-token": "string",
  "tdameritrade-account-number": "string"
}
TradingTechnologiesSettings Model - Settings for using Trading Technologies as a brokerage.
id string
Brokerage ID, this is, TradingTechnologiesBrokerage.
tt-user-name string
Trading Technologies user name.
tt-session-password string
Trading Technologies session password.
tt-account-name string
Trading Technologies account name.
tt-rest-app-key string
Trading Technologies App key.
tt-rest-app-secret string
Trading Technologies App secret.
tt-rest-environment string Enum
Environment in which the brokerage Trading Technologies will be used. Options : ['live', 'uat']
tt-order-routing-sender-comp-id string
Trading Technologies remote comp id.
cash CashAmount Array
List of cash amount.
Example
{
  "id": "string",
  "tt-user-name": "string",
  "tt-session-password": "string",
  "tt-account-name": "string",
  "tt-rest-app-key": "string",
  "tt-rest-app-secret": "string",
  "tt-rest-environment": "live",
  "tt-order-routing-sender-comp-id": "string",
  "cash": [
    {
      "amount": 0,
      "currency": "string"
    }
  ]
}
RBIBrokerageSettings Model - Settings for using RBI as a brokerage.
id string
Brokerage ID, this is, RBIBrokerage.
rbi-on-behalf-of-comp-id string
Value used to identify the trading firm.
rbi-account string
RBI account name.
cash CashAmount Array
List of cash amount.
holdings BrokerageHolding Array
List of holdings for the brokerage.
Example
{
  "id": "string",
  "rbi-on-behalf-of-comp-id": "string",
  "rbi-account": "string",
  "cash": [
    {
      "amount": 0,
      "currency": "string"
    }
  ],
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ]
}
TerminalLinkSettings Model - Settings for using TerminalLink as a brokerage.
id string
Brokerage ID, this is TerminalLinkBrokerage.
terminal-link-connection-type string Enum
Terminal Link Connection Type [DAPI, SAPI]. Options : ['DAPI', 'SAPI']
cash CashAmount Array
List of cash amount.
holdings BrokerageHolding Array
List of holdings for the brokerage.
Example
{
  "id": "string",
  "terminal-link-connection-type": "DAPI",
  "cash": [
    {
      "amount": 0,
      "currency": "string"
    }
  ],
  "holdings": [
    {
      "symbolId": "string",
      "symbol": "string",
      "quantity": 0,
      "averagePrice": 0
    }
  ]
}
BrokerageHolding Model - Holding object class for creating a live algorithm.
symbolId string
Symbol ID of the holding.
symbol string
Symbol ticker of the holding.
quantity number
Quantity of the Symbol we hold.
averagePrice number
Average Price of our Holding in the currency the symbol is traded in.
Example
{
  "symbolId": "string",
  "symbol": "string",
  "quantity": 0,
  "averagePrice": 0
}
CashAmount Model - Represents a cash amount which can be converted to account currency using a currency converter.
amount number
The amount of cash.
currency string
The currency in which the cash amount is denominated.
Example
{
  "amount": 0,
  "currency": "string"
}

Responses

The /live/create API provides a response in the following format:

200 Success

CreateLiveAlgorithmResponse Model - Response received when deploying a live algorithm.
live LiveAlgorithm object
Live algorithm instance result from the QuantConnect Rest API.
success boolean
Indicate if the API request was successful.
errors string Array
List of errors with the API call.
Example
{
  "live": {
    "projectId": 0,
    "deployId": "string",
    "status": "DeployError",
    "launched": "2021-11-26T15:18:27.693Z",
    "stopped": "2021-11-26T15:18:27.693Z",
    "brokerage": "Interactive",
    "subscription": "string",
    "error": "string",
    "success": true,
    "errors": [
      "string"
    ]
  },
  "success": true,
  "errors": [
    "string"
  ]
}
LiveAlgorithm Model - Live algorithm instance result from the QuantConnect Rest API.
projectId integer
Project Id for the live instance.
deployId string
Unique live algorithm deployment identifier (similar to a backtest id).
status string Enum
States of a live deployment. Options : ['DeployError', 'InQueue', 'Running', 'Stopped', 'Liquidated', 'Deleted', 'Completed', 'RuntimeError', 'Invalid', 'LoggingIn', 'Initializing', 'History']
launched string($date-time)
Datetime the algorithm was launched in UTC.
stopped string($date-time)
Datetime the algorithm was stopped in UTC, null if its still running.
brokerage string Enum
Brokerage. Options : ['Interactive', 'FXCM', 'Oanda', 'Tradier', 'PaperBrokerage', 'Alpaca', 'Bitfinex', 'Binance', 'Coinbase']
subscription string
Chart we're subscribed to.
error string
Live algorithm error message from a crash or algorithm runtime error.
success boolean
Indicate if the API request was successful.
errors string Array
List of errors with the API call.
Example
{
  "projectId": 0,
  "deployId": "string",
  "status": "DeployError",
  "launched": "2021-11-26T15:18:27.693Z",
  "stopped": "2021-11-26T15:18:27.693Z",
  "brokerage": "Interactive",
  "subscription": "string",
  "error": "string",
  "success": true,
  "errors": [
    "string"
  ]
}

401 Authentication Error

UnauthorizedError Model - Unauthorized response from the API. Key is missing, invalid, or timestamp is too old for hash.
www_authenticate string
Header

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: