Lean  $LEAN_TAG$
DataProviderEvents.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 QuantConnect.Data;
20 
21 namespace QuantConnect
22 {
23  /// <summary>
24  /// Defines a base class for <see cref="IDataProviderEvents"/>
25  /// </summary>
26  public abstract class DataProviderEventArgs : EventArgs
27  {
28  /// <summary>
29  /// Gets the symbol being processed that generated the event
30  /// </summary>
31  public Symbol Symbol { get; }
32 
33  /// <summary>
34  /// Initializes a new instance of the <see cref="DataProviderEventArgs"/> class
35  /// </summary>
36  /// <param name="symbol">Symbol being processed that generated the event</param>
37  protected DataProviderEventArgs(Symbol symbol)
38  {
39  Symbol = symbol;
40  }
41  }
42 
43  /// <summary>
44  /// Event arguments for the <see cref="IDataProviderEvents.InvalidConfigurationDetected"/> event
45  /// </summary>
47  {
48  /// <summary>
49  /// Gets the error message
50  /// </summary>
51  public string Message { get; }
52 
53  /// <summary>
54  /// Initializes a new instance of the <see cref="InvalidConfigurationDetectedEventArgs"/> class
55  /// </summary>
56  /// <param name="symbol">Symbol being processed that generated the event</param>
57  /// <param name="message">The error message</param>
58  public InvalidConfigurationDetectedEventArgs(Symbol symbol, string message)
59  : base(symbol)
60  {
61  Message = message;
62  }
63  }
64 
65  /// <summary>
66  /// Event arguments for the <see cref="IDataProviderEvents.NumericalPrecisionLimited"/> event
67  /// </summary>
69  {
70  /// <summary>
71  /// Gets the error message
72  /// </summary>
73  public string Message { get; }
74 
75  /// <summary>
76  /// Initializes a new instance of the <see cref="NumericalPrecisionLimitedEventArgs"/> class
77  /// </summary>
78  /// <param name="symbol">Symbol being processed that generated the event</param>
79  /// <param name="message">The error message</param>
80  public NumericalPrecisionLimitedEventArgs(Symbol symbol, string message)
81  : base(symbol)
82  {
83  Message = message;
84  }
85  }
86 
87  /// <summary>
88  /// Event arguments for the <see cref="IDataProviderEvents.DownloadFailed"/> event
89  /// </summary>
91  {
92  /// <summary>
93  /// Gets the error message
94  /// </summary>
95  public string Message { get; }
96 
97  /// <summary>
98  /// Gets the error stack trace
99  /// </summary>
100  public string StackTrace { get; }
101 
102  /// <summary>
103  /// Initializes a new instance of the <see cref="DownloadFailedEventArgs"/> class
104  /// </summary>
105  /// <param name="symbol">Symbol being processed that generated the event</param>
106  /// <param name="message">The error message</param>
107  /// <param name="stackTrace">The error stack trace</param>
108  public DownloadFailedEventArgs(Symbol symbol, string message, string stackTrace = "")
109  : base(symbol)
110  {
111  Message = message;
112  StackTrace = stackTrace;
113  }
114  }
115 
116  /// <summary>
117  /// Event arguments for the <see cref="IDataProviderEvents.ReaderErrorDetected"/> event
118  /// </summary>
120  {
121  /// <summary>
122  /// Gets the error message
123  /// </summary>
124  public string Message { get; }
125 
126  /// <summary>
127  /// Gets the error stack trace
128  /// </summary>
129  public string StackTrace { get; }
130 
131  /// <summary>
132  /// Initializes a new instance of the <see cref="ReaderErrorDetectedEventArgs"/> class
133  /// </summary>
134  /// <param name="symbol">Symbol being processed that generated the event</param>
135  /// <param name="message">The error message</param>
136  /// <param name="stackTrace">The error stack trace</param>
137  public ReaderErrorDetectedEventArgs(Symbol symbol, string message, string stackTrace = "")
138  : base(symbol)
139  {
140  Message = message;
141  StackTrace = stackTrace;
142  }
143  }
144 
145  /// <summary>
146  /// Event arguments for the <see cref="IDataProviderEvents.StartDateLimited"/> event
147  /// </summary>
149  {
150  /// <summary>
151  /// Gets the error message
152  /// </summary>
153  public string Message { get; }
154 
155  /// <summary>
156  /// Initializes a new instance of the <see cref="StartDateLimitedEventArgs"/> class
157  /// </summary>
158  /// <param name="symbol">Symbol being processed that generated the event</param>
159  /// <param name="message">The error message</param>
160  public StartDateLimitedEventArgs(Symbol symbol, string message)
161  : base(symbol)
162  {
163  Message = message;
164  }
165  }
166 
167  /// <summary>
168  /// Event arguments for the NewTradableDate event
169  /// </summary>
171  {
172  /// <summary>
173  /// The new tradable date
174  /// </summary>
175  public DateTime Date { get; }
176 
177  /// <summary>
178  /// The last <see cref="BaseData"/> of the <see cref="Security"/>
179  /// for which we are enumerating
180  /// </summary>
181  public BaseData LastBaseData { get; }
182 
183  /// <summary>
184  /// The last raw security price we have
185  /// </summary>
186  public decimal? LastRawPrice { get; }
187 
188  /// <summary>
189  /// Initializes a new instance of the <see cref="NewTradableDateEventArgs"/> class
190  /// </summary>
191  /// <param name="date">The new tradable date</param>
192  /// <param name="lastBaseData">The last <see cref="BaseData"/> of the
193  /// <see cref="Security"/> for which we are enumerating</param>
194  /// <param name="symbol">The <see cref="Symbol"/> of the new tradable date</param>
195  /// <param name="lastRawPrice">The last raw security price we have</param>
196  public NewTradableDateEventArgs(DateTime date, BaseData lastBaseData, Symbol symbol, decimal? lastRawPrice)
197  : base(symbol)
198  {
199  Date = date;
200  LastBaseData = lastBaseData;
201  LastRawPrice = lastRawPrice;
202  }
203  }
204 }