Fix timestamps in custom data algorithms (#5426)
* Correct custom data timestamp and match performance across languages * Add EndTime property * Add comment for crypto SetHoldings
This commit is contained in:
@@ -72,7 +72,7 @@ class CustomDataNIFTYAlgorithm(QCAlgorithm):
|
||||
if self.Time.weekday() != 2: return
|
||||
|
||||
cur_qnty = self.Portfolio["NIFTY"].Quantity
|
||||
quantity = math.floor(self.Portfolio.MarginRemaining * 0.9) / data["NIFTY"].Close
|
||||
quantity = int(self.Portfolio.MarginRemaining * 0.9 / data["NIFTY"].Close)
|
||||
hi_nifty = max(price.NiftyPrice for price in self.prices)
|
||||
lo_nifty = min(price.NiftyPrice for price in self.prices)
|
||||
|
||||
@@ -103,6 +103,7 @@ class Nifty(PythonData):
|
||||
# 2011-09-13 7792.9 7799.9 7722.65 7748.7 116534670 6107.78
|
||||
data = line.split(',')
|
||||
index.Time = datetime.strptime(data[0], "%Y-%m-%d")
|
||||
index.EndTime = index.Time + timedelta(days=1)
|
||||
index.Value = data[4]
|
||||
index["Open"] = float(data[1])
|
||||
index["High"] = float(data[2])
|
||||
@@ -132,6 +133,7 @@ class DollarRupee(PythonData):
|
||||
try:
|
||||
data = line.split(',')
|
||||
currency.Time = datetime.strptime(data[0], "%Y-%m-%d")
|
||||
currency.EndTime = currency.Time + timedelta(days=1)
|
||||
currency.Value = data[1]
|
||||
currency["Close"] = float(data[1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user