Make Future universe selection file-based like option universe
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from AlgorithmImports import *
|
||||
import QuantConnect.Data.UniverseSelection
|
||||
|
||||
### <summary>
|
||||
### This example demonstrates how to add futures with daily resolution.
|
||||
@@ -54,6 +55,12 @@ class BasicTemplateFuturesDailyAlgorithm(QCAlgorithm):
|
||||
elif all(x.exchange.hours.is_open(self.time, True) for x in self.securities.values() if x.invested):
|
||||
self.liquidate()
|
||||
|
||||
def on_securities_changed(self, changes: SecurityChanges) -> None:
|
||||
if len(changes.removed_securities) > 0 and \
|
||||
self.portfolio.invested and \
|
||||
all(x.exchange.hours.is_open(self.time, True) for x in self.securities.values() if x.invested):
|
||||
self.liquidate()
|
||||
|
||||
def get_resolution(self):
|
||||
return Resolution.DAILY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user