Read Backtest

Backtest Statistics

Introduction

Read out that backtest from the project (optionally with the charts included).

Request

Fetch the results for the project Id and backtest Id provided (and optional chart name provided). The /backtests/read API accepts requests in the following format:

ReadBacktestRequest Model - Request to read a single backtest from a project.
projectId integer
Id of the project from which to read one or multiple backtests.
backtestId string
When provided, specific backtest Id to read.
chart string
Optional. If provided, the API will return the backtests charts.
Example
{
  "projectId": 0,
  "backtestId": "string",
  "chart": "string"
}

Responses

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

200 Success

BacktestResponse Model - Collection container for a list of backtests for a project.
backtest BacktestResult Array
Collection of backtests for a project.
debugging boolean
Indicates if the backtest is run under debugging mode.
success boolean
Indicate if the API request was successful.
errors string Array
List of errors with the API call.
Example
{
  "backtest": [
    {
      "note": "string",
      "name": "string",
      "organizationId": 0,
      "projectId": 0,
      "completed": true,
      "optimizationId": "string",
      "backtestId": "string",
      "tradeableDates": 0,
      "researchGuide": {
        "minutes": 0,
        "backtestCount": 0,
        "parameters": 0
      },
      "backtestStart": "2021-11-26T15:18:27.693Z",
      "backtestEnd": "2021-11-26T15:18:27.693Z",
      "created": "2021-11-26T15:18:27.693Z",
      "snapshotId": 0,
      "status": "Completed.",
      "error": "string",
      "stacktrace": "string",
      "progress": 0,
      "hasInitializeError": true,
      "charts": {
        "name": "string"
      },
      "parameterSet": {
        "name": "string",
        "value": 0
      },
      "rollingWindow": {
        "tradeStatistics": {
          "startDateTime": "2021-11-26T15:18:27.693Z",
          "endDateTime": "2021-11-26T15:18:27.693Z",
          "totalNumberOfTrades": 0,
          "numberOfWinningTrades": 0,
          "numberOfLosingTrades": 0,
          "totalProfitLoss": 0,
          "totalProfit": 0,
          "totalLoss": 0,
          "largestProfit": 0,
          "largestLoss": 0,
          "averageProfitLoss": 0,
          "averageProfit": 0,
          "averageLoss": 0,
          "averageTradeDuration": "string",
          "averageWinningTradeDuration": "string",
          "averageLosingTradeDuration": "string",
          "medianTradeDuration": "string",
          "medianWinningTradeDuration": "string",
          "medianLosingTradeDuration": "string",
          "maxConsecutiveWinningTrades": 0,
          "maxConsecutiveLosingTrades": 0,
          "profitLossRatio": 0,
          "winLossRatio": 0,
          "winRate": 0,
          "lossRate": 0,
          "averageMAE": 0,
          "averageMFE": 0,
          "largestMAE": 0,
          "largestMFE": 0,
          "maximumClosedTradeDrawdown": 0,
          "maximumIntraTradeDrawdown": 0,
          "profitLossStandardDeviation": 0,
          "profitLossDownsideDeviation": 0,
          "profitFactor": 0,
          "sharpeRatio": 0,
          "sortinoRatio": 0,
          "profitToMaxDrawdownRatio": 0,
          "maximumEndTradeDrawdown": 0,
          "averageEndTradeDrawdown": 0,
          "maximumDrawdownDuration": "string",
          "totalFees": 0
        },
        "portfolioStatistics": {
          "averageWinRate": 0,
          "averageLossRate": 0,
          "profitLossRatio": 0,
          "winRate": 0,
          "lossRate": 0,
          "expectancy": 0,
          "startEquity": 0,
          "endEquity": 0,
          "compoundingAnnualReturn": 0,
          "drawdown": 0,
          "totalNetProfit": 0,
          "sharpeRatio": 0,
          "probabilisticSharpeRatio": 0,
          "sortinoRatio": 0,
          "alpha": 0,
          "beta": 0,
          "annualStandardDeviation": 0,
          "annualVariance": 0,
          "informationRatio": 0,
          "trackingError": 0,
          "treynorRatio": 0,
          "portfolioTurnover": 0,
          "valueAtRisk99": 0,
          "valueAtRisk95": 0
        },
        "closedTrades": [
          {
            "symbol": {
              "value": "string",
              "id": "string",
              "permtick": "string"
            },
            "entryTime": "2021-11-26T15:18:27.693Z",
            "entryPrice": 0,
            "direction": "Long",
            "quantity": 0,
            "exitTime": "2021-11-26T15:18:27.693Z",
            "exitPrice": 0,
            "profitLoss": 0,
            "totalFees": 0,
            "mae": 0,
            "mfe": 0,
            "duration": "string",
            "endTradeDrawdown": 0
          }
        ]
      },
      "runtimeStatistics": {
        "Equity": "$100.00",
        "Fees": "-$100.00",
        "Holdings": "$100.00",
        "Net Profit": "$100.00",
        "Probabilistic Sharpe Ratio": "50.00%",
        "Return": "50.00%",
        "Unrealized": "$100.00",
        "Volume": "$100.00"
      },
      "statistics": {
        "Total Orders": "string",
        "Average Win": "string",
        "Average Loss": "string",
        "Compounding Annual Return": "string",
        "Drawdown": "string",
        "Expectancy": "string",
        "Start Equity": "string",
        "End Equity": "string",
        "Net Profit": "string",
        "Sharpe Ratio": "string",
        "Sortino Ratio": "string",
        "Probabilistic Sharpe Ratio": "string",
        "Loss Rate": "string",
        "Win Rate": "string",
        "Profit-Loss Ratio": "string",
        "Alpha": "string",
        "Beta": "string",
        "Annual Standard Deviation": "string",
        "Annual Variance": "string",
        "Information Ratio": "string",
        "Tracking Error": "string",
        "Treynor Ratio": "string",
        "Total Fees": "string",
        "Estimated Strategy Capacity": "string",
        "Lowest Capacity Asset": "string",
        "Portfolio Turnover": "string"
      },
      "totalPerformance": {
        "tradeStatistics": {
          "startDateTime": "2021-11-26T15:18:27.693Z",
          "endDateTime": "2021-11-26T15:18:27.693Z",
          "totalNumberOfTrades": 0,
          "numberOfWinningTrades": 0,
          "numberOfLosingTrades": 0,
          "totalProfitLoss": 0,
          "totalProfit": 0,
          "totalLoss": 0,
          "largestProfit": 0,
          "largestLoss": 0,
          "averageProfitLoss": 0,
          "averageProfit": 0,
          "averageLoss": 0,
          "averageTradeDuration": "string",
          "averageWinningTradeDuration": "string",
          "averageLosingTradeDuration": "string",
          "medianTradeDuration": "string",
          "medianWinningTradeDuration": "string",
          "medianLosingTradeDuration": "string",
          "maxConsecutiveWinningTrades": 0,
          "maxConsecutiveLosingTrades": 0,
          "profitLossRatio": 0,
          "winLossRatio": 0,
          "winRate": 0,
          "lossRate": 0,
          "averageMAE": 0,
          "averageMFE": 0,
          "largestMAE": 0,
          "largestMFE": 0,
          "maximumClosedTradeDrawdown": 0,
          "maximumIntraTradeDrawdown": 0,
          "profitLossStandardDeviation": 0,
          "profitLossDownsideDeviation": 0,
          "profitFactor": 0,
          "sharpeRatio": 0,
          "sortinoRatio": 0,
          "profitToMaxDrawdownRatio": 0,
          "maximumEndTradeDrawdown": 0,
          "averageEndTradeDrawdown": 0,
          "maximumDrawdownDuration": "string",
          "totalFees": 0
        },
        "portfolioStatistics": {
          "averageWinRate": 0,
          "averageLossRate": 0,
          "profitLossRatio": 0,
          "winRate": 0,
          "lossRate": 0,
          "expectancy": 0,
          "startEquity": 0,
          "endEquity": 0,
          "compoundingAnnualReturn": 0,
          "drawdown": 0,
          "totalNetProfit": 0,
          "sharpeRatio": 0,
          "probabilisticSharpeRatio": 0,
          "sortinoRatio": 0,
          "alpha": 0,
          "beta": 0,
          "annualStandardDeviation": 0,
          "annualVariance": 0,
          "informationRatio": 0,
          "trackingError": 0,
          "treynorRatio": 0,
          "portfolioTurnover": 0,
          "valueAtRisk99": 0,
          "valueAtRisk95": 0
        },
        "closedTrades": [
          {
            "symbol": {
              "value": "string",
              "id": "string",
              "permtick": "string"
            },
            "entryTime": "2021-11-26T15:18:27.693Z",
            "entryPrice": 0,
            "direction": "Long",
            "quantity": 0,
            "exitTime": "2021-11-26T15:18:27.693Z",
            "exitPrice": 0,
            "profitLoss": 0,
            "totalFees": 0,
            "mae": 0,
            "mfe": 0,
            "duration": "string",
            "endTradeDrawdown": 0
          }
        ]
      },
      "nodeName": "string",
      "outOfSampleMaxEndDate": "2021-11-26T15:18:27.693Z",
      "outOfSampleDays": 0
    }
  ],
  "debugging": true,
  "success": true,
  "errors": [
    "string"
  ]
}
BacktestResult Model - Results object class. Results are exhaust from backtest or live algorithms running in LEAN.
note string
Note on the backtest attached by the user.
name string
Name of the backtest.
organizationId integer
Organization ID.
projectId integer
Project ID.
completed boolean
Boolean true when the backtest is completed.
optimizationId string
Optimization task ID, if the backtest is part of an optimization.
backtestId string
Assigned backtest ID.
tradeableDates integer
Number of traadeable days.
researchGuide ResearchGuide object
A power gauge for backtests, time and parameters to estimate the overfitting risk.
backtestStart string($date-time)
The starting time of the backtest.
backtestEnd string($date-time)
The ending time of the backtest.
created string($date-time)
Backtest creation date and time.
snapshotId integer
Snapshot id of this backtest result.
status string Enum
Status of the backtest. Options : ['Completed.', 'In Queue...', "'Running: _%'"]
error string
Backtest error message.
stacktrace string
Backtest error stacktrace.
progress number
Progress of the backtest in percent 0-1.
hasInitializeError boolean
Indicates if the backtest has error during initialization.
charts ChartSummary object
Charts updates for the live algorithm since the last result packet.
parameterSet ParameterSet object
Parameters used in the backtest.
rollingWindow AlgorithmPerformance object
Rolling window detailed statistics.
runtimeStatistics RuntimeStatistics object
Runtime banner/updating statistics in the title banner of the live algorithm GUI.
statistics StatisticsResult object
Statistics information sent during the algorithm operations.
totalPerformance AlgorithmPerformance object
The algorithm performance statistics.
nodeName string
The backtest node name.
outOfSampleMaxEndDate string($date-time)
End date of out of sample data.
outOfSampleDays integer
Number of days of out of sample days.
Example
{
  "note": "string",
  "name": "string",
  "organizationId": 0,
  "projectId": 0,
  "completed": true,
  "optimizationId": "string",
  "backtestId": "string",
  "tradeableDates": 0,
  "researchGuide": {
    "minutes": 0,
    "backtestCount": 0,
    "parameters": 0
  },
  "backtestStart": "2021-11-26T15:18:27.693Z",
  "backtestEnd": "2021-11-26T15:18:27.693Z",
  "created": "2021-11-26T15:18:27.693Z",
  "snapshotId": 0,
  "status": "Completed.",
  "error": "string",
  "stacktrace": "string",
  "progress": 0,
  "hasInitializeError": true,
  "charts": {
    "name": "string"
  },
  "parameterSet": {
    "name": "string",
    "value": 0
  },
  "rollingWindow": {
    "tradeStatistics": {
      "startDateTime": "2021-11-26T15:18:27.693Z",
      "endDateTime": "2021-11-26T15:18:27.693Z",
      "totalNumberOfTrades": 0,
      "numberOfWinningTrades": 0,
      "numberOfLosingTrades": 0,
      "totalProfitLoss": 0,
      "totalProfit": 0,
      "totalLoss": 0,
      "largestProfit": 0,
      "largestLoss": 0,
      "averageProfitLoss": 0,
      "averageProfit": 0,
      "averageLoss": 0,
      "averageTradeDuration": "string",
      "averageWinningTradeDuration": "string",
      "averageLosingTradeDuration": "string",
      "medianTradeDuration": "string",
      "medianWinningTradeDuration": "string",
      "medianLosingTradeDuration": "string",
      "maxConsecutiveWinningTrades": 0,
      "maxConsecutiveLosingTrades": 0,
      "profitLossRatio": 0,
      "winLossRatio": 0,
      "winRate": 0,
      "lossRate": 0,
      "averageMAE": 0,
      "averageMFE": 0,
      "largestMAE": 0,
      "largestMFE": 0,
      "maximumClosedTradeDrawdown": 0,
      "maximumIntraTradeDrawdown": 0,
      "profitLossStandardDeviation": 0,
      "profitLossDownsideDeviation": 0,
      "profitFactor": 0,
      "sharpeRatio": 0,
      "sortinoRatio": 0,
      "profitToMaxDrawdownRatio": 0,
      "maximumEndTradeDrawdown": 0,
      "averageEndTradeDrawdown": 0,
      "maximumDrawdownDuration": "string",
      "totalFees": 0
    },
    "portfolioStatistics": {
      "averageWinRate": 0,
      "averageLossRate": 0,
      "profitLossRatio": 0,
      "winRate": 0,
      "lossRate": 0,
      "expectancy": 0,
      "startEquity": 0,
      "endEquity": 0,
      "compoundingAnnualReturn": 0,
      "drawdown": 0,
      "totalNetProfit": 0,
      "sharpeRatio": 0,
      "probabilisticSharpeRatio": 0,
      "sortinoRatio": 0,
      "alpha": 0,
      "beta": 0,
      "annualStandardDeviation": 0,
      "annualVariance": 0,
      "informationRatio": 0,
      "trackingError": 0,
      "treynorRatio": 0,
      "portfolioTurnover": 0,
      "valueAtRisk99": 0,
      "valueAtRisk95": 0
    },
    "closedTrades": [
      {
        "symbol": {
          "value": "string",
          "id": "string",
          "permtick": "string"
        },
        "entryTime": "2021-11-26T15:18:27.693Z",
        "entryPrice": 0,
        "direction": "Long",
        "quantity": 0,
        "exitTime": "2021-11-26T15:18:27.693Z",
        "exitPrice": 0,
        "profitLoss": 0,
        "totalFees": 0,
        "mae": 0,
        "mfe": 0,
        "duration": "string",
        "endTradeDrawdown": 0
      }
    ]
  },
  "runtimeStatistics": {
    "Equity": "$100.00",
    "Fees": "-$100.00",
    "Holdings": "$100.00",
    "Net Profit": "$100.00",
    "Probabilistic Sharpe Ratio": "50.00%",
    "Return": "50.00%",
    "Unrealized": "$100.00",
    "Volume": "$100.00"
  },
  "statistics": {
    "Total Orders": "string",
    "Average Win": "string",
    "Average Loss": "string",
    "Compounding Annual Return": "string",
    "Drawdown": "string",
    "Expectancy": "string",
    "Start Equity": "string",
    "End Equity": "string",
    "Net Profit": "string",
    "Sharpe Ratio": "string",
    "Sortino Ratio": "string",
    "Probabilistic Sharpe Ratio": "string",
    "Loss Rate": "string",
    "Win Rate": "string",
    "Profit-Loss Ratio": "string",
    "Alpha": "string",
    "Beta": "string",
    "Annual Standard Deviation": "string",
    "Annual Variance": "string",
    "Information Ratio": "string",
    "Tracking Error": "string",
    "Treynor Ratio": "string",
    "Total Fees": "string",
    "Estimated Strategy Capacity": "string",
    "Lowest Capacity Asset": "string",
    "Portfolio Turnover": "string"
  },
  "totalPerformance": {
    "tradeStatistics": {
      "startDateTime": "2021-11-26T15:18:27.693Z",
      "endDateTime": "2021-11-26T15:18:27.693Z",
      "totalNumberOfTrades": 0,
      "numberOfWinningTrades": 0,
      "numberOfLosingTrades": 0,
      "totalProfitLoss": 0,
      "totalProfit": 0,
      "totalLoss": 0,
      "largestProfit": 0,
      "largestLoss": 0,
      "averageProfitLoss": 0,
      "averageProfit": 0,
      "averageLoss": 0,
      "averageTradeDuration": "string",
      "averageWinningTradeDuration": "string",
      "averageLosingTradeDuration": "string",
      "medianTradeDuration": "string",
      "medianWinningTradeDuration": "string",
      "medianLosingTradeDuration": "string",
      "maxConsecutiveWinningTrades": 0,
      "maxConsecutiveLosingTrades": 0,
      "profitLossRatio": 0,
      "winLossRatio": 0,
      "winRate": 0,
      "lossRate": 0,
      "averageMAE": 0,
      "averageMFE": 0,
      "largestMAE": 0,
      "largestMFE": 0,
      "maximumClosedTradeDrawdown": 0,
      "maximumIntraTradeDrawdown": 0,
      "profitLossStandardDeviation": 0,
      "profitLossDownsideDeviation": 0,
      "profitFactor": 0,
      "sharpeRatio": 0,
      "sortinoRatio": 0,
      "profitToMaxDrawdownRatio": 0,
      "maximumEndTradeDrawdown": 0,
      "averageEndTradeDrawdown": 0,
      "maximumDrawdownDuration": "string",
      "totalFees": 0
    },
    "portfolioStatistics": {
      "averageWinRate": 0,
      "averageLossRate": 0,
      "profitLossRatio": 0,
      "winRate": 0,
      "lossRate": 0,
      "expectancy": 0,
      "startEquity": 0,
      "endEquity": 0,
      "compoundingAnnualReturn": 0,
      "drawdown": 0,
      "totalNetProfit": 0,
      "sharpeRatio": 0,
      "probabilisticSharpeRatio": 0,
      "sortinoRatio": 0,
      "alpha": 0,
      "beta": 0,
      "annualStandardDeviation": 0,
      "annualVariance": 0,
      "informationRatio": 0,
      "trackingError": 0,
      "treynorRatio": 0,
      "portfolioTurnover": 0,
      "valueAtRisk99": 0,
      "valueAtRisk95": 0
    },
    "closedTrades": [
      {
        "symbol": {
          "value": "string",
          "id": "string",
          "permtick": "string"
        },
        "entryTime": "2021-11-26T15:18:27.693Z",
        "entryPrice": 0,
        "direction": "Long",
        "quantity": 0,
        "exitTime": "2021-11-26T15:18:27.693Z",
        "exitPrice": 0,
        "profitLoss": 0,
        "totalFees": 0,
        "mae": 0,
        "mfe": 0,
        "duration": "string",
        "endTradeDrawdown": 0
      }
    ]
  },
  "nodeName": "string",
  "outOfSampleMaxEndDate": "2021-11-26T15:18:27.693Z",
  "outOfSampleDays": 0
}
ResearchGuide Model - A power gauge for backtests, time and parameters to estimate the overfitting risk.
minutes integer
Number of minutes used in developing the current backtest.
backtestCount integer
The quantity of backtests run in the project.
parameters integer
Number of parameters detected.
Example
{
  "minutes": 0,
  "backtestCount": 0,
  "parameters": 0
}
ChartSummary Model - Contains the names of all charts
name string
Name of the Chart.
Example
{
  "name": "string"
}
ParameterSet Model - Parameter set.
name string
Name of parameter.
value number
Value of parameter.
Example
{
  "name": "string",
  "value": 0
}
AlgorithmPerformance Model - The AlgorithmPerformance class is a wrapper for TradeStatistics and PortfolioStatistics.
tradeStatistics TradeStatistics object
A set of statistics calculated from a list of closed trades.
portfolioStatistics PortfolioStatistics object
Represents a set of statistics calculated from equity and benchmark samples.
closedTrades Trade Array
The algorithm statistics on portfolio.
Example
{
  "tradeStatistics": {
    "startDateTime": "2021-11-26T15:18:27.693Z",
    "endDateTime": "2021-11-26T15:18:27.693Z",
    "totalNumberOfTrades": 0,
    "numberOfWinningTrades": 0,
    "numberOfLosingTrades": 0,
    "totalProfitLoss": 0,
    "totalProfit": 0,
    "totalLoss": 0,
    "largestProfit": 0,
    "largestLoss": 0,
    "averageProfitLoss": 0,
    "averageProfit": 0,
    "averageLoss": 0,
    "averageTradeDuration": "string",
    "averageWinningTradeDuration": "string",
    "averageLosingTradeDuration": "string",
    "medianTradeDuration": "string",
    "medianWinningTradeDuration": "string",
    "medianLosingTradeDuration": "string",
    "maxConsecutiveWinningTrades": 0,
    "maxConsecutiveLosingTrades": 0,
    "profitLossRatio": 0,
    "winLossRatio": 0,
    "winRate": 0,
    "lossRate": 0,
    "averageMAE": 0,
    "averageMFE": 0,
    "largestMAE": 0,
    "largestMFE": 0,
    "maximumClosedTradeDrawdown": 0,
    "maximumIntraTradeDrawdown": 0,
    "profitLossStandardDeviation": 0,
    "profitLossDownsideDeviation": 0,
    "profitFactor": 0,
    "sharpeRatio": 0,
    "sortinoRatio": 0,
    "profitToMaxDrawdownRatio": 0,
    "maximumEndTradeDrawdown": 0,
    "averageEndTradeDrawdown": 0,
    "maximumDrawdownDuration": "string",
    "totalFees": 0
  },
  "portfolioStatistics": {
    "averageWinRate": 0,
    "averageLossRate": 0,
    "profitLossRatio": 0,
    "winRate": 0,
    "lossRate": 0,
    "expectancy": 0,
    "startEquity": 0,
    "endEquity": 0,
    "compoundingAnnualReturn": 0,
    "drawdown": 0,
    "totalNetProfit": 0,
    "sharpeRatio": 0,
    "probabilisticSharpeRatio": 0,
    "sortinoRatio": 0,
    "alpha": 0,
    "beta": 0,
    "annualStandardDeviation": 0,
    "annualVariance": 0,
    "informationRatio": 0,
    "trackingError": 0,
    "treynorRatio": 0,
    "portfolioTurnover": 0,
    "valueAtRisk99": 0,
    "valueAtRisk95": 0
  },
  "closedTrades": [
    {
      "symbol": {
        "value": "string",
        "id": "string",
        "permtick": "string"
      },
      "entryTime": "2021-11-26T15:18:27.693Z",
      "entryPrice": 0,
      "direction": "Long",
      "quantity": 0,
      "exitTime": "2021-11-26T15:18:27.693Z",
      "exitPrice": 0,
      "profitLoss": 0,
      "totalFees": 0,
      "mae": 0,
      "mfe": 0,
      "duration": "string",
      "endTradeDrawdown": 0
    }
  ]
}
TradeStatistics Model - A set of statistics calculated from a list of closed trades.
startDateTime string($date-time)
The entry date/time of the first trade.
endDateTime string($date-time)
The exit date/time of the first trade.
totalNumberOfTrades integer
The total number of trades.
numberOfWinningTrades integer
The total number of winning trades.
numberOfLosingTrades integer
The total number of losing trades.
totalProfitLoss number
The total profit/loss for all trades (as symbol currency).
totalProfit number
The total profit for all winning trades (as symbol currency).
totalLoss number
The total loss for all losing trades (as symbol currency).
largestProfit number
The largest profit in a single trade (as symbol currency).
largestLoss number
The largest loss in a single trade (as symbol currency).
averageProfitLoss number
The average profit/loss (a.k.a. Expectancy or Average Trade) for all trades (as symbol currency).
averageProfit number
The average profit for all winning trades (as symbol currency).
averageLoss number
The average loss for all winning trades (as symbol currency).
averageTradeDuration string
The average duration for all trades.
averageWinningTradeDuration string
The average duration for all winning trades.
averageLosingTradeDuration string
The average duration for all losing trades.
medianTradeDuration string
The median duration for all trades.
medianWinningTradeDuration string
The median duration for all winning trades.
medianLosingTradeDuration string
The median duration for all losing trades.
maxConsecutiveWinningTrades integer
The maximum number of consecutive winning trades.
maxConsecutiveLosingTrades integer
The maximum number of consecutive losing trades.
profitLossRatio number
The ratio of the average profit per trade to the average loss per trade.
winLossRatio number
The ratio of the number of winning trades to the number of losing trades.
winRate number
The ratio of the number of winning trades to the total number of trades.
lossRate number
The ratio of the number of losing trades to the total number of trades.
averageMAE number
The average Maximum Adverse Excursion for all trades.
averageMFE number
The average Maximum Adverse Excursion for all trades.
largestMAE number
The average Maximum Favorable Excursion for all trades.
largestMFE number
The largest Maximum Adverse Excursion in a single trade (as symbol currency).
maximumClosedTradeDrawdown number
The maximum closed-trade drawdown for all trades (as symbol currency).
maximumIntraTradeDrawdown number
The maximum intra-trade drawdown for all trades (as symbol currency).
profitLossStandardDeviation number
The standard deviation of the profits/losses for all trades (as symbol currency).
profitLossDownsideDeviation number
The downside deviation of the profits/losses for all trades (as symbol currency).
profitFactor number
The ratio of the total profit to the total loss.
sharpeRatio number
The ratio of the average profit/loss to the standard deviation.
sortinoRatio number
The ratio of the average profit/loss to the downside deviation.
profitToMaxDrawdownRatio number
The ratio of the total profit/loss to the maximum closed trade drawdown.
maximumEndTradeDrawdown number
The maximum amount of profit given back by a single trade before exit (as symbol currency).
averageEndTradeDrawdown number
The average amount of profit given back by all trades before exit (as symbol currency).
maximumDrawdownDuration string
The maximum amount of time to recover from a drawdown (longest time between new equity highs or peaks).
totalFees number
The sum of fees for all trades.
Example
{
  "startDateTime": "2021-11-26T15:18:27.693Z",
  "endDateTime": "2021-11-26T15:18:27.693Z",
  "totalNumberOfTrades": 0,
  "numberOfWinningTrades": 0,
  "numberOfLosingTrades": 0,
  "totalProfitLoss": 0,
  "totalProfit": 0,
  "totalLoss": 0,
  "largestProfit": 0,
  "largestLoss": 0,
  "averageProfitLoss": 0,
  "averageProfit": 0,
  "averageLoss": 0,
  "averageTradeDuration": "string",
  "averageWinningTradeDuration": "string",
  "averageLosingTradeDuration": "string",
  "medianTradeDuration": "string",
  "medianWinningTradeDuration": "string",
  "medianLosingTradeDuration": "string",
  "maxConsecutiveWinningTrades": 0,
  "maxConsecutiveLosingTrades": 0,
  "profitLossRatio": 0,
  "winLossRatio": 0,
  "winRate": 0,
  "lossRate": 0,
  "averageMAE": 0,
  "averageMFE": 0,
  "largestMAE": 0,
  "largestMFE": 0,
  "maximumClosedTradeDrawdown": 0,
  "maximumIntraTradeDrawdown": 0,
  "profitLossStandardDeviation": 0,
  "profitLossDownsideDeviation": 0,
  "profitFactor": 0,
  "sharpeRatio": 0,
  "sortinoRatio": 0,
  "profitToMaxDrawdownRatio": 0,
  "maximumEndTradeDrawdown": 0,
  "averageEndTradeDrawdown": 0,
  "maximumDrawdownDuration": "string",
  "totalFees": 0
}
PortfolioStatistics Model - Represents a set of statistics calculated from equity and benchmark samples.
averageWinRate number
The average rate of return for winning trades.
averageLossRate number
The average rate of return for losing trades.
profitLossRatio number
The ratio of the average win rate to the average loss rate.
winRate number
The ratio of the number of winning trades to the total number of trades.
lossRate number
The ratio of the number of losing trades to the total number of trades.
expectancy number
The expected value of the rate of return.
startEquity number
Initial Equity Total Value.
endEquity number
Final Equity Total Value.
compoundingAnnualReturn number
Annual compounded returns statistic based on the final-starting capital and years.
drawdown number
Drawdown maximum percentage.
totalNetProfit number
The total net profit percentage.
sharpeRatio number
Sharpe ratio with respect to risk free rate: measures excess of return per unit of risk.
probabilisticSharpeRatio number
Probabilistic Sharpe Ratio is a probability measure associated with the Sharpe ratio. It informs us of the probability that the estimated Sharpe ratio is greater than a chosen benchmark.
sortinoRatio number
Sortino ratio with respect to risk free rate; measures excess of return per unit of downside risk.
alpha number
Algorithm "Alpha" statistic - abnormal returns over the risk free rate and the relationshio (beta) with the benchmark returns.
beta number
Algorithm beta statistic - the covariance between the algorithm and benchmark performance, divided by benchmark variance.
annualStandardDeviation number
Annualized standard deviation.
annualVariance number
Annualized variance statistic calculation using the daily performance variance and trading days per year.
informationRatio number
Information ratio - risk adjusted return.
trackingError number
Tracking error volatility (TEV) statistic - a measure of how closely a portfolio follows the index to which it is benchmarked.
treynorRatio number
Treynor ratio statistic is a measurement of the returns earned in excess of that which could have been earned on an investment that has no diversifiable risk.
portfolioTurnover number
The average Portfolio Turnover.
valueAtRisk99 number
The 1-day VaR for the portfolio, using the Variance-covariance approach. Assumes a 99% confidence level, 1 year lookback period, and that the returns are normally distributed.
valueAtRisk95 number
The 1-day VaR for the portfolio, using the Variance-covariance approach. Assumes a 95% confidence level, 1 year lookback period, and that the returns are normally distributed.
Example
{
  "averageWinRate": 0,
  "averageLossRate": 0,
  "profitLossRatio": 0,
  "winRate": 0,
  "lossRate": 0,
  "expectancy": 0,
  "startEquity": 0,
  "endEquity": 0,
  "compoundingAnnualReturn": 0,
  "drawdown": 0,
  "totalNetProfit": 0,
  "sharpeRatio": 0,
  "probabilisticSharpeRatio": 0,
  "sortinoRatio": 0,
  "alpha": 0,
  "beta": 0,
  "annualStandardDeviation": 0,
  "annualVariance": 0,
  "informationRatio": 0,
  "trackingError": 0,
  "treynorRatio": 0,
  "portfolioTurnover": 0,
  "valueAtRisk99": 0,
  "valueAtRisk95": 0
}
Trade Model - Represents a closed trade.
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.
entryTime string($date-time)
The date and time the trade was opened.
entryPrice number
The price at which the trade was opened (or the average price if multiple entries).
direction string Enum
Direction of a trade. Options : ['Long', 'Short']
quantity number
The total unsigned quantity of the trade.
exitTime string($date-time)
The date and time the trade was closed.
exitPrice number
The price at which the trade was closed (or the average price if multiple exits).
profitLoss number
The gross profit/loss of the trade (as account currency).
totalFees number
The total fees associated with the trade (always positive value) (as account currency).
mae number
The Maximum Adverse Excursion (as account currency).
mfe number
The Maximum Favorable Excursion (as account currency).
duration string
The duration of the trade.
endTradeDrawdown number
The amount of profit given back before the trade was closed.
Example
{
  "symbol": {
    "value": "string",
    "id": "string",
    "permtick": "string"
  },
  "entryTime": "2021-11-26T15:18:27.693Z",
  "entryPrice": 0,
  "direction": "Long",
  "quantity": 0,
  "exitTime": "2021-11-26T15:18:27.693Z",
  "exitPrice": 0,
  "profitLoss": 0,
  "totalFees": 0,
  "mae": 0,
  "mfe": 0,
  "duration": "string",
  "endTradeDrawdown": 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"
}
RuntimeStatistics Model
Equity string
example: $100.00

Total portfolio value.
Fees string
example: -$100.00

Transaction fee.
Holdings string
example: $100.00

Equity value of security holdings.
Net Profit string
example: $100.00

Net profit.
Probabilistic Sharpe Ratio string
example: 50.00%

Probabilistic Sharpe Ratio.
Return string
example: 50.00%

Return.
Unrealized string
example: $100.00

Unrealized profit/loss.
Volume string
example: $100.00

Total transaction volume.
Example
{
  "Equity": "$100.00",
  "Fees": "-$100.00",
  "Holdings": "$100.00",
  "Net Profit": "$100.00",
  "Probabilistic Sharpe Ratio": "50.00%",
  "Return": "50.00%",
  "Unrealized": "$100.00",
  "Volume": "$100.00"
}
StatisticsResult Model - Statistics information sent during the algorithm operations.
Total Orders string
Total nuber of orders.
Average Win string
The average rate of return for winning trades.
Average Loss string
The average rate of return for losing trades.
Compounding Annual Return string
Annual compounded returns statistic based on the final-starting capital and years.
Drawdown string
Drawdown maximum percentage.
Expectancy string
The expected value of the rate of return.
Start Equity string
Initial Equity Total Value.
End Equity string
Final Equity Total Value.
Net Profit string
The total net profit percentage.
Sharpe Ratio string
Sharpe ratio with respect to risk free rate; measures excess of return per unit of risk.
Sortino Ratio string
Sortino ratio with respect to risk free rate; measures excess of return per unit of downside risk.
Probabilistic Sharpe Ratio string
Is a probability measure associated with the Sharpe ratio. It informs us of the probability that the estimated Sharpe ratio is greater than a chosen benchmark.
Loss Rate string
The ratio of the number of losing trades to the total number of trades.
Win Rate string
The ratio of the number of winning trades to the total number of trades.
Profit-Loss Ratio string
The ratio of the average win rate to the average loss rate.
Alpha string
Algorithm "Alpha" statistic - abnormal returns over the risk free rate and the relationshio (beta) with the benchmark returns.
Beta string
Algorithm "beta" statistic - the covariance between the algorithm and benchmark performance, divided by benchmark's variance.
Annual Standard Deviation string
Annualized standard deviation.
Annual Variance string
Annualized variance statistic calculation using the daily performance variance and trading days per year.
Information Ratio string
Information ratio - risk adjusted return.
Tracking Error string
Tracking error volatility (TEV) statistic - a measure of how closely a portfolio follows the index to which it is benchmarked.
Treynor Ratio string
Treynor ratio statistic is a measurement of the returns earned in excess of that which could have been earned on an investment that has no diversifiable risk.
Total Fees string
Total amount of fees.
Estimated Strategy Capacity string
The estimated total capacity of the strategy at a point in time.
Lowest Capacity Asset string
Provide a reference to the lowest capacity symbol used in scaling down the capacity for debugging.
Portfolio Turnover string
The average Portfolio Turnover.
Example
{
  "Total Orders": "string",
  "Average Win": "string",
  "Average Loss": "string",
  "Compounding Annual Return": "string",
  "Drawdown": "string",
  "Expectancy": "string",
  "Start Equity": "string",
  "End Equity": "string",
  "Net Profit": "string",
  "Sharpe Ratio": "string",
  "Sortino Ratio": "string",
  "Probabilistic Sharpe Ratio": "string",
  "Loss Rate": "string",
  "Win Rate": "string",
  "Profit-Loss Ratio": "string",
  "Alpha": "string",
  "Beta": "string",
  "Annual Standard Deviation": "string",
  "Annual Variance": "string",
  "Information Ratio": "string",
  "Tracking Error": "string",
  "Treynor Ratio": "string",
  "Total Fees": "string",
  "Estimated Strategy Capacity": "string",
  "Lowest Capacity Asset": "string",
  "Portfolio Turnover": "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: