Lean  $LEAN_TAG$
SymbolChangedEvent.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 
17 using System;
18 
20 {
21  /// <summary>
22  /// Symbol changed event of a security. This is generated when a symbol is remapped for a given
23  /// security, for example, at EOD 2014.04.02 GOOG turned into GOOGL, but are the same
24  /// </summary>
26  {
27  /// <summary>
28  /// Gets the symbol before the change
29  /// </summary>
30  public string OldSymbol { get; private set; }
31 
32  /// <summary>
33  /// Gets the symbol after the change
34  /// </summary>
35  public string NewSymbol { get; private set; }
36 
37  /// <summary>
38  /// Initializes a new default instance of the <see cref="SymbolChangedEvent"/> class
39  /// </summary>
41  {
42  DataType = MarketDataType.Auxiliary;
43  }
44 
45  /// <summary>
46  /// Initializes a new instance of the <see cref="SymbolChangedEvent"/>
47  /// </summary>
48  /// <param name="requestedSymbol">The symbol that was originally requested</param>
49  /// <param name="date">The date/time this symbol remapping took place</param>
50  /// <param name="oldSymbol">The old symbol mapping</param>
51  /// <param name="newSymbol">The new symbol mapping</param>
52  public SymbolChangedEvent(Symbol requestedSymbol, DateTime date, string oldSymbol, string newSymbol)
53  : this()
54  {
55  Time = date;
56  Symbol = requestedSymbol;
57  OldSymbol = oldSymbol;
58  NewSymbol = newSymbol;
59  }
60 
61  /// <summary>
62  /// Return the URL string source of the file. This will be converted to a stream
63  /// </summary>
64  /// <param name="config">Configuration object</param>
65  /// <param name="date">Date of this source file</param>
66  /// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
67  /// <returns>String URL of source file.</returns>
68  public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
69  {
70  return null;
71  }
72 
73  /// <summary>
74  /// Return a new instance clone of this object, used in fill forward
75  /// </summary>
76  /// <remarks>
77  /// This base implementation uses reflection to copy all public fields and properties
78  /// </remarks>
79  /// <returns>A clone of the current object</returns>
80  public override BaseData Clone()
81  {
83  }
84 
85  /// <summary>
86  /// Friendly string representation of this symbol changed event
87  /// </summary>
88  public override string ToString()
89  {
90  return $"{Time} {OldSymbol}->{NewSymbol}";
91  }
92  }
93 }