Lean
$LEAN_TAG$
GetSubscriptionRequestsUniverseDecorator.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
System.Collections.Generic;
18
using
QuantConnect
.
Securities
;
19
20
namespace
QuantConnect.Data.UniverseSelection
21
{
22
/// <summary>
23
/// Provides a universe decoration that replaces the implementation of <see cref="GetSubscriptionRequests"/>
24
/// </summary>
25
public
class
GetSubscriptionRequestsUniverseDecorator
:
UniverseDecorator
26
{
27
private
readonly
GetSubscriptionRequestsDelegate
_getRequests;
28
29
/// <summary>
30
/// Delegate type for the <see cref="GetSubscriptionRequests"/> method
31
/// </summary>
32
/// <param name="security">The security to get subscription requests for</param>
33
/// <param name="currentTimeUtc">The current utc frontier time</param>
34
/// <param name="maximumEndTimeUtc"></param>
35
/// <returns>The subscription requests for the security to be given to the data feed</returns>
36
public
delegate IEnumerable<SubscriptionRequest>
GetSubscriptionRequestsDelegate
(
Security
security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc);
37
38
/// <summary>
39
/// Initializes a new instance of the <see cref="GetSubscriptionRequestsUniverseDecorator"/> class
40
/// </summary>
41
/// <param name="universe">The universe to be decorated</param>
42
/// <param name="getRequests"></param>
43
public
GetSubscriptionRequestsUniverseDecorator
(
Universe
universe,
GetSubscriptionRequestsDelegate
getRequests)
44
: base(universe)
45
{
46
_getRequests = getRequests;
47
}
48
49
/// <summary>
50
/// Gets the subscription requests to be added for the specified security
51
/// </summary>
52
/// <param name="security">The security to get subscriptions for</param>
53
/// <param name="currentTimeUtc">The current time in utc. This is the frontier time of the algorithm</param>
54
/// <param name="maximumEndTimeUtc">The max end time</param>
55
/// <returns>All subscriptions required by this security</returns>
56
public
override
IEnumerable<SubscriptionRequest>
GetSubscriptionRequests
(
Security
security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc)
57
{
58
return
_getRequests(security, currentTimeUtc, maximumEndTimeUtc);
59
}
60
}
61
}
Common
Data
UniverseSelection
GetSubscriptionRequestsUniverseDecorator.cs
Generated by
1.8.17