Lean  $LEAN_TAG$
IOrderBookUpdater.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 System.Collections.Generic;
18 using System.Linq;
19 
21 {
22  /// <summary>
23  /// Represents an orderbook updater interface for a security.
24  /// Provides the ability to update orderbook price level and to be alerted about updates
25  /// </summary>
26  /// <typeparam name="K">Price level identifier</typeparam>
27  /// <typeparam name="V">Size at the price level</typeparam>
28  public interface IOrderBookUpdater<K, V>
29  {
30  /// <summary>
31  /// Event fired each time BestBidPrice or BestAskPrice are changed
32  /// </summary>
33  event EventHandler<BestBidAskUpdatedEventArgs> BestBidAskUpdated;
34 
35  /// <summary>
36  /// Updates or inserts a bid price level in the order book
37  /// </summary>
38  /// <param name="price">The bid price level to be inserted or updated</param>
39  /// <param name="size">The new size at the bid price level</param>
40  void UpdateBidRow(K price, V size);
41 
42  /// <summary>
43  /// Updates or inserts an ask price level in the order book
44  /// </summary>
45  /// <param name="price">The ask price level to be inserted or updated</param>
46  /// <param name="size">The new size at the ask price level</param>
47  void UpdateAskRow(K price, V size);
48 
49  /// <summary>
50  /// Removes a bid price level from the order book
51  /// </summary>
52  /// <param name="price">The bid price level to be removed</param>
53  void RemoveBidRow(K price);
54 
55  /// <summary>
56  /// Removes an ask price level from the order book
57  /// </summary>
58  /// <param name="price">The ask price level to be removed</param>
59  void RemoveAskRow(K price);
60  }
61 }