def Test_WMA(): code = [ 'VAR3:C;', 'VAR2:WMA(C,20);', ] result = JSComplier.Execute(code[0] + code[1]) return True if result else False
def Test_Multiply(): code=[ 'VAR2:C*O;', "VAR3:100*100;" ] result=JSComplier.Execute(code[0]+code[1]) return True if result else False
def Test_MAX_MIN(): code = [ 'VAR2:MAX(C,O);', "VAR3:MAX(C,100);", "VAR4:MAX(100,C);", 'VAR5:MIN(C,O);', 'VAR5:MIN(C,4);' ] result = JSComplier.Execute(code[0] + code[1] + code[2] + code[4] + code[3]) return True if result else False
def Run(self): testCode = '' for item in self.Code: testCode += item testCode += '\n' result = JSComplier.Execute(testCode, self.Option) return True if result else False
def Test_SMA(): code = [ 'VAR2:SMA(C,5,10);', 'VAR3:SMA(C,10,10);', 'VAR4:SMA(C,15,10);', 'VAR4:SMA(C,30,10);', ] result = JSComplier.Execute(code[0] + code[1] + code[2] + code[3]) return True if result else False
def Test_COUNT(): code = [ 'VAR3:COUNT(C,5);', 'VAR2:COUNT(O,10);', 'VAR2:COUNT(H,20);', ] option = SymbolOption() result = JSComplier.Execute(code[0] + code[1] + code[2], option) return True if result else False
def Test_SUMBARS(): code = [ 'VAR3:SUMBARS(C,O)', 'VAR2:C;', ] option = SymbolOption() option.Symbol = '000001.sz' option.HQDataType = HQ_DATA_TYPE.MINUTE_ID result = JSComplier.Execute(code[0] + code[1], option) return True if result else False
def Test_INDEX(): code = [ 'VAR3:INDEXA;', 'VAR2:INDEXC;', 'VAR2:INDEXO;', ] option = SymbolOption() option.Period = 5 result = JSComplier.Execute(code[0] + code[1] + code[2], option) return True if result else False
def Test_Add(): result = JSComplier.Execute('VAR2:C+100') return True if result else False
def Test_REF(): result = JSComplier.Execute('VAR2:C-REF(O,1)') return True if result else False