Fetch account details and display
This commit is contained in:
@@ -3,6 +3,8 @@ import asyncio
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from core.clients.aggregators.nordigen import NordigenClient
|
||||
from core.models import Aggregator
|
||||
from core.util import logs
|
||||
|
||||
log = logs.get_logger("scheduling")
|
||||
@@ -12,6 +14,17 @@ INTERVAL = 5
|
||||
|
||||
async def job():
|
||||
print("Running schedule.")
|
||||
aggregators = Aggregator.objects.filter(enabled=True, fetch_accounts=True)
|
||||
for aggregator in aggregators:
|
||||
if aggregator.service == "nordigen":
|
||||
instance = await NordigenClient(aggregator)
|
||||
print("RUNNING GET ALL ACCOUNT INFO")
|
||||
await instance.get_all_account_info(store=True)
|
||||
print("FINISHED RUNNING")
|
||||
else:
|
||||
raise NotImplementedError(f"No such client library: {aggregator.service}")
|
||||
aggregator.fetch_accounts = False
|
||||
aggregator.save()
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
Reference in New Issue
Block a user