-
Notifications
You must be signed in to change notification settings - Fork 0
/
finance_daily.py
executable file
·47 lines (38 loc) · 1.1 KB
/
finance_daily.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
"""Run daily finance functions."""
import traceback
import portalocker
from retry.api import retry_call
import common
import fedfunds
import homes
import interactive_brokers_margin
import swtsx_market_cap
import swvxx_yield
import swygx_holdings
import wealthfront_cash_yield
class OneMethodFailed(Exception):
"""One of the methods failed with exception."""
def main():
"""Main."""
with portalocker.Lock(common.LOCKFILE, timeout=common.LOCKFILE_TIMEOUT):
exceptions = False
for method in [
fedfunds.main,
interactive_brokers_margin.main,
homes.main,
swtsx_market_cap.main,
swvxx_yield.main,
swygx_holdings.main,
wealthfront_cash_yield.main,
]:
try:
retry_call(method, delay=30, tries=4)
# pylint: disable-next=broad-exception-caught
except Exception:
traceback.print_exc()
exceptions = True
if exceptions:
raise OneMethodFailed()
if __name__ == "__main__":
main()