Lean
$LEAN_TAG$
|
API for QuantConnect.com More...
Public Member Functions | |
void | Initialize (int userId, string token, string dataFolder) |
Initialize the control system More... | |
ProjectResponse | CreateProject (string name, Language language, string organizationId=null) |
Create a project with the specified name and language via QuantConnect.com API More... | |
ProjectResponse | ReadProject (int projectId) |
Read in a project from the QuantConnect.com API. More... | |
ProjectFilesResponse | AddProjectFile (int projectId, string name, string content) |
Add a file to a project More... | |
RestResponse | UpdateProjectFileName (int projectId, string oldFileName, string newFileName) |
Update the name of a file More... | |
RestResponse | UpdateProjectFileContent (int projectId, string fileName, string newFileContents) |
Update the contents of a file More... | |
ProjectFilesResponse | ReadProjectFile (int projectId, string fileName) |
Read a file in a project More... | |
ProjectFilesResponse | ReadProjectFiles (int projectId) |
Read all files in a project More... | |
ProjectNodesResponse | ReadProjectNodes (int projectId) |
Read all nodes in a project. More... | |
ProjectNodesResponse | UpdateProjectNodes (int projectId, string[] nodes) |
Update the active state of some nodes to true. If you don't provide any nodes, all the nodes become inactive and AutoSelectNode is true. More... | |
RestResponse | DeleteProjectFile (int projectId, string name) |
Delete a file in a project More... | |
RestResponse | DeleteProject (int projectId) |
Delete a specific project owned by the user from QuantConnect.com More... | |
ProjectResponse | ListProjects () |
Read back a list of all projects on the account for a user. More... | |
Compile | CreateCompile (int projectId) |
Create a new compile job request for this project id. More... | |
Compile | ReadCompile (int projectId, string compileId) |
Read a compile packet job result. More... | |
Backtest | CreateBacktest (int projectId, string compileId, string backtestName) |
Create a new backtest from a specified projectId and compileId More... | |
Backtest | ReadBacktest (int projectId, string backtestId, bool getCharts=true) |
Read out the full result of a specific backtest More... | |
RestResponse | UpdateBacktest (int projectId, string backtestId, string backtestName="", string backtestNote="") |
Update the backtest name More... | |
RestResponse | DeleteBacktest (int projectId, string backtestId) |
Delete a backtest from the specified project and backtestId. More... | |
BacktestList | ListBacktests (int projectId) |
Get a list of backtests for a specific project id More... | |
Estimate | EstimateOptimization (int projectId, string name, string target, string targetTo, decimal? targetValue, string strategy, string compileId, HashSet< OptimizationParameter > parameters, IReadOnlyList< Constraint > constraints) |
Estimate optimization with the specified parameters via QuantConnect.com API More... | |
BaseOptimization | CreateOptimization (int projectId, string name, string target, string targetTo, decimal? targetValue, string strategy, string compileId, HashSet< OptimizationParameter > parameters, IReadOnlyList< Constraint > constraints, decimal estimatedCost, string nodeType, int parallelNodes) |
Create an optimization with the specified parameters via QuantConnect.com API More... | |
List< BaseOptimization > | ListOptimizations (int projectId) |
List all the optimizations for a project More... | |
Optimization | ReadOptimization (string optimizationId) |
Read an optimization More... | |
RestResponse | AbortOptimization (string optimizationId) |
Abort an optimization More... | |
RestResponse | UpdateOptimization (string optimizationId, string name=null) |
Update an optimization More... | |
RestResponse | DeleteOptimization (string optimizationId) |
Delete an optimization More... | |
LiveLog | ReadLiveLogs (int projectId, string algorithmId, DateTime? startTime=null, DateTime? endTime=null) |
Gets the logs of a specific live algorithm More... | |
DataLink | ReadDataLink (string filePath, string organizationId) |
Gets the link to the downloadable data. More... | |
DataList | ReadDataDirectory (string filePath) |
Get valid data entries for a given filepath from data/list More... | |
DataPricesList | ReadDataPrices (string organizationId) |
Gets data prices from data/prices More... | |
BacktestReport | ReadBacktestReport (int projectId, string backtestId) |
Read out the report of a backtest in the project id specified. More... | |
bool | DownloadData (string filePath, string organizationId) |
Method to download and save the data purchased through QuantConnect More... | |
Account | ReadAccount (string organizationId=null) |
Will read the organization account status More... | |
List< Organization > | ListOrganizations () |
Get a list of organizations tied to this account More... | |
Organization | ReadOrganization (string organizationId=null) |
Fetch organization data from web API More... | |
LiveAlgorithm | CreateLiveAlgorithm (int projectId, string compileId, string serverType, BaseLiveAlgorithmSettings baseLiveAlgorithmSettings, string versionId="-1") |
Create a new live algorithm for a logged in user. More... | |
LiveList | ListLiveAlgorithms (AlgorithmStatus? status=null, DateTime? startTime=null, DateTime? endTime=null) |
Get a list of live running algorithms for a logged in user. More... | |
LiveAlgorithmResults | ReadLiveAlgorithm (int projectId, string deployId) |
Read out a live algorithm in the project id specified. More... | |
RestResponse | LiquidateLiveAlgorithm (int projectId) |
Liquidate a live algorithm from the specified project. More... | |
RestResponse | StopLiveAlgorithm (int projectId) |
Stop a live algorithm from the specified project. More... | |
RestResponse | SendNotification (Notification notification, int projectId) |
Sends a notification More... | |
AlgorithmControl | GetAlgorithmStatus (string algorithmId) |
Get the algorithm current status, active or cancelled from the user More... | |
void | SetAlgorithmStatus (string algorithmId, AlgorithmStatus status, string message="") |
Set the algorithm status from the worker to update the UX e.g. if there was an error. More... | |
void | SendStatistics (string algorithmId, decimal unrealized, decimal fees, decimal netProfit, decimal holdings, decimal equity, decimal netReturn, decimal volume, int trades, double sharpe) |
Send the statistics to storage for performance tracking. More... | |
void | SendUserEmail (string algorithmId, string subject, string body) |
Send an email to the user associated with the specified algorithm id More... | |
string | Download (string address, IEnumerable< KeyValuePair< string, string >> headers, string userName, string password) |
Local implementation for downloading data to algorithms More... | |
void QuantConnect.Interfaces.IApi.Initialize | ( | int | userId, |
string | token, | ||
string | dataFolder | ||
) |
Initialize the control system
Implemented in QuantConnect.Api.Api.
ProjectResponse QuantConnect.Interfaces.IApi.CreateProject | ( | string | name, |
Language | language, | ||
string | organizationId = null |
||
) |
Create a project with the specified name and language via QuantConnect.com API
name | Project name |
language | Programming language to use |
organizationId | Organization to create this project under |
Implemented in QuantConnect.Api.Api.
ProjectResponse QuantConnect.Interfaces.IApi.ReadProject | ( | int | projectId | ) |
Read in a project from the QuantConnect.com API.
projectId | Project id you own |
Implemented in QuantConnect.Api.Api.
ProjectFilesResponse QuantConnect.Interfaces.IApi.AddProjectFile | ( | int | projectId, |
string | name, | ||
string | content | ||
) |
Add a file to a project
projectId | The project to which the file should be added |
name | The name of the new file |
content | The content of the new file |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.UpdateProjectFileName | ( | int | projectId, |
string | oldFileName, | ||
string | newFileName | ||
) |
Update the name of a file
projectId | Project id to which the file belongs |
oldFileName | The current name of the file |
newFileName | The new name for the file |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.UpdateProjectFileContent | ( | int | projectId, |
string | fileName, | ||
string | newFileContents | ||
) |
Update the contents of a file
projectId | Project id to which the file belongs |
fileName | The name of the file that should be updated |
newFileContents | The new contents of the file |
Implemented in QuantConnect.Api.Api.
ProjectFilesResponse QuantConnect.Interfaces.IApi.ReadProjectFile | ( | int | projectId, |
string | fileName | ||
) |
Read a file in a project
projectId | Project id to which the file belongs |
fileName | The name of the file |
Implemented in QuantConnect.Api.Api.
ProjectFilesResponse QuantConnect.Interfaces.IApi.ReadProjectFiles | ( | int | projectId | ) |
Read all files in a project
projectId | Project id to which the file belongs |
Implemented in QuantConnect.Api.Api.
ProjectNodesResponse QuantConnect.Interfaces.IApi.ReadProjectNodes | ( | int | projectId | ) |
Read all nodes in a project.
projectId | Project id to which the nodes refer |
Implemented in QuantConnect.Api.Api.
ProjectNodesResponse QuantConnect.Interfaces.IApi.UpdateProjectNodes | ( | int | projectId, |
string[] | nodes | ||
) |
Update the active state of some nodes to true. If you don't provide any nodes, all the nodes become inactive and AutoSelectNode is true.
projectId | Project id to which the nodes refer |
nodes | List of node ids to update |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.DeleteProjectFile | ( | int | projectId, |
string | name | ||
) |
Delete a file in a project
projectId | Project id to which the file belongs |
name | The name of the file that should be deleted |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.DeleteProject | ( | int | projectId | ) |
Delete a specific project owned by the user from QuantConnect.com
projectId | Project id we own and wish to delete |
Implemented in QuantConnect.Api.Api.
ProjectResponse QuantConnect.Interfaces.IApi.ListProjects | ( | ) |
Read back a list of all projects on the account for a user.
Implemented in QuantConnect.Api.Api.
Compile QuantConnect.Interfaces.IApi.CreateCompile | ( | int | projectId | ) |
Create a new compile job request for this project id.
projectId | Project id we wish to compile. |
Implemented in QuantConnect.Api.Api.
Compile QuantConnect.Interfaces.IApi.ReadCompile | ( | int | projectId, |
string | compileId | ||
) |
Read a compile packet job result.
projectId | Project id we sent for compile |
compileId | Compile id return from the creation request |
Implemented in QuantConnect.Api.Api.
Backtest QuantConnect.Interfaces.IApi.CreateBacktest | ( | int | projectId, |
string | compileId, | ||
string | backtestName | ||
) |
Create a new backtest from a specified projectId and compileId
projectId | |
compileId | |
backtestName |
Implemented in QuantConnect.Api.Api.
Backtest QuantConnect.Interfaces.IApi.ReadBacktest | ( | int | projectId, |
string | backtestId, | ||
bool | getCharts = true |
||
) |
Read out the full result of a specific backtest
projectId | Project id for the backtest we'd like to read |
backtestId | Backtest id for the backtest we'd like to read |
getCharts | True will return backtest charts |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.UpdateBacktest | ( | int | projectId, |
string | backtestId, | ||
string | backtestName = "" , |
||
string | backtestNote = "" |
||
) |
Update the backtest name
projectId | Project id to update |
backtestId | Backtest id to update |
backtestName | New backtest name to set |
backtestNote | Note attached to the backtest |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.DeleteBacktest | ( | int | projectId, |
string | backtestId | ||
) |
Delete a backtest from the specified project and backtestId.
projectId | Project for the backtest we want to delete |
backtestId | Backtest id we want to delete |
Implemented in QuantConnect.Api.Api.
BacktestList QuantConnect.Interfaces.IApi.ListBacktests | ( | int | projectId | ) |
Get a list of backtests for a specific project id
projectId | Project id to search |
Implemented in QuantConnect.Api.Api.
Estimate QuantConnect.Interfaces.IApi.EstimateOptimization | ( | int | projectId, |
string | name, | ||
string | target, | ||
string | targetTo, | ||
decimal? | targetValue, | ||
string | strategy, | ||
string | compileId, | ||
HashSet< OptimizationParameter > | parameters, | ||
IReadOnlyList< Constraint > | constraints | ||
) |
Estimate optimization with the specified parameters via QuantConnect.com API
projectId | Project ID of the project the optimization belongs to |
name | Name of the optimization |
target | Target of the optimization, see examples in PortfolioStatistics |
targetTo | Target extremum of the optimization, for example "max" or "min" |
targetValue | Optimization target value |
strategy | Optimization strategy, GridSearchOptimizationStrategy |
compileId | Optimization compile ID |
parameters | Optimization parameters |
constraints | Optimization constraints |
Implemented in QuantConnect.Api.Api.
BaseOptimization QuantConnect.Interfaces.IApi.CreateOptimization | ( | int | projectId, |
string | name, | ||
string | target, | ||
string | targetTo, | ||
decimal? | targetValue, | ||
string | strategy, | ||
string | compileId, | ||
HashSet< OptimizationParameter > | parameters, | ||
IReadOnlyList< Constraint > | constraints, | ||
decimal | estimatedCost, | ||
string | nodeType, | ||
int | parallelNodes | ||
) |
Create an optimization with the specified parameters via QuantConnect.com API
projectId | Project ID of the project the optimization belongs to |
name | Name of the optimization |
target | Target of the optimization, see examples in PortfolioStatistics |
targetTo | Target extremum of the optimization, for example "max" or "min" |
targetValue | Optimization target value |
strategy | Optimization strategy, GridSearchOptimizationStrategy |
compileId | Optimization compile ID |
parameters | Optimization parameters |
constraints | Optimization constraints |
estimatedCost | Estimated cost for optimization |
nodeType | Optimization node type |
parallelNodes | Number of parallel nodes for optimization |
Implemented in QuantConnect.Api.Api.
List<BaseOptimization> QuantConnect.Interfaces.IApi.ListOptimizations | ( | int | projectId | ) |
List all the optimizations for a project
projectId | Project id we'd like to get a list of optimizations for |
Implemented in QuantConnect.Api.Api.
Optimization QuantConnect.Interfaces.IApi.ReadOptimization | ( | string | optimizationId | ) |
Read an optimization
optimizationId | Optimization id for the optimization we want to read |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.AbortOptimization | ( | string | optimizationId | ) |
Abort an optimization
optimizationId | Optimization id for the optimization we want to abort |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.UpdateOptimization | ( | string | optimizationId, |
string | name = null |
||
) |
Update an optimization
optimizationId | Optimization id we want to update |
name | Name we'd like to assign to the optimization |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.DeleteOptimization | ( | string | optimizationId | ) |
Delete an optimization
optimizationId | Optimization id for the optimization we want to delete |
Implemented in QuantConnect.Api.Api.
LiveLog QuantConnect.Interfaces.IApi.ReadLiveLogs | ( | int | projectId, |
string | algorithmId, | ||
DateTime? | startTime = null , |
||
DateTime? | endTime = null |
||
) |
Gets the logs of a specific live algorithm
projectId | Project Id of the live running algorithm |
algorithmId | Algorithm Id of the live running algorithm |
startTime | No logs will be returned before this time. Should be in UTC |
endTime | No logs will be returned after this time. Should be in UTC |
Implemented in QuantConnect.Api.Api.
DataLink QuantConnect.Interfaces.IApi.ReadDataLink | ( | string | filePath, |
string | organizationId | ||
) |
Gets the link to the downloadable data.
filePath | File path representing the data requested |
organizationId | Organization to purchase this data with |
Implemented in QuantConnect.Api.Api.
DataList QuantConnect.Interfaces.IApi.ReadDataDirectory | ( | string | filePath | ) |
Get valid data entries for a given filepath from data/list
Implemented in QuantConnect.Api.Api.
DataPricesList QuantConnect.Interfaces.IApi.ReadDataPrices | ( | string | organizationId | ) |
Gets data prices from data/prices
Implemented in QuantConnect.Api.Api.
BacktestReport QuantConnect.Interfaces.IApi.ReadBacktestReport | ( | int | projectId, |
string | backtestId | ||
) |
Read out the report of a backtest in the project id specified.
projectId | Project id to read |
backtestId | Specific backtest id to read |
Implemented in QuantConnect.Api.Api.
bool QuantConnect.Interfaces.IApi.DownloadData | ( | string | filePath, |
string | organizationId | ||
) |
Method to download and save the data purchased through QuantConnect
filePath | File path representing the data requested |
Implemented in QuantConnect.Api.Api.
Account QuantConnect.Interfaces.IApi.ReadAccount | ( | string | organizationId = null | ) |
Will read the organization account status
organizationId | The target organization id, if null will return default organization |
Implemented in QuantConnect.Api.Api.
List<Organization> QuantConnect.Interfaces.IApi.ListOrganizations | ( | ) |
Organization QuantConnect.Interfaces.IApi.ReadOrganization | ( | string | organizationId = null | ) |
Fetch organization data from web API
organizationId |
Implemented in QuantConnect.Api.Api.
LiveAlgorithm QuantConnect.Interfaces.IApi.CreateLiveAlgorithm | ( | int | projectId, |
string | compileId, | ||
string | serverType, | ||
BaseLiveAlgorithmSettings | baseLiveAlgorithmSettings, | ||
string | versionId = "-1" |
||
) |
Create a new live algorithm for a logged in user.
projectId | Id of the project on QuantConnect |
compileId | Id of the compilation on QuantConnect |
serverType | Type of server instance that will run the algorithm |
baseLiveAlgorithmSettings | Brokerage specific BaseLiveAlgorithmSettings. |
versionId | The version identifier |
Implemented in QuantConnect.Api.Api.
LiveList QuantConnect.Interfaces.IApi.ListLiveAlgorithms | ( | AlgorithmStatus? | status = null , |
DateTime? | startTime = null , |
||
DateTime? | endTime = null |
||
) |
Get a list of live running algorithms for a logged in user.
status | Filter the statuses of the algorithms returned from the api |
startTime | Earliest launched time of the algorithms returned by the Api |
endTime | Latest launched time of the algorithms returned by the Api |
Implemented in QuantConnect.Api.Api.
LiveAlgorithmResults QuantConnect.Interfaces.IApi.ReadLiveAlgorithm | ( | int | projectId, |
string | deployId | ||
) |
Read out a live algorithm in the project id specified.
projectId | Project id to read |
deployId | Specific instance id to read |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.LiquidateLiveAlgorithm | ( | int | projectId | ) |
Liquidate a live algorithm from the specified project.
projectId | Project for the live instance we want to stop |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.StopLiveAlgorithm | ( | int | projectId | ) |
Stop a live algorithm from the specified project.
projectId | Project for the live algo we want to delete |
Implemented in QuantConnect.Api.Api.
RestResponse QuantConnect.Interfaces.IApi.SendNotification | ( | Notification | notification, |
int | projectId | ||
) |
Sends a notification
notification | The notification to send |
projectId | The project id |
Implemented in QuantConnect.Api.Api.
AlgorithmControl QuantConnect.Interfaces.IApi.GetAlgorithmStatus | ( | string | algorithmId | ) |
Get the algorithm current status, active or cancelled from the user
algorithmId |
Implemented in QuantConnect.Api.Api.
void QuantConnect.Interfaces.IApi.SetAlgorithmStatus | ( | string | algorithmId, |
AlgorithmStatus | status, | ||
string | message = "" |
||
) |
Set the algorithm status from the worker to update the UX e.g. if there was an error.
algorithmId | Algorithm id we're setting. |
status | Status enum of the current worker |
message | Message for the algorithm status event |
Implemented in QuantConnect.Api.Api.
void QuantConnect.Interfaces.IApi.SendStatistics | ( | string | algorithmId, |
decimal | unrealized, | ||
decimal | fees, | ||
decimal | netProfit, | ||
decimal | holdings, | ||
decimal | equity, | ||
decimal | netReturn, | ||
decimal | volume, | ||
int | trades, | ||
double | sharpe | ||
) |
Send the statistics to storage for performance tracking.
algorithmId | Identifier for algorithm |
unrealized | Unrealized gainloss |
fees | Total fees |
netProfit | Net profi |
holdings | Algorithm holdings |
equity | Total equity |
netReturn | Algorithm return |
volume | Volume traded |
trades | Total trades since inception |
sharpe | Sharpe ratio since inception |
Implemented in QuantConnect.Api.Api.
void QuantConnect.Interfaces.IApi.SendUserEmail | ( | string | algorithmId, |
string | subject, | ||
string | body | ||
) |
Send an email to the user associated with the specified algorithm id
algorithmId | The algorithm id |
subject | The email subject |
body | The email message body |
Implemented in QuantConnect.Api.Api.
string QuantConnect.Interfaces.IApi.Download | ( | string | address, |
IEnumerable< KeyValuePair< string, string >> | headers, | ||
string | userName, | ||
string | password | ||
) |
Local implementation for downloading data to algorithms
address | URL to download |
headers | KVP headers |
userName | Username for basic authentication |
password | Password for basic authentication |
Implemented in QuantConnect.Api.Api.