Created
November 8, 2018 00:00
-
-
Save trAve3113r/137bcf900dab6bb603a64751612e0a39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django_cron import CronJobBase, Schedule | |
| class FetchData(CronJobBase): | |
| #RUN_EVERY_MINS = 1 | |
| #RUN_EVERY_SECONDS = 30 :: non-existent feature | |
| # maybe we should just write a simple django-mgt comd then daemonize it | |
| RUN_AT_TIMES = trading_hours #list of hours | |
| schedule = Schedule(run_every_mins=RUN_EVERY_MINS, run_at_times=RUN_AT_TIMES) | |
| code = 'my_app.my_cron_job' # a unique code | |
| def do(self): | |
| return fetch_data | |
| class SignalHunter(CronJobBase): | |
| RUN_EVERY_MINS = 2 | |
| RUN_AT_TIMES = trading_hours | |
| schedule = Schedule(run_every_mins=RUN_EVERY_MINS, run_at_times=RUN_AT_TIMES) | |
| code = 'my_app.my_cron_job' # a unique code | |
| def do(self): | |
| pass # do your thing here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment