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/portfolio/read 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/portfolio/read 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
Portfolio object with the holdings and cash information.
Example
{
  "portfolio": {
    "holdings": {
      "AAPL R735QTJ8XC9X": {
        "symbol": {
          "value": "string",
          "id": "string",
          "permtick": "string"
        },
        "type": "Base",
        "currencySymbol": "$",
        "averagePrice": 0,
        "quantity": 0,
        "marketPrice": 0,
        "conversionRate": 0,
        "marketValue": 0,
        "unrealizedPnl": 0
      }
    },
    "cash": {
      "USD": {
        "symbol": "string",
        "amount": 0,
        "conversionRate": 0,
        "currencySymbol": ,
        "valueInAccountCurrency": 0
      }
    }
  }
}
Portfolio Model - Portfolio object with the holdings and cash information.
holdings object
Dictionary of algorithm holdings information.
cash object
Dictionary of algorithm cash currencies information.
Example
{
  "holdings": {
    "AAPL R735QTJ8XC9X": {
      "symbol": {
        "value": "string",
        "id": "string",
        "permtick": "string"
      },
      "type": "Base",
      "currencySymbol": "$",
      "averagePrice": 0,
      "quantity": 0,
      "marketPrice": 0,
      "conversionRate": 0,
      "marketValue": 0,
      "unrealizedPnl": 0
    }
  },
  "cash": {
    "USD": {
      "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"
}
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: