Lean
$LEAN_TAG$
ITransactionHandler.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.Collections.Concurrent;
18
using
System.Collections.Generic;
19
using
System.ComponentModel.Composition;
20
using
QuantConnect
.
Interfaces
;
21
using
QuantConnect
.
Lean
.
Engine
.
Results
;
22
using
QuantConnect
.
Orders
;
23
using
QuantConnect
.
Securities
;
24
25
namespace
QuantConnect.Lean.Engine.TransactionHandlers
26
{
27
/// <summary>
28
/// Transaction handlers define how the transactions are processed and set the order fill information.
29
/// The pass this information back to the algorithm portfolio and ensure the cash and portfolio are synchronized.
30
/// </summary>
31
[InheritedExport(typeof(ITransactionHandler))]
32
public
interface
ITransactionHandler
:
IOrderProcessor
,
IOrderEventProvider
33
{
34
/// <summary>
35
/// Boolean flag indicating the thread is busy.
36
/// False indicates it is completely finished processing and ready to be terminated.
37
/// </summary>
38
bool
IsActive
39
{
40
get
;
41
}
42
43
/// <summary>
44
/// Gets the permanent storage for all orders
45
/// </summary>
46
ConcurrentDictionary<int, Order>
Orders
47
{
48
get
;
49
}
50
51
/// <summary>
52
/// Gets all order events
53
/// </summary>
54
IEnumerable<OrderEvent>
OrderEvents
{
get
; }
55
56
/// <summary>
57
/// Gets the permanent storage for all order tickets
58
/// </summary>
59
ConcurrentDictionary<int, OrderTicket>
OrderTickets
60
{
61
get
;
62
}
63
64
/// <summary>
65
/// Initializes the transaction handler for the specified algorithm using the specified brokerage implementation
66
/// </summary>
67
void
Initialize
(
IAlgorithm
algorithm,
IBrokerage
brokerage,
IResultHandler
resultHandler);
68
69
/// <summary>
70
/// Signal a end of thread request to stop montioring the transactions.
71
/// </summary>
72
void
Exit
();
73
74
/// <summary>
75
/// Process any synchronous events from the primary algorithm thread.
76
/// </summary>
77
void
ProcessSynchronousEvents
();
78
79
/// <summary>
80
/// Register an already open Order
81
/// </summary>
82
void
AddOpenOrder
(
Order
order,
IAlgorithm
algorithm);
83
}
84
}
Engine
TransactionHandlers
ITransactionHandler.cs
Generated by
1.8.17