def main(): # cffex_rank_by_contract() # return today = datetime.datetime(2018, 6, 14) endday = datetime.datetime(2018, 6, 8) for i in range(30): from shfe_spider import getLastWeekDay weekday = getLastWeekDay(today) today = weekday if today <= endday: break print(weekday) cffex_rank(year=weekday.year, month=weekday.month, day=weekday.day) sleep(2) return
def main(): import datetime today = datetime.datetime(2018, 6, 27) endday = datetime.datetime(2018, 5, 31) for i in range(30): from shfe_spider import getLastWeekDay weekday = getLastWeekDay(today) today = weekday if today <= endday: break print(weekday) czce_scrape(year=weekday.year, month=weekday.month, day=weekday.day) from time import sleep sleep(2) # czce_scrape() # html_parse() # test2() return
def main(): # trim_df() import datetime today = datetime.datetime(2018, 6, 7) endday = datetime.datetime(2018, 5, 31) for i in range(30): from shfe_spider import getLastWeekDay weekday = getLastWeekDay(today) today = weekday if today <= endday: break print(weekday) get_dalian_ranks(year=weekday.year, month=weekday.month, day=weekday.day) from time import sleep sleep(2) return
def main(): import datetime today = datetime.datetime(2018, 6, 16) endday = datetime.datetime(2018, 5, 31) for i in range(30): from shfe_spider import getLastWeekDay weekday = getLastWeekDay(today) today = weekday if today <= endday: break print(weekday) try: czce_scrape_variety_only(year=weekday.year, month=weekday.month, day=weekday.day) except Exception as e: print(e) from time import sleep sleep(2) # czce_scrape() # html_parse() # test2() return
def main(): pool = Pool(processes=4) # cffex_rank_by_contract() # return # today = datetime.datetime.now() - datetime.timedelta(days=1) today = datetime.datetime(2018, 5, 28) today = datetime.datetime.now() endday = today - datetime.timedelta(days=4) is_holiday = ts.is_holiday(today) is_holiday = ts.is_holiday('2018-07-02') # endday = datetime.datetime(2018, 5, 28) with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: for i in range(1): from shfe_spider import getLastWeekDay ts.is_holiday(today) weekday = today is_holiday = ts.is_holiday(weekday) if weekday <= endday: break if is_holiday: continue print(weekday) executor.submit(cffex_rank, weekday.year, weekday.month, weekday.day) executor.submit(czce_scrape_v2, weekday.year, weekday.month, weekday.day) executor.submit(get_dalian_ranks, weekday.year, weekday.month, weekday.day) executor.submit(shfe_rank, weekday.year, weekday.month, weekday.day) weekday = getLastWeekDay(weekday) print("mother process ended!!!") return