Skip to content

Instantly share code, notes, and snippets.

@trAve3113r
Created November 8, 2018 00:00
Show Gist options
  • Save trAve3113r/137bcf900dab6bb603a64751612e0a39 to your computer and use it in GitHub Desktop.
Save trAve3113r/137bcf900dab6bb603a64751612e0a39 to your computer and use it in GitHub Desktop.
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