Lean  $LEAN_TAG$
DataUniverseDownloadConfig.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 
18 
20 
21 /// <summary>
22 /// Represents the configuration for downloading data for a universe of securities.
23 /// </summary>
25 {
26  /// <summary>
27  /// Gets the type of data universe download.
28  /// </summary>
29  public override Type DataType { get; }
30 
31  /// <summary>
32  /// Initializes a new instance of the <see cref="DataUniverseDownloadConfig"/> class using configuration settings.
33  /// </summary>
34  /// <exception cref="ArgumentException">Thrown when an unsupported security type is specified.</exception>
36  {
37  Resolution = Resolution.Daily;
38  DataType = GetDataUniverseType(SecurityType);
39  }
40 
41  /// <summary>
42  /// Retrieves the corresponding data universe type based on the specified security type.
43  /// </summary>
44  /// <param name="securityType">The security type for which the data universe type is determined.</param>
45  /// <returns>The corresponding <see cref="Type"/> of the data universe.</returns>
46  /// <exception cref="NotImplementedException">
47  /// Thrown when the specified <paramref name="securityType"/> is not supported.
48  /// </exception>
49  private static Type GetDataUniverseType(SecurityType securityType)
50  {
51  switch (securityType)
52  {
53  case SecurityType.Option:
54  case SecurityType.IndexOption:
55  return typeof(OptionUniverse);
56  default:
57  throw new NotImplementedException($"DataUniverseDownloadConfig.GetDataUniverseType(): The data universe type for SecurityType '{securityType}' is not implemented.");
58  }
59  }
60 }