Lean  $LEAN_TAG$
Ticks.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 
20 {
21  /// <summary>
22  /// Ticks collection which implements an IDictionary-string-list of ticks. This way users can iterate over the string indexed ticks of the requested symbol.
23  /// </summary>
24  /// <remarks>Ticks are timestamped to the nearest second in QuantConnect</remarks>
25  public class Ticks : DataDictionary<List<Tick>>
26  {
27  /// <summary>
28  /// Initializes a new instance of the <see cref="Ticks"/> dictionary
29  /// </summary>
30  public Ticks()
31  {
32  }
33 
34  /// <summary>
35  /// Initializes a new instance of the <see cref="Ticks"/> dictionary
36  /// </summary>
37  /// <param name="frontier">The time associated with the data in this dictionary</param>
38  public Ticks(DateTime frontier)
39  : base(frontier)
40  {
41  }
42 
43  /// <summary>
44  /// Gets or sets the list of Tick with the specified ticker.
45  /// </summary>
46  /// <returns>
47  /// The list of Tick with the specified ticker.
48  /// </returns>
49  /// <param name="ticker">The ticker of the element to get or set.</param>
50  /// <remarks>Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations</remarks>
51  public new List<Tick> this[string ticker] { get { return base[ticker]; } set { base[ticker] = value; } }
52 
53  /// <summary>
54  /// Gets or sets the list of Tick with the specified Symbol.
55  /// </summary>
56  /// <returns>
57  /// The list of Tick with the specified Symbol.
58  /// </returns>
59  /// <param name="symbol">The Symbol of the element to get or set.</param>
60  /// <remarks>Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations</remarks>
61  public new List<Tick> this[Symbol symbol] { get { return base[symbol]; } set { base[symbol] = value; } }
62  }
63 }