Read Live Algorithm

Portfolio State

Introduction

Read out the portfolio state of a live algorithm.

Request

Fetch the live portfolio state for the project Id provided. The /live/read/portfolio API accepts requests in the following format:

ReadLivePortfolioRequest Model - Request to read the portfolio state from a live algorithm.
projectId integer
Id of the project from which to read the live algorithm.
Example
{
  "projectId": 0
}

Responses

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

200 Success

LivePortfolioResponse Model - Contains holdings and cash of the live algorithm in the request criteria.
portfolio Portfolio object
/.
Example
{
  "portfolio": {
    "Holdings": {
      "Symbol": {
        "Value": "string",
        "ID": "string",
        "Permtick": "string"
      },
      "Type": "Base",
      "CurrencySymbol": "$",
      "AveragePrice": 0,
      "Quantity": 0,
      "MarketPrice": 0,
      "ConversionRate": 0,
      "MarketValue": 0,
      "UnrealizedPnl": 0
    },
    "Cash": {
      "Symbol": "string",
      "Amount": 0,
      "ConversionRate": 0,
      "CurrencySymbol": ,
      "ValueInAccountCurrency": 0
    }
  }
}
Portfolio Model
Holdings Holding object
Dictionary of algorithm holdings information.
Cash Cash object
Represents a holding of a currency in cash.
Example
{
  "Holdings": {
    "Symbol": {
      "Value": "string",
      "ID": "string",
      "Permtick": "string"
    },
    "Type": "Base",
    "CurrencySymbol": "$",
    "AveragePrice": 0,
    "Quantity": 0,
    "MarketPrice": 0,
    "ConversionRate": 0,
    "MarketValue": 0,
    "UnrealizedPnl": 0
  },
  "Cash": {
    "Symbol": "string",
    "Amount": 0,
    "ConversionRate": 0,
    "CurrencySymbol": ,
    "ValueInAccountCurrency": 0
  }
}
Holding Model - Live results object class for packaging live result data.
Symbol Symbol object
Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security.
Type string Enum
Type of tradable security / underlying asset. Options : ['Base', 'Equity', 'Option', 'Commodity', 'Forex', 'Future', 'Cfd', 'Crypto']
CurrencySymbol string
example: $

The currency symbol of the holding.
AveragePrice number
Average Price of our Holding in the currency the symbol is traded in.
Quantity number
Quantity of the Symbol we hold.
MarketPrice number
Current Market Price of the Asset in the currency the symbol is traded in.
ConversionRate number
Current market conversion rate into the account currency.
MarketValue number
Current market value of the holding.
UnrealizedPnl number
Current unrealized P/L of the holding.
Example
{
  "Symbol": {
    "Value": "string",
    "ID": "string",
    "Permtick": "string"
  },
  "Type": "Base",
  "CurrencySymbol": "$",
  "AveragePrice": 0,
  "Quantity": 0,
  "MarketPrice": 0,
  "ConversionRate": 0,
  "MarketValue": 0,
  "UnrealizedPnl": 0
}
Symbol Model - Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security.
Value string
The current symbol for this ticker.
ID string
The security identifier for this symbol.
Permtick string
The current symbol for this ticker.
Example
{
  "Value": "string",
  "ID": "string",
  "Permtick": "string"
}
SecurityType Model - Type of tradable security / underlying asset.
SecurityType string Enum
Type of tradable security / underlying asset. Options : ['Base', 'Equity', 'Option', 'Commodity', 'Forex', 'Future', 'Cfd', 'Crypto']
Example
{
  "SecurityType": "Base"
}
Cash Model - Represents a holding of a currency in cash.
Symbol string
Gets the symbol used to represent this cash.
Amount number
Gets or sets the amount of cash held.
ConversionRate number
The currency conversion rate to the account base currency.
CurrencySymbol object
The symbol of the currency, such as $.
ValueInAccountCurrency number
The value of the currency cash in the account base currency.
Example
{
  "Symbol": "string",
  "Amount": 0,
  "ConversionRate": 0,
  "CurrencySymbol": ,
  "ValueInAccountCurrency": 0
}

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: