gatherMarket.py 690 B

12345678910111213141516171819202122232425262728293031323334353637
  1. from market import Market
  2. from player import Player
  3. import schedule
  4. import time
  5. from datetime import datetime
  6. from logger import logger
  7. m=Market()
  8. p=Player()
  9. def jobM():
  10. logger.info("Gathering Market Data.")
  11. try:
  12. m.fetchData()
  13. m.commit()
  14. logger.info("Complete.")
  15. except Exception as e:
  16. logger.error(f"{e}")
  17. def jobP():
  18. logger.info("Gathering Player Data.")
  19. try:
  20. p.fetchData()
  21. p.commit()
  22. logger.info("Complete.")
  23. except Exception as e:
  24. logger.error(f"{e}")
  25. schedule.every(15).minutes.do(jobM)
  26. schedule.every(15).minutes.do(jobP)
  27. jobM()
  28. jobP()
  29. while 1:
  30. schedule.run_pending()
  31. time.sleep(1)