예제 #1
0
 def testOutputKnownMacdValues(self):
     """Macd calculation should give known result with known input
        results are rounded by str representation of floats
     """
     parameter = (3,6,3)
     s = Macd(parameter)
     ema1 = Ema(parameter[0])
     ema2 = Ema(parameter[1])
     emamacd = EmaMacd(parameter[2])
     
     for c in inputValues:
         s.append(c)
         ema1.append(c)
         ema2.append(c)
         
     knownvalues = []
     for e in range(len(ema1.output)):
         if ema2.output[e] == None:
             knownvalues.append(None)
             continue
         else:
             knownvalues.append(ema1.output[e] - ema2.output[e])
             
     for i in range(len(s.output)):
         self.assertEqual(str(s.output[i]), str(knownvalues[i]))
예제 #2
0
    def testOutputKnownMacdValues(self):
        """Macd calculation should give known result with known input
           results are rounded by str representation of floats
        """
        parameter = (3, 6, 3)
        s = Macd(parameter)
        ema1 = Ema(parameter[0])
        ema2 = Ema(parameter[1])
        emamacd = EmaMacd(parameter[2])

        for c in inputValues:
            s.append(c)
            ema1.append(c)
            ema2.append(c)

        knownvalues = []
        for e in range(len(ema1.output)):
            if ema2.output[e] == None:
                knownvalues.append(None)
                continue
            else:
                knownvalues.append(ema1.output[e] - ema2.output[e])

        for i in range(len(s.output)):
            self.assertEqual(str(s.output[i]), str(knownvalues[i]))
예제 #3
0
파일: ematest.py 프로젝트: jsmits/ta_python
 def testOutputKnownValues(self):
     """Ema calculation should give known result with known input
        results are rounded by str representation of floats
     """
     s = Ema(4)
     knownvalues = [None, None, None, 12.24, 12.372, 12.3032, 12.26992, 12.225952]
     for c in inputValues[:8]:
         s.append(c)
     for i in range(len(s.output)):
         self.assertEqual(str(s.output[i]), str(knownvalues[i]))
예제 #4
0
 def testOutputKnownValues(self):
     """Ema calculation should give known result with known input
        results are rounded by str representation of floats
     """
     s = Ema(4)
     knownvalues = [
         None, None, None, 12.24, 12.372, 12.3032, 12.26992, 12.225952
     ]
     for c in inputValues[:8]:
         s.append(c)
     for i in range(len(s.output)):
         self.assertEqual(str(s.output[i]), str(knownvalues[i]))