Implement transaction handling

This commit is contained in:
2023-03-13 18:49:47 +00:00
parent 780adf3bc1
commit 7d1bd75f48
12 changed files with 1098 additions and 318 deletions

View File

@@ -16,11 +16,20 @@ INTERVALS_PLATFORM = [x[0] for x in INTERVAL_CHOICES]
async def aggregator_job():
aggregators = Aggregator.objects.filter(enabled=True, fetch_accounts=True)
aggregators = Aggregator.objects.filter(enabled=True)
for aggregator in aggregators:
if aggregator.service == "nordigen":
instance = await NordigenClient(aggregator)
await instance.get_all_account_info(store=True)
if aggregator.fetch_accounts is True:
await instance.get_all_account_info(store=True)
fetch_tasks = []
for bank, accounts in aggregator.account_info.items():
for account in accounts:
account_id = account["account_id"]
task = instance.get_transactions(account_id, process=True)
fetch_tasks.append(task)
await asyncio.gather(*fetch_tasks)
else:
raise NotImplementedError(f"No such client library: {aggregator.service}")
aggregator.fetch_accounts = False