forked from agusalex/ghostfolio-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (24 loc) · 995 Bytes
/
main.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
import os
from SyncIBKR import SyncIBKR
SYNCIBKR = "SYNCIBKR"
DELETEALL = "DELETEALL"
GETALLACTS = "GETALLACTS"
ghost_tokens = os.environ.get('GHOST_TOKEN').split(",")
ibkr_tokens = os.environ.get("IBKR_TOKEN").split(",")
ibkr_queries = os.environ.get("IBKR_QUERY").split(",")
ghost_hosts = os.environ.get("GHOST_HOST", "https://ghostfol.io").split(",")
ghost_currency = os.environ.get("GHOST_CURRENCY", "USD").split(",")
operations = os.environ.get("OPERATION", SYNCIBKR).split(",")
if __name__ == '__main__':
for i in range(len(operations)):
ghost = SyncIBKR(ghost_hosts[i], ibkr_tokens[i], ibkr_queries[i], ghost_tokens[i], ghost_currency[i])
if operations[i] == SYNCIBKR:
print("Starting sync")
ghost.sync_ibkr()
print("End sync")
elif operations[i] == DELETEALL:
print("Starting delete")
ghost.delete_all_acts()
print("End delete")
else:
print("Unknown Operation")