Lean  $LEAN_TAG$
Index.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;
20 
22 {
23  /// <summary>
24  /// INDEX Security Object Implementation for INDEX Assets
25  /// </summary>
26  /// <seealso cref="Security"/>
27  public class Index : Security
28  {
29  /// <summary>
30  /// Constructor for the INDEX security
31  /// </summary>
32  /// <param name="exchangeHours">Defines the hours this exchange is open</param>
33  /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
34  /// <param name="config">The subscription configuration for this security</param>
35  /// <param name="symbolProperties">The symbol properties for this security</param>
36  /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
37  /// instances into units of the account currency</param>
38  /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
39  public Index(SecurityExchangeHours exchangeHours,
40  Cash quoteCurrency,
42  SymbolProperties symbolProperties,
43  ICurrencyConverter currencyConverter,
45  : base(config,
46  quoteCurrency,
47  symbolProperties,
48  new IndexExchange(exchangeHours),
49  new IndexCache(),
51  new ImmediateFillModel(),
52  new ConstantFeeModel(0),
53  NullSlippageModel.Instance,
55  Securities.VolatilityModel.Null,
56  new SecurityMarginModel(50m),
57  new IndexDataFilter(),
59  currencyConverter,
60  registeredTypes,
61  Securities.MarginInterestRateModel.Null
62  )
63  {
64  IsTradable = false; //Index are non tradable by default
65  Holdings = new IndexHolding(this, currencyConverter);
66  }
67 
68  /// <summary>
69  /// Constructor for the INDEX security
70  /// </summary>
71  /// <param name="symbol">The security's symbol</param>
72  /// <param name="exchangeHours">Defines the hours this exchange is open</param>
73  /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
74  /// <param name="symbolProperties">The symbol properties for this security</param>
75  /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
76  /// instances into units of the account currency</param>
77  /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
78  /// <param name="securityCache">Cache to store security information</param>
79  public Index(Symbol symbol,
80  SecurityExchangeHours exchangeHours,
81  Cash quoteCurrency,
82  SymbolProperties symbolProperties,
83  ICurrencyConverter currencyConverter,
85  SecurityCache securityCache)
86  : base(symbol,
87  quoteCurrency,
88  symbolProperties,
89  new IndexExchange(exchangeHours),
90  securityCache,
92  new ImmediateFillModel(),
93  new ConstantFeeModel(0),
94  NullSlippageModel.Instance,
96  Securities.VolatilityModel.Null,
97  new SecurityMarginModel(50m),
98  new IndexDataFilter(),
100  currencyConverter,
101  registeredTypes,
102  Securities.MarginInterestRateModel.Null
103  )
104  {
105  IsTradable = false; //Index are non tradable by default
106  Holdings = new IndexHolding(this, currencyConverter);
107  }
108  }
109 }