Lean
$LEAN_TAG$
FuturesContract.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
18
namespace
QuantConnect.Data.Market
19
{
20
/// <summary>
21
/// Defines a single futures contract at a specific expiration
22
/// </summary>
23
public
class
FuturesContract
24
{
25
/// <summary>
26
/// Gets the futures contract's symbol
27
/// </summary>
28
public
Symbol
Symbol
29
{
30
get
;
private
set
;
31
}
32
33
/// <summary>
34
/// Gets the underlying security's symbol
35
/// </summary>
36
public
Symbol
UnderlyingSymbol
37
{
38
get
;
private
set
;
39
}
40
41
/// <summary>
42
/// Gets the expiration date
43
/// </summary>
44
public
DateTime
Expiry
=>
Symbol
.
ID
.
Date
;
45
46
/// <summary>
47
/// Gets the local date time this contract's data was last updated
48
/// </summary>
49
public
DateTime
Time
50
{
51
get
;
set
;
52
}
53
54
/// <summary>
55
/// Gets the open interest
56
/// </summary>
57
public
decimal
OpenInterest
58
{
59
get
;
set
;
60
}
61
62
/// <summary>
63
/// Gets the last price this contract traded at
64
/// </summary>
65
public
decimal
LastPrice
66
{
67
get
;
set
;
68
}
69
70
/// <summary>
71
/// Gets the last volume this contract traded at
72
/// </summary>
73
public
long
Volume
74
{
75
get
;
set
;
76
}
77
78
/// <summary>
79
/// Gets the current bid price
80
/// </summary>
81
public
decimal
BidPrice
82
{
83
get
;
set
;
84
}
85
86
/// <summary>
87
/// Get the current bid size
88
/// </summary>
89
public
long
BidSize
90
{
91
get
;
set
;
92
}
93
94
/// <summary>
95
/// Gets the ask price
96
/// </summary>
97
public
decimal
AskPrice
98
{
99
get
;
set
;
100
}
101
102
/// <summary>
103
/// Gets the current ask size
104
/// </summary>
105
public
long
AskSize
106
{
107
get
;
set
;
108
}
109
110
/// <summary>
111
/// Initializes a new instance of the <see cref="FuturesContract"/> class
112
/// </summary>
113
/// <param name="symbol">The futures contract symbol</param>
114
/// <param name="underlyingSymbol">The symbol of the underlying security</param>
115
public
FuturesContract
(
Symbol
symbol,
Symbol
underlyingSymbol)
116
{
117
Symbol
= symbol;
118
UnderlyingSymbol
= underlyingSymbol;
119
}
120
121
/// <summary>
122
/// Returns a string that represents the current object.
123
/// </summary>
124
/// <returns>
125
/// A string that represents the current object.
126
/// </returns>
127
public
override
string
ToString
() =>
Symbol
.
Value
;
128
}
129
}
Common
Data
Market
FuturesContract.cs
Generated by
1.8.17