Lean  $LEAN_TAG$
ISecurityPrice.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;
18 using System.Collections.Generic;
19 using QuantConnect.Data;
21 
23 {
24  /// <summary>
25  /// Reduced interface which allows setting and accessing
26  /// price properties for a <see cref="Security"/>
27  /// </summary>
28  public interface ISecurityPrice
29  {
30  /// <summary>
31  /// Get the current value of the security.
32  /// </summary>
33  decimal Price { get; }
34 
35  /// <summary>
36  /// If this uses trade bar data, return the most recent close.
37  /// </summary>
38  decimal Close { get; }
39 
40  /// <summary>
41  /// Access to the volume of the equity today
42  /// </summary>
43  decimal Volume { get; }
44 
45  /// <summary>
46  /// Gets the most recent bid price if available
47  /// </summary>
48  decimal BidPrice { get; }
49 
50  /// <summary>
51  /// Gets the most recent bid size if available
52  /// </summary>
53  decimal BidSize { get; }
54 
55  /// <summary>
56  /// Gets the most recent ask price if available
57  /// </summary>
58  decimal AskPrice { get; }
59 
60  /// <summary>
61  /// Gets the most recent ask size if available
62  /// </summary>
63  decimal AskSize { get; }
64 
65  /// <summary>
66  /// Access to the open interest of the security today
67  /// </summary>
68  long OpenInterest { get; }
69 
70  /// <summary>
71  /// <see cref="Symbol"/> for the asset.
72  /// </summary>
73  Symbol Symbol { get; }
74 
75  /// <summary>
76  /// <see cref="SymbolProperties"/> of the symbol
77  /// </summary>
79 
80  /// <summary>
81  /// Update any security properties based on the latest market data and time
82  /// </summary>
83  /// <param name="data">New data packet from LEAN</param>
84  void SetMarketPrice(BaseData data);
85 
86  /// <summary>
87  /// Updates all of the security properties, such as price/OHLCV/bid/ask based
88  /// on the data provided. Data is also stored into the security's data cache
89  /// </summary>
90  /// <param name="data">The security update data</param>
91  /// <param name="dataType">The data type</param>
92  /// <param name="containsFillForwardData">Flag indicating whether
93  /// <paramref name="data"/> contains any fill forward bar or not</param>
94  void Update(IReadOnlyList<BaseData> data, Type dataType, bool? containsFillForwardData);
95 
96  /// <summary>
97  /// Get the last price update set to the security.
98  /// </summary>
99  /// <returns>BaseData object for this security</returns>
101  }
102 }