Lean
$LEAN_TAG$
ISetupHandler.cs
1
/*
2
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*
15
*/
16
17
using
System;
18
using
System.Collections.Generic;
19
using
System.ComponentModel.Composition;
20
using
QuantConnect
.
Interfaces
;
21
using
QuantConnect
.
Packets
;
22
using
QuantConnect
.
Util
;
23
24
namespace
QuantConnect.Lean.Engine.Setup
25
{
26
/// <summary>
27
/// Interface to setup the algorithm. Pass in a raw algorithm, return one with portfolio, cash, etc already preset.
28
/// </summary>
29
[InheritedExport(typeof(ISetupHandler))]
30
public
interface
ISetupHandler
: IDisposable
31
{
32
/// <summary>
33
/// The worker thread instance the setup handler should use
34
/// </summary>
35
WorkerThread
WorkerThread
36
{
37
set
;
38
}
39
40
/// <summary>
41
/// Any errors from the initialization stored here:
42
/// </summary>
43
List<Exception>
Errors
44
{
45
get
;
46
set
;
47
}
48
49
/// <summary>
50
/// Get the maximum runtime for this algorithm job.
51
/// </summary>
52
TimeSpan
MaximumRuntime
53
{
54
get
;
55
}
56
57
/// <summary>
58
/// Algorithm starting capital for statistics calculations
59
/// </summary>
60
decimal
StartingPortfolioValue
61
{
62
get
;
63
}
64
65
/// <summary>
66
/// Start date for analysis loops to search for data.
67
/// </summary>
68
DateTime
StartingDate
69
{
70
get
;
71
}
72
73
/// <summary>
74
/// Maximum number of orders for the algorithm run -- applicable for backtests only.
75
/// </summary>
76
int
MaxOrders
77
{
78
get
;
79
}
80
81
/// <summary>
82
/// Create a new instance of an algorithm from a physical dll path.
83
/// </summary>
84
/// <param name="assemblyPath">The path to the assembly's location</param>
85
/// <param name="algorithmNodePacket">Details of the task required</param>
86
/// <returns>A new instance of IAlgorithm, or throws an exception if there was an error</returns>
87
IAlgorithm
CreateAlgorithmInstance
(
AlgorithmNodePacket
algorithmNodePacket,
string
assemblyPath);
88
89
/// <summary>
90
/// Creates the brokerage as specified by the job packet
91
/// </summary>
92
/// <param name="algorithmNodePacket">Job packet</param>
93
/// <param name="uninitializedAlgorithm">The algorithm instance before Initialize has been called</param>
94
/// <param name="factory">The brokerage factory</param>
95
/// <returns>The brokerage instance, or throws if error creating instance</returns>
96
IBrokerage
CreateBrokerage
(
AlgorithmNodePacket
algorithmNodePacket,
IAlgorithm
uninitializedAlgorithm, out
IBrokerageFactory
factory);
97
98
/// <summary>
99
/// Primary entry point to setup a new algorithm
100
/// </summary>
101
/// <param name="parameters">The parameters object to use</param>
102
/// <returns>True on successfully setting up the algorithm state, or false on error.</returns>
103
bool
Setup
(
SetupHandlerParameters
parameters);
104
}
105
}
Engine
Setup
ISetupHandler.cs
Generated by
1.8.17