Backtest Management

Create Backtest

Introduction

Create a new backtest request and get the backtest Id.

Request

Create a new backtest given a project Id and compile Id. The /backtests/create API accepts requests in the following format:

CreateBacktestRequest Model - Request to create a new backtest.
projectId integer
Project Id we sent for compile.
compileId string
Compile Id for the project to backtest.
backtestName string
Name for the new backtest.
Example
{
  "projectId": 0,
  "compileId": "string",
  "backtestName": "string"
}

Responses

The /backtests/create 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",
        "ChartType": "Overlay",
        "Series": {
          "Name": "string",
          "Unit": "string",
          "Index": 0,
          "Values": [
            {
              "x": "string",
              "y": 0
            }
          ],
          "SeriesType": "Line",
          "Color": "string",
          "ScatterMarkerSymbol": "none"
        }
      },
      "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": {
          "RiskFreeRate": 0,
          "AverageWinRate": 0,
          "AverageLossRate": 0,
          "ProfitLossRatio": 0,
          "WinRate": 0,
          "LossRate": 0,
          "Expectancy": 0,
          "CompoundingAnnualReturn": 0,
          "Drawdown": 0,
          "TotalNetProfit": 0,
          "SharpeRatio": 0,
          "ProbabilisticSharpeRatio": 0,
          "Alpha": 0,
          "Beta": 0,
          "AnnualStandardDeviation": 0,
          "AnnualVariance": 0,
          "InformationRatio": 0,
          "TrackingError": 0,
          "TreynorRatio": 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": {
        "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
      },
      "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": {
          "RiskFreeRate": 0,
          "AverageWinRate": 0,
          "AverageLossRate": 0,
          "ProfitLossRatio": 0,
          "WinRate": 0,
          "LossRate": 0,
          "Expectancy": 0,
          "CompoundingAnnualReturn": 0,
          "Drawdown": 0,
          "TotalNetProfit": 0,
          "SharpeRatio": 0,
          "ProbabilisticSharpeRatio": 0,
          "Alpha": 0,
          "Beta": 0,
          "AnnualStandardDeviation": 0,
          "AnnualVariance": 0,
          "InformationRatio": 0,
          "TrackingError": 0,
          "TreynorRatio": 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 Chart 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 TradeStatistics 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",
    "ChartType": "Overlay",
    "Series": {
      "Name": "string",
      "Unit": "string",
      "Index": 0,
      "Values": [
        {
          "x": "string",
          "y": 0
        }
      ],
      "SeriesType": "Line",
      "Color": "string",
      "ScatterMarkerSymbol": "none"
    }
  },
  "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": {
      "RiskFreeRate": 0,
      "AverageWinRate": 0,
      "AverageLossRate": 0,
      "ProfitLossRatio": 0,
      "WinRate": 0,
      "LossRate": 0,
      "Expectancy": 0,
      "CompoundingAnnualReturn": 0,
      "Drawdown": 0,
      "TotalNetProfit": 0,
      "SharpeRatio": 0,
      "ProbabilisticSharpeRatio": 0,
      "Alpha": 0,
      "Beta": 0,
      "AnnualStandardDeviation": 0,
      "AnnualVariance": 0,
      "InformationRatio": 0,
      "TrackingError": 0,
      "TreynorRatio": 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": {
    "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
  },
  "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": {
      "RiskFreeRate": 0,
      "AverageWinRate": 0,
      "AverageLossRate": 0,
      "ProfitLossRatio": 0,
      "WinRate": 0,
      "LossRate": 0,
      "Expectancy": 0,
      "CompoundingAnnualReturn": 0,
      "Drawdown": 0,
      "TotalNetProfit": 0,
      "SharpeRatio": 0,
      "ProbabilisticSharpeRatio": 0,
      "Alpha": 0,
      "Beta": 0,
      "AnnualStandardDeviation": 0,
      "AnnualVariance": 0,
      "InformationRatio": 0,
      "TrackingError": 0,
      "TreynorRatio": 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
}
Chart Model - Single Parent Chart Object for Custom Charting.
Name string
Name of the Chart.
ChartType string Enum
Type of the Chart, Overlayed or Stacked. Options : ['Overlay', 'Stacked']
Series Series object
List of Series Objects for this Chart.
Example
{
  "Name": "string",
  "ChartType": "Overlay",
  "Series": {
    "Name": "string",
    "Unit": "string",
    "Index": 0,
    "Values": [
      {
        "x": "string",
        "y": 0
      }
    ],
    "SeriesType": "Line",
    "Color": "string",
    "ScatterMarkerSymbol": "none"
  }
}
Series Model - Chart Series Object - Series data and properties for a chart.
Name string
Name of the series.
Unit string
Axis for the chart series.
Index integer
Index/position of the series on the chart.
Values ChartPoint Array
Values for the series plot. These values are assumed to be in ascending time order (first points earliest, last points latest).
SeriesType string Enum
Chart type for the series. Options : ['Line', 'Scatter', 'Candle', 'Bar', 'Flag', 'StackedArea', 'Pie', 'Treemap']
Color string
Color the series.
ScatterMarkerSymbol string Enum
Shape or symbol for the marker in a scatter plot. Options : ['none', 'circle', 'square', 'diamond', 'triangle', 'triangle-down']
Example
{
  "Name": "string",
  "Unit": "string",
  "Index": 0,
  "Values": [
    {
      "x": "string",
      "y": 0
    }
  ],
  "SeriesType": "Line",
  "Color": "string",
  "ScatterMarkerSymbol": "none"
}
ChartPoint Model - Location on a chart containing the X-Y location
x string
Time of this chart point: lower case for javascript encoding simplicty.
y number
Value of this chart point: lower case for javascript encoding simplicty.
Example
{
  "x": "string",
  "y": 0
}
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": {
    "RiskFreeRate": 0,
    "AverageWinRate": 0,
    "AverageLossRate": 0,
    "ProfitLossRatio": 0,
    "WinRate": 0,
    "LossRate": 0,
    "Expectancy": 0,
    "CompoundingAnnualReturn": 0,
    "Drawdown": 0,
    "TotalNetProfit": 0,
    "SharpeRatio": 0,
    "ProbabilisticSharpeRatio": 0,
    "Alpha": 0,
    "Beta": 0,
    "AnnualStandardDeviation": 0,
    "AnnualVariance": 0,
    "InformationRatio": 0,
    "TrackingError": 0,
    "TreynorRatio": 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.
RiskFreeRate number
The current defined risk free annual return rate.
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.
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.
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.
Example
{
  "RiskFreeRate": 0,
  "AverageWinRate": 0,
  "AverageLossRate": 0,
  "ProfitLossRatio": 0,
  "WinRate": 0,
  "LossRate": 0,
  "Expectancy": 0,
  "CompoundingAnnualReturn": 0,
  "Drawdown": 0,
  "TotalNetProfit": 0,
  "SharpeRatio": 0,
  "ProbabilisticSharpeRatio": 0,
  "Alpha": 0,
  "Beta": 0,
  "AnnualStandardDeviation": 0,
  "AnnualVariance": 0,
  "InformationRatio": 0,
  "TrackingError": 0,
  "TreynorRatio": 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"
}
TradeDirection Model - Direction of a trade.
TradeDirection string Enum
Direction of a trade. Options : ['Long', 'Short']
Example
{
  "TradeDirection": "Long"
}
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"
}

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: