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.
projectId integer
Project Id.
compileId string
Compile Id.
serverType string
Type of server instance that will run the algorithm.
baseLiveAlgorithmSettings BaseLiveAlgorithmSettings object
Base class for settings that must be configured per Brokerage to create new algorithms via the API.
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.
Example
{
  "projectId": 0,
  "compileId": "string",
  "serverType": "string",
  "baseLiveAlgorithmSettings": {
    "id": "string",
    "user": "string",
    "password": "string",
    "environment": "live",
    "account": "string"
  },
  "versionId": "-1"
}
BaseLiveAlgorithmSettings Model - Base class for settings that must be configured per Brokerage to create new algorithms via the API.
id string
'Interactive' / 'FXCM' / 'Oanda' / 'Tradier' /'PaperTrading'.
user string
Username associated with brokerage.
password string
Password associated with brokerage.
environment string Enum
Represents the types of environments supported by brokerages for trading. Options : ['live', 'paper']
account string
Account of the associated brokerage.
Example
{
  "id": "string",
  "user": "string",
  "password": "string",
  "environment": "live",
  "account": "string"
}
BrokerageEnvironment Model - Represents the types of environments supported by brokerages for trading.
BrokerageEnvironment string Enum
Represents the types of environments supported by brokerages for trading. Options : ['live', 'paper']
Example
{
  "BrokerageEnvironment": "live"
}

Responses

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

200 Success

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', 'PaperTrading', 'Alpaca', 'Bitfinex', 'Binance', 'GDAX']
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"
  ]
}
AlgorithmStatus Model - States of a live deployment.
AlgorithmStatus string Enum
States of a live deployment. Options : ['DeployError', 'InQueue', 'Running', 'Stopped', 'Liquidated', 'Deleted', 'Completed', 'RuntimeError', 'Invalid', 'LoggingIn', 'Initializing', 'History']
Example
{
  "AlgorithmStatus": "DeployError"
}

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: