Optimization Management
Create Optimization
Request
Project, compile and optimization parameters for launching an optimization job. The /optimizations/create
API accepts requests in the following format:
CreateOptimizationRequest Model - Request to create an optimization job. | |
---|---|
projectId | integer Project ID of the project the optimization belongs to. |
name | string Name of the optimization. |
target | string Target of the optimization. |
targetTo | string Target extremum of the optimization. |
targetValue | float Optimization target value. |
strategy | string Optimization strategy. |
compileId | string Optimization compile ID. |
parameters | OptimizationParameter Array Optimization parameters. |
constraints | OptimizationConstraint Array Optimization constraints. |
estimatedCost | float Estimated cost for optimization. |
nodeType | string Enum Optimization node type. Options : ['O2-8', 'O4-12', 'O8-16'] |
parallelNodes | integer Number of parallel nodes for optimization. |
Example |
{ "projectId": 0, "name": "string", "target": "string", "targetTo": "max or min", "targetValue": , "strategy": "QuantConnect.Optimizer.Strategies.GridSearchOptimizationStrategy", "compileId": "string", "parameters": [ { "name": "rsi_period", "min": 10, "max": 20, "step": 1, "minStep": 1 } ], "constraints": [ { "target": "TotalPerformance.PortfolioStatistics.SharpeRatio", "operator": "greater", "targetValue": 1 } ], "estimatedCost": 10, "nodeType": "O2-8", "parallelNodes": 4 } |
OptimizationParameter Model | |
---|---|
name | string Name of optimization parameter. |
min | float Minimum value of optimization parameter, applicable for boundary conditions. |
max | float Maximum value of optimization parameter, applicable for boundary conditions. |
step | float Movement, should be positive. |
minStep | float Minimal possible movement for current parameter, should be positive. Used by Strategies.EulerSearchOptimizationStrategy to determine when this parameter can no longer be optimized. |
Example |
{ "name": "rsi_period", "min": 10, "max": 20, "step": 1, "minStep": 1 } |
OptimizationConstraint Model | |
---|---|
target | string Property we want to track. |
operator | string The target comparison operation. |
targetValue | float The value of the property we want to track. |
Example |
{ "target": "TotalPerformance.PortfolioStatistics.SharpeRatio", "operator": "greater", "targetValue": 1 } |
Responses
The /optimizations/create
API provides a response in the following format:
200 Success
ListOptimizationResponse Model - Response received when listing optimizations of a project. | |
---|---|
optimizations | CreateOptimizationResponse Array Collection of summarized optimization objects. |
success | boolean Indicate if the API request was successful. |
errors | string Array List of errors with the API call. |
Example |
{ "optimizations": [ { "optimizationId": "string", "projectId": "string", "name": "string", "status": "New", "nodeType": "O2-8", "criterion": { "target": "TotalPerformance.PortfolioStatistics.SharpeRatio", "extremum": "max or min", "targetValue": 1 }, "created": "2021-11-26T15:18:27.693Z", "psr": 0, "sharpeRatio": 0, "trades": 0, "cloneId": 0, "outOfSampleDays": 0, "outOfSampleMaxEndDate": "2021-11-26T15:18:27.693Z", "parameters": [ "object" ] } ], "success": true, "errors": [ "string" ] } |
CreateOptimizationResponse Model - Response received when launching an optimization job. | |
---|---|
optimizationId | string Optimization ID. |
projectId | string Project ID of the project the optimization belongs to. |
name | string Name of the optimization. |
status | string Enum Status of the optimization. Options : ['New', 'Aborted', 'Running', 'Completed'] |
nodeType | string Enum Optimization node type. Options : ['O2-8', 'O4-12', 'O8-16'] |
criterion | OptimizationTarget object /. |
created | string($date-time) Date when this optimization was created. |
psr | number Price-sales ratio stastic. |
sharpeRatio | number Sharpe ratio statistic. |
trades | integer Number of trades. |
cloneId | integer ID of project, were this current project was originally cloned. |
outOfSampleDays | integer Number of days of out of sample days. |
outOfSampleMaxEndDate | string($date-time) End date of out of sample data. |
parameters | object Array Parameters used in this optimization. |
Example |
{ "optimizationId": "string", "projectId": "string", "name": "string", "status": "New", "nodeType": "O2-8", "criterion": { "target": "TotalPerformance.PortfolioStatistics.SharpeRatio", "extremum": "max or min", "targetValue": 1 }, "created": "2021-11-26T15:18:27.693Z", "psr": 0, "sharpeRatio": 0, "trades": 0, "cloneId": 0, "outOfSampleDays": 0, "outOfSampleMaxEndDate": "2021-11-26T15:18:27.693Z", "parameters": [ "object" ] } |
OptimizationTarget Model | |
---|---|
target | string Property we want to track. |
extremum | string Defines the direction of optimization. |
targetValue | float The value of the property we want to track. |
Example |
{ "target": "TotalPerformance.PortfolioStatistics.SharpeRatio", "extremum": "max or min", "targetValue": 1 } |
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 |