Fixes custom data algos to reflect changes from previous commit
This commit is contained in:
@@ -14,11 +14,13 @@
|
||||
from clr import AddReference
|
||||
AddReference("System")
|
||||
AddReference("QuantConnect.Algorithm")
|
||||
AddReference("QuantConnect.Indicators")
|
||||
AddReference("QuantConnect.Common")
|
||||
|
||||
from System import *
|
||||
from QuantConnect import *
|
||||
from QuantConnect.Algorithm import *
|
||||
from QuantConnect.Indicators import *
|
||||
from QuantConnect.Data import SubscriptionDataSource
|
||||
from QuantConnect.Python import PythonData
|
||||
from datetime import date, timedelta, datetime
|
||||
@@ -83,7 +85,6 @@ class BubbleAlgorithm(QCAlgorithm):
|
||||
try:
|
||||
# Bubble territory
|
||||
if self._currCape > 20 and self._newLow == False:
|
||||
self.Log(" Time " + str(self.Time))
|
||||
for stock in self._symbols:
|
||||
# Order stock based on MACD
|
||||
# During market hours, stock is trading, and sufficient cash
|
||||
@@ -120,7 +121,7 @@ class BubbleAlgorithm(QCAlgorithm):
|
||||
# Do nothing
|
||||
return None
|
||||
|
||||
if "CAPE" not in data: return
|
||||
if not data.ContainsKey("CAPE"): return
|
||||
self._newLow = False
|
||||
# Adds first four Cape Ratios to array c
|
||||
self._currCape = data["CAPE"].Cape
|
||||
|
||||
@@ -46,7 +46,7 @@ class CustomDataBitcoinAlgorithm(QCAlgorithm):
|
||||
|
||||
|
||||
def OnData(self, data):
|
||||
if "BTC" not in data: return
|
||||
if not data.ContainsKey("BTC"): return
|
||||
|
||||
close = data["BTC"].Close
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ class CustomDataNIFTYAlgorithm(QCAlgorithm):
|
||||
|
||||
|
||||
def OnData(self, data):
|
||||
if "USDINR" in data:
|
||||
if data.ContainsKey("USDINR"):
|
||||
self.today = CorrelationPair(self.Time)
|
||||
self.today.CurrencyPrice = data["USDINR"].Close
|
||||
|
||||
if "NIFTY" not in data: return
|
||||
if not data.ContainsKey("NIFTY"): return
|
||||
|
||||
self.today.NiftyPrice = data["NIFTY"].Close
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class QCUWeatherBasedRebalancing(QCAlgorithm):
|
||||
|
||||
# When we have a new event trigger, buy some stock:
|
||||
def OnData(self, data):
|
||||
if self.weather not in data: return
|
||||
if not data.ContainsKey(self.weather): return
|
||||
|
||||
# Scale from -5C to +25C :: -5C == 100%, +25C = 0% invested
|
||||
fraction = -(data[self.weather].MinC + 5) / 30 if self.weather in data else 0
|
||||
|
||||
Reference in New Issue
Block a user