Lean
$LEAN_TAG$
BrokerageMessageEvent.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
namespace
QuantConnect.Brokerages
17
{
18
/// <summary>
19
/// Represents a message received from a brokerage
20
/// </summary>
21
public
class
BrokerageMessageEvent
22
{
23
/// <summary>
24
/// Gets the type of brokerage message
25
/// </summary>
26
public
BrokerageMessageType
Type
{
get
;
private
set
; }
27
28
/// <summary>
29
/// Gets the brokerage specific code for this message, zero if no code was specified
30
/// </summary>
31
public
string
Code
{
get
;
private
set
; }
32
33
/// <summary>
34
/// Gets the message text received from the brokerage
35
/// </summary>
36
public
string
Message
{
get
;
private
set
; }
37
38
/// <summary>
39
/// Initializes a new instance of the BrokerageMessageEvent class
40
/// </summary>
41
/// <param name="type">The type of brokerage message</param>
42
/// <param name="code">The brokerage specific code</param>
43
/// <param name="message">The message text received from the brokerage</param>
44
public
BrokerageMessageEvent
(
BrokerageMessageType
type,
int
code,
string
message)
45
{
46
Type
= type;
47
Code
= code.ToStringInvariant();
48
Message
= message;
49
}
50
51
/// <summary>
52
/// Initializes a new instance of the BrokerageMessageEvent class
53
/// </summary>
54
/// <param name="type">The type of brokerage message</param>
55
/// <param name="code">The brokerage specific code</param>
56
/// <param name="message">The message text received from the brokerage</param>
57
public
BrokerageMessageEvent
(
BrokerageMessageType
type,
string
code,
string
message)
58
{
59
Type
= type;
60
Code
= code;
61
Message
= message;
62
}
63
64
/// <summary>
65
/// Creates a new <see cref="BrokerageMessageEvent"/> to represent a disconnect message
66
/// </summary>
67
/// <param name="message">The message from the brokerage</param>
68
/// <returns>A brokerage disconnect message</returns>
69
public
static
BrokerageMessageEvent
Disconnected
(
string
message)
70
{
71
return
new
BrokerageMessageEvent
(
BrokerageMessageType
.Disconnect,
Messages
.
BrokerageMessageEvent
.
DisconnectCode
, message);
72
}
73
74
/// <summary>
75
/// Creates a new <see cref="BrokerageMessageEvent"/> to represent a reconnect message
76
/// </summary>
77
/// <param name="message">The message from the brokerage</param>
78
/// <returns>A brokerage reconnect message</returns>
79
public
static
BrokerageMessageEvent
Reconnected
(
string
message)
80
{
81
return
new
BrokerageMessageEvent
(
BrokerageMessageType
.Reconnect,
Messages
.
BrokerageMessageEvent
.
ReconnectCode
, message);
82
}
83
84
/// <summary>
85
/// Returns a string that represents the current object.
86
/// </summary>
87
/// <returns>
88
/// A string that represents the current object.
89
/// </returns>
90
/// <filterpriority>2</filterpriority>
91
public
override
string
ToString
()
92
{
93
return
Messages
.
BrokerageMessageEvent
.
ToString
(
this
);
94
}
95
}
96
}
Common
Brokerages
BrokerageMessageEvent.cs
Generated by
1.8.17