- Previously when a user requested to remove a universe, they would call
`RemoveSecurity()`->`UniverseManager.Remove()`-> `Universe.Dispose()` ->
collection change notification would call `DataManager()` that would
call `RemoveSubscription()` that *would not perform any operation* since
it would return `false` through
`if(subscription.IsUniverseSelectionSubscription &&
subscription.Universe.DisposeRequested)`. Previous comment stated that
the `Subscription` would be removed by the `SubscriptionSynchronizer`
via `SubscriptionFinished()` but this called would go through the same
if statemente as above, returning false and no performing any operation.
So the `Universe` `Subscription` was never removed.
PR https://github.com/QuantConnect/Lean/pull/2039
- In this PR I'm removing the mentioned `if` statement and the call
relation between `UniverseManager.Remove()` and
`DataManager.RemoveSubscription()` since this will be covered by the
`SubscriptionSynchronizer` in the next loop.
- Modified regression test (originally added with these changes at
https://github.com/QuantConnect/Lean/pull/2039) to verify this issue.
This flag indicates whether or not the local regression test system,
via RegressionTests.AlgorithmStatisticsRegression should run a given
IRegressionAlgorithmDefinition
.net 4.7.2 added this extension method but we're on version 4.5.2,
but it appears that the mono version we run backtests under has the
method as well. This causes an ambiguous method error in the cloud
compiler, so this change removes the ambiguity by using the static
method invocation syntax instead of extension method syntax.
A mechanical refactoring was performed to make algorithms currently used in
regression algorithms to implement IRegressionAlgorithmDefinition, which allows
algorithms to define their own expected statistics and what languages should be
run as part of regression. The type name of the C# type is used to determine the
file/model name for python. This was for simplicity, but if needed, could later be
refactored to expose more information, but for now the convention of keeping names
the same makes sense and just works easily.
This change allows the universe selection model to select different universe
definitions as time proceeds. This enables the definition of a universe model
that, for example, could add option chains for securities selected by a different
universe model.
The BasicTemplateOptionsFrameworkAlgorithm was added to showcase and provide
regression for a universe model that selects different universes.
Adds the concept of universe disposal which is requested by an algorithm
through invocation of UniverseManager.Remove, which is invoked via
algorithm.RemoveSecurity. This instructs the data feed that the algorithm
has requested to completely remove the universe and any child subscriptions
from the feed. Security changes are fired for all removed securities.