05/31 Phase 6
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Cron script: save monthly net worth snapshot.
|
||||
Run by systemd timer pfm-snapshot.timer on 1st of each month at 00:05.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app import create_app
|
||||
from app.services.report_service import take_net_worth_snapshot
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
print('[snapshot] Saving net worth snapshot...')
|
||||
snap = take_net_worth_snapshot()
|
||||
print(f'[snapshot] Net worth on {snap.snapshot_date}: '
|
||||
f'assets={snap.total_assets}, '
|
||||
f'liabilities={snap.total_liabilities}, '
|
||||
f'net={snap.net_worth}')
|
||||
Reference in New Issue
Block a user