def test_with_holidays(self): df = stock.get_shorting_status_by_date("20210103", "20210109", "005930") self.assertIsInstance(df, pd.DataFrame) temp = df.iloc[0:5, 0] == np.array([9279, 169, 967, 763, 6]) self.assertEqual(temp.sum(), 5) self.assertTrue(df.index[0] < df.index[-1])
def test_with_a_business_day(self): df = stock.get_shorting_status_by_date("20210104", "20210108", "005930") # 거래량 잔고수량 거래대금 잔고금액 # 날짜 # 2021-01-04 9279 2722585 771889500 225974555000 # 2021-01-05 169 2676924 14011100 224593923600 # 2021-01-06 967 3002548 80855100 246809445600 # 2021-01-07 763 2447030 63634800 202858787000 # 2021-01-08 6 2319328 534000 205956326400 self.assertIsInstance(df, pd.DataFrame) temp = df.iloc[0:5, 0] == np.array([9279, 169, 967, 763, 6]) self.assertEqual(temp.sum(), 5) self.assertTrue(df.index[0] < df.index[-1])
def test_in_kosdaq(self): df = stock.get_shorting_status_by_date("20210103", "20210109", "017550") # 거래량 잔고수량 거래대금 잔고금액 # 날짜 # 2021-01-04 36 95384 112500 298075000 # 2021-01-05 623 95986 2006060 309074920 # 2021-01-06 349 97046 1111955 310061970 # 2021-01-07 224 95732 727025 310650340 # 2021-01-08 206 92281 636100 285148290 self.assertIsInstance(df, pd.DataFrame) temp = df.iloc[0:5, 0] == np.array([36, 623, 349, 224, 206]) self.assertEqual(temp.sum(), 5) self.assertTrue(df.index[0] < df.index[-1])