Refactor python algorithm import (#5657)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* Python research import improvements - Improve start.py for research env - Remove unrequired imports * Centralize algorithm imports * Add regression test GH action * Unit test python import clean up * Join research and main imports * More python import clean up * Fix failing skipped regression algorithm
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
||||
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
||||
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -11,19 +11,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from clr import AddReference
|
||||
AddReference("System")
|
||||
AddReference("QuantConnect.Algorithm")
|
||||
AddReference("QuantConnect.Indicators")
|
||||
AddReference("QuantConnect.Common")
|
||||
|
||||
from System import *
|
||||
from QuantConnect import *
|
||||
from QuantConnect.Indicators import *
|
||||
from QuantConnect.Algorithm import *
|
||||
from AlgorithmImports import *
|
||||
from collections import deque
|
||||
from datetime import datetime, timedelta
|
||||
from numpy import sum
|
||||
|
||||
### <summary>
|
||||
### Demonstrates how to create a custom indicator and register it for automatic updated
|
||||
@@ -80,5 +69,5 @@ class CustomSimpleMovingAverage(PythonIndicator):
|
||||
def Update(self, input):
|
||||
self.queue.appendleft(input.Value)
|
||||
count = len(self.queue)
|
||||
self.Value = sum(self.queue) / count
|
||||
return count == self.queue.maxlen
|
||||
self.Value = np.sum(self.queue) / count
|
||||
return count == self.queue.maxlen
|
||||
|
||||
Reference in New Issue
Block a user