Skip to content

Commit 956ac03

Browse files
committed
Initial commit for scheduled worker
1 parent 987e63f commit 956ac03

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from investing_bot_framework.core.workers.worker import Worker
2+
from investing_bot_framework.core.workers.scheduled_worker import ScheduledWorker
3+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from abc import ABC
2+
3+
from investing_bot_framework.core.utils import TimeUnit
4+
from investing_bot_framework.core.workers.worker import Worker
5+
6+
7+
class ScheduledWorker(Worker, ABC):
8+
9+
def get_time_unit(self) -> TimeUnit:
10+
assert getattr(self, 'time_unit', None) is not None, (
11+
"{} should either include a time_unit attribute, or override the "
12+
"`get_time_unit()`, method.".format(self.__class__.__name__)
13+
)
14+
15+
return getattr(self, 'time_unit')
16+
17+
def get_time_interval(self) -> int:
18+
assert getattr(self, 'time_interval', None) is not None, (
19+
"{} should either include a time_interval attribute, or override the "
20+
"`get_time_interval()`, method.".format(self.__class__.__name__)
21+
)
22+
23+
return getattr(self, 'time_interval')

0 commit comments

Comments
 (0)