Lean
$LEAN_TAG$
OptionNotificationEventArgs.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;
17
using
QuantConnect
.
Interfaces
;
18
19
namespace
QuantConnect.Brokerages
20
{
21
/// <summary>
22
/// Event arguments class for the <see cref="IBrokerage.OptionNotification"/> event
23
/// </summary>
24
public
sealed
class
OptionNotificationEventArgs
: EventArgs
25
{
26
/// <summary>
27
/// Gets the option symbol which has received a notification
28
/// </summary>
29
public
Symbol
Symbol
{
get
; }
30
31
/// <summary>
32
/// Gets the new option position (positive for long, zero for flat, negative for short)
33
/// </summary>
34
public
decimal
Position
{
get
; }
35
36
/// <summary>
37
/// The tag that will be used in the order
38
/// </summary>
39
public
string
Tag
{
get
; }
40
41
/// <summary>
42
/// Initializes a new instance of the <see cref="OptionNotificationEventArgs"/> class
43
/// </summary>
44
/// <param name="symbol">The symbol</param>
45
/// <param name="position">The new option position</param>
46
public
OptionNotificationEventArgs
(
Symbol
symbol, decimal position)
47
{
48
Symbol
= symbol;
49
Position
= position;
50
}
51
52
/// <summary>
53
/// Initializes a new instance of the <see cref="OptionNotificationEventArgs"/> class
54
/// </summary>
55
/// <param name="symbol">The symbol</param>
56
/// <param name="position">The new option position</param>
57
/// <param name="tag">The tag to be used for the order</param>
58
public
OptionNotificationEventArgs
(
Symbol
symbol, decimal position,
string
tag)
59
: this(symbol, position)
60
{
61
Tag
= tag;
62
}
63
64
/// <summary>
65
/// Returns the string representation of this event
66
/// </summary>
67
public
override
string
ToString
()
68
{
69
var str = $
"{Symbol} position: {Position}"
;
70
if
(!
string
.IsNullOrEmpty(
Tag
))
71
{
72
str += $
", tag: {Tag}"
;
73
}
74
75
return
str;
76
}
77
}
78
}
Common
Brokerages
OptionNotificationEventArgs.cs
Generated by
1.8.17