05/31 Phase 4
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Cron script: update investment prices via yfinance.
|
||||
Run by systemd timer pfm-prices.timer at 4PM weekdays.
|
||||
"""
|
||||
|
||||
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.investment_service import update_prices
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
print('[fetch_prices] Starting price update...')
|
||||
updated = update_prices()
|
||||
if updated:
|
||||
for ticker, price in updated.items():
|
||||
print(f' {ticker}: {price:.4f}')
|
||||
print(f'[fetch_prices] Updated {len(updated)} ticker(s).')
|
||||
else:
|
||||
print('[fetch_prices] No tickers updated.')
|
||||
Reference in New Issue
Block a user