Beispiel #1
0
 def testSMA(self):
     barDs = self.__loadBarDS()
     self.assertTrue(
         compare(
             indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[1],
             93.16))  # Original value 93.15
     self.assertTrue(
         compare(
             indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[2], 94.59))
     self.assertTrue(
         compare(
             indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[3], 94.73))
     self.assertTrue(
         compare(
             indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[-1], 108.31))
 def testSMA(self):
     barDs = self.__loadBarDS()
     self.assertAmountsAreEqual(
         indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[1],
         93.16)  # Original value 93.15
     self.assertAmountsAreEqual(indicator.SMA(barDs.getCloseDataSeries(),
                                              252, 2)[2],
                                94.59,
                                precision=1)
     self.assertAmountsAreEqual(indicator.SMA(barDs.getCloseDataSeries(),
                                              252, 2)[3],
                                94.73,
                                precision=1)
     self.assertAmountsAreEqual(
         indicator.SMA(barDs.getCloseDataSeries(), 252, 2)[-1], 108.31)