def test_with_holiday_1(self): # 20210103 sunday / 20210109 friday df = stock.get_shorting_investor_volume_by_date("20200105", "20200111") self.assertIsInstance(df, pd.DataFrame) self.assertTrue(df.index[0] < df.index[-1]) temp = df.iloc[0:5, 0] == np.array( [3783324, 3627906, 5161993, 5265706, 5129724]) self.assertEqual(temp.sum(), 5)
def test_with_default_param(self): df = stock.get_shorting_investor_volume_by_date("20200106", "20200110") # 기관 개인 외국인 기타 합계 # 날짜 # 2020-01-06 3783324 215700 9213745 0 13212769 # 2020-01-07 3627906 270121 7112215 0 11010242 # 2020-01-08 5161993 284087 13164830 0 18610910 # 2020-01-09 5265706 271622 11138406 0 16675734 # 2020-01-10 5129724 141885 7849543 0 13121152 self.assertIsInstance(df, pd.DataFrame) self.assertTrue(df.index[0] < df.index[-1]) temp = df.iloc[0:5, 0] == np.array( [3783324, 3627906, 5161993, 5265706, 5129724]) self.assertEqual(temp.sum(), 5)
def test_not_empty_result(self): df = stock.get_shorting_investor_volume_by_date( "20190401", "20190405", "KOSPI") self.assertNotEqual(df.empty, True) df = stock.get_shorting_investor_price_by_date("20190401", "20190405", "KOSPI") self.assertNotEqual(df.empty, True) df = stock.get_shorting_volume_top50("20190401", "KOSPI") self.assertNotEqual(df.empty, True) df = stock.get_shorting_balance_top50("20190401", "KOSPI") self.assertNotEqual(df.empty, True)