def test_with_holidays(self): # 20210103 sunday / 20210110 sunday df = stock.get_index_price_change_by_ticker("20210103", "20210110") temp = df.iloc[0:5, 0] == np.array([2873.47, 389.29, 2974.06, 2725.20, 1151.78]) self.assertIsInstance(df, pd.DataFrame) self.assertEqual(temp.sum(), 5) self.assertFalse(df.empty)
def test_with_valid_business_days(self): df = stock.get_index_price_change_by_ticker("20210104", "20210108") # 시가 종가 등락률 거래량 거래대금 # 지수명 # 코스피 2873.47 3152.18 9.703125 7162398637 149561467924511 # 코스피 200 389.29 430.22 10.507812 2221276866 119905899468167 # 코스피 100 2974.06 3293.96 10.757812 1142234783 95023508273187 # 코스피 50 2725.20 3031.59 11.242188 742099360 79663247553065 # 코스피 200 중소형주 1151.78 1240.92 7.738281 1079042083 24882391194980 temp = df.iloc[0:5, 0] == np.array([2873.47, 389.29, 2974.06, 2725.20, 1151.78]) self.assertIsInstance(df, pd.DataFrame) self.assertEqual(temp.sum(), 5) self.assertFalse(df.empty)