Пример #1
0
 def test_every_month(self):
     year = 2020
     for month in range(1, 13):
         days = stock.get_previous_business_days(year=year, month=month)
         self.assertNotEqual(len(days), 0)
         self.assertIsInstance(days, list)
         self.assertIsInstance(days[0], pd._libs.tslibs.timestamps.Timestamp)
Пример #2
0
def is_business_day(at: date):
    business_days = [
        date(ts.year, ts.month, ts.day)
        for ts in stock.get_previous_business_days(year=at.year,
                                                   month=at.month)
    ]
    return at in business_days
Пример #3
0
 def test_days_for_a_specified_period_of_time(self):
     days = stock.get_previous_business_days(fromdate="20200101",
                                             todate="20200115")
     self.assertNotEqual(len(days), 0)
     self.assertIsInstance(days, list)
     self.assertIsInstance(days[0], pd._libs.tslibs.timestamps.Timestamp)