-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
28 lines (21 loc) · 874 Bytes
/
config.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
from os import environ
from typing import NamedTuple
# Lunch money auth
LUNCH_MONEY_API_KEY = environ["LUNCH_MONEY_API_KEY"]
# Wealthsimple auth
WS_USERNAME = environ["WS_USERNAME"]
WS_PASSWORD = environ["WS_PASSWORD"]
# Mapping from Wealthsimple accounts to Lunch Money assets
class AssetLink(NamedTuple):
wsAccountId: str
isWsTradeAccount: bool
lunchMoneyAssetId: str
def toAssetLink(rawAssetLink: str):
parts = rawAssetLink.split(",")
return AssetLink(parts[0], parts[1] == "True", parts[2])
ASSET_LINKS = list(map(toAssetLink, environ["ASSET_LINKS"].split(" ")))
# How often to refresh access tokens and sync data
# (25 minutes worked well in testing)
REFRESH_INTERVAL_SECS = int(environ.get("REFRESH_INTERVAL_SECS", 25 * 60))
# How many times to retry logging in before giving up
RETRY_LOGIN_TIMES = int(environ.get("RETRY_LOGIN_TIMES", 3))