Lean  $LEAN_TAG$
OptionSymbolProperties.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 
17 {
18  /// <summary>
19  /// Represents common properties for a specific option contract
20  /// </summary>
22  {
23  /// <summary>
24  /// The contract multiplier for the security.
25  /// </summary>
26  /// <remarks>
27  /// If manually set by a consumer, this value will be used instead of the
28  /// <see cref="SymbolProperties.ContractMultiplier"/> and also allows to make
29  /// sure it is not overridden when the symbol properties database gets updated.
30  /// </remarks>
31  private decimal? _contractMultiplier;
32 
33  /// <summary>
34  /// The contract multiplier for the security
35  /// </summary>
36  public override decimal ContractMultiplier => _contractMultiplier ?? base.ContractMultiplier;
37 
38  /// <summary>
39  /// When the holder of an equity option exercises one contract, or when the writer of an equity option is assigned
40  /// an exercise notice on one contract, this unit of trade, usually 100 shares of the underlying security, changes hands.
41  /// </summary>
42  public int ContractUnitOfTrade
43  {
44  get; protected set;
45  }
46 
47  /// <summary>
48  /// Creates an instance of the <see cref="OptionSymbolProperties"/> class
49  /// </summary>
50  public OptionSymbolProperties(string description, string quoteCurrency, decimal contractMultiplier, decimal pipSize, decimal lotSize)
51  : this(new SymbolProperties(description, quoteCurrency, contractMultiplier, pipSize, lotSize, string.Empty))
52  {
53  }
54 
55  /// <summary>
56  /// Creates an instance of the <see cref="OptionSymbolProperties"/> class from <see cref="SymbolProperties"/> class
57  /// </summary>
59  : base(properties)
60  {
61  ContractUnitOfTrade = (int)properties.ContractMultiplier;
62  }
63 
64  internal void SetContractUnitOfTrade(int unitOfTrade)
65  {
66  ContractUnitOfTrade = unitOfTrade;
67  }
68 
69  internal void SetContractMultiplier(decimal multiplier)
70  {
71  _contractMultiplier = multiplier;
72  }
73  }
74 }