def testSAR(self): barDs = self.__loadSarTestBarDs() self.assertTrue(compare(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[1], 50.00)) self.assertTrue(compare(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[2], 50.047)) self.assertTrue(compare(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[5], 50.182)) self.assertTrue(compare(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[-2], 52.93)) self.assertTrue(compare(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[-1], 50.00))
def testSAR(self): barDs = self.__loadSarTestBarDs() self.assertAmountsAreEqual(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[1], 50.00) self.assertAmountsAreEqual(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[2], 50.047) self.assertAmountsAreEqual(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[5], 50.182) self.assertAmountsAreEqual(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[-2], 52.93) self.assertAmountsAreEqual(indicator.SAR(barDs, len(SAR_HIGH), 0.02, 0.20)[-1], 50.00)