test cpi and fomc

master
josephwang 10 months ago
parent 94ecfef63f
commit dd708154eb
  1. 42
      main.py

@ -306,6 +306,9 @@ schedules = {
convert_to_utc("2024/11/08", "02:00", 5): {"function": wrapper_function_fomc, "args": ["November", "20241108a"]},
convert_to_utc("2024/12/19", "03:00", 5): {"function": wrapper_function_fomc, "args": ["December", "20241219a"]},
convert_to_utc("2024/06/05", "17:07", 5): {"function": wrapper_function_pmi, "args": ["April"]},
convert_to_utc("2024/06/12", "16:30", 5): {"function": wrapper_function_cpi, "args": ["APRIL"]},
convert_to_utc("2024/06/12", "16:33", 5): {"function": wrapper_function_fomc, "args": ["May", "20240501a"]},
}
if __name__ == "__main__":
global nonfarm_url, cpi_url, fomc_url, pce_url, options
@ -324,28 +327,29 @@ if __name__ == "__main__":
print("Start Time:" , datetime.fromtimestamp(time.time()))
# for times, task in schedules.items():
# func = task["function"]
# args = task["args"]
# print(f"Schedule {func.__name__} at {times}")
# schedule.every().day.at(times.split(" ")[1]).do(threading.Thread(target=func, args=args).start)
# while True:
# schedule.run_pending()
# if has_broadcasted:
# print("Broadcast completed")
# has_broadcasted = False
# time.sleep(0.1) # Check every 0.1 seconds
for times, task in schedules.items():
func = task["function"]
args = task["args"]
print(f"Schedule {func.__name__} at {times}")
schedule.every().day.at(times.split(" ")[1]).do(threading.Thread(target=func, args=args).start)
while True:
schedule.run_pending()
if has_broadcasted:
print("Broadcast completed")
has_broadcasted = False
time.sleep(0.1) # Check every 0.1 seconds
#NonFarm
driver = webdriver.Chrome(options=options)
driver, date, message = find_non_farm(driver)
print("Non Farm Date")
print(date)
print("Non Farm Message")
print(message)
# driver = webdriver.Chrome(options=options)
# driver, date, message = find_non_farm(driver)
# print("Non Farm Date")
# print(date)
# print("Non Farm Message")
# print(message)
#CPI
# find_cpi("FEBRUARY")
# driver , date , message = find_cpi(driver)
# print(date)
# print(message)
#PCE
#broadcast_all_pce("February", "february-2024")
# date, message1, message2 = find_pce("february-2024")

Loading…
Cancel
Save