Lean  $LEAN_TAG$
IContinuousContractModel.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 QuantConnect.Data;
17 using System;
18 using System.Collections.Generic;
19 
21 {
22  /// <summary>
23  /// Enum defines types of possible price adjustments in continuous contract modeling.
24  /// </summary>
25  public enum AdjustmentType
26  {
27  /// ForwardAdjusted - new quotes are adjusted as new data comes
29 
30  /// BackAdjusted - old quotes are retrospectively adjusted as new data comes
32  };
33 
34  /// <summary>
35  /// Continuous contract model interface. Interfaces is implemented by different classes
36  /// realizing various methods for modeling continuous security series. Primarily, modeling of continuous futures.
37  /// Continuous contracts are used in backtesting of otherwise expiring derivative contracts.
38  /// Continuous contracts are not traded, and are not products traded on exchanges.
39  /// </summary>
40  public interface IContinuousContractModel
41  {
42  /// <summary>
43  /// Adjustment type, implemented by the model
44  /// </summary>
46 
47  /// <summary>
48  /// List of current and historical data series for one root symbol.
49  /// e.g. 6BH16, 6BM16, 6BU16, 6BZ16
50  /// </summary>
51  IEnumerator<BaseData> InputSeries { get; set; }
52 
53  /// <summary>
54  /// Method returns continuous prices from the list of current and historical data series for one root symbol.
55  /// It returns enumerator of stitched continuous quotes, produced by the model.
56  /// e.g. 6BH15, 6BM15, 6BU15, 6BZ15 will result in one 6B continuous historical series for 2015
57  /// </summary>
58  /// <returns>Continuous prices</returns>
59  IEnumerator<BaseData> GetContinuousData(DateTime dateTime);
60 
61  /// <summary>
62  /// Returns the list of roll dates for the contract.
63  /// </summary>
64  /// <returns>The list of roll dates</returns>
65  IEnumerator<DateTime> GetRollDates();
66 
67  /// <summary>
68  /// Returns current symbol name that corresponds to the current continuous model,
69  /// or null if none.
70  /// </summary>
71  /// <returns>Current symbol name</returns>
72  Symbol GetCurrentSymbol(DateTime dateTime);
73  }
74 }