Lean
$LEAN_TAG$
PaperBrokerageFactory.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
using
System.Collections.Generic;
17
using
QuantConnect
.
Configuration
;
18
using
QuantConnect
.
Interfaces
;
19
using
QuantConnect
.
Packets
;
20
using
QuantConnect
.
Securities
;
21
22
namespace
QuantConnect.Brokerages.Paper
23
{
24
/// <summary>
25
/// The factory type for the <see cref="PaperBrokerage"/>
26
/// </summary>
27
public
class
PaperBrokerageFactory
:
BrokerageFactory
28
{
29
/// <summary>
30
/// Gets the brokerage data required to run the IB brokerage from configuration
31
/// </summary>
32
/// <remarks>
33
/// The implementation of this property will create the brokerage data dictionary required for
34
/// running live jobs. See <see cref="IJobQueueHandler.NextJob"/>
35
/// </remarks>
36
public
override
Dictionary<string, string>
BrokerageData
=>
new
Dictionary<string, string>
37
{
38
{
"live-cash-balance"
,
Config
.
Get
(
"live-cash-balance"
)},
39
{
"live-holdings"
,
Config
.
Get
(
"live-holdings"
)},
40
};
41
42
/// <summary>
43
/// Gets a new instance of the <see cref="InteractiveBrokersBrokerageModel"/>
44
/// </summary>
45
/// <param name="orderProvider">The order provider</param>
46
public
override
IBrokerageModel
GetBrokerageModel
(
IOrderProvider
orderProvider) =>
new
DefaultBrokerageModel
();
47
48
/// <summary>
49
/// Creates a new IBrokerage instance
50
/// </summary>
51
/// <param name="job">The job packet to create the brokerage for</param>
52
/// <param name="algorithm">The algorithm instance</param>
53
/// <returns>A new brokerage instance</returns>
54
public
override
IBrokerage
CreateBrokerage
(
LiveNodePacket
job,
IAlgorithm
algorithm)
55
{
56
return
new
PaperBrokerage
(algorithm, job);
57
}
58
59
/// <summary>
60
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
61
/// </summary>
62
/// <filterpriority>2</filterpriority>
63
public
override
void
Dispose
()
64
{
65
// NOP
66
}
67
68
/// <summary>
69
/// Initializes a new instance of the <see cref="PaperBrokerageFactory"/> class
70
/// </summary>
71
public
PaperBrokerageFactory
()
72
: base(typeof(
PaperBrokerage
))
73
{
74
}
75
}
76
}
Brokerages
Paper
PaperBrokerageFactory.cs
Generated by
1.8.17