-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_candle_data.py
33 lines (24 loc) · 996 Bytes
/
update_candle_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This is a script to continually update the candle data for the given assets.
# Data will be stored locally in the 'data' folder.
from typing import Tuple, ClassVar
from apscheduler.schedulers.blocking import BlockingScheduler
from core import GeminiMarket
class AssetGroup(object):
assets: ClassVar[Tuple[str, ...]] = ('btcusd', 'ethusd', 'dogeusd', 'dogeusd', 'avaxusd',
'solusd')
instances: Tuple[GeminiMarket, ...]
def __init__(self):
self.instances = tuple(GeminiMarket(asset, '', '') for asset in self.assets)
def update_all(self):
for instance in self.instances:
instance.update()
if __name__ == '__main__':
group = AssetGroup()
scheduler = BlockingScheduler()
try:
print('Starting...')
scheduler.add_job(group.update_all, 'interval', seconds=30)
scheduler.start()
except KeyboardInterrupt:
print("Shutting Down...")
scheduler.shutdown()