|
@ -64,7 +64,7 @@ export abstract class PortfolioCalculator { |
|
|
private endDate: Date; |
|
|
private endDate: Date; |
|
|
private exchangeRateDataService: ExchangeRateDataService; |
|
|
private exchangeRateDataService: ExchangeRateDataService; |
|
|
private filters: Filter[]; |
|
|
private filters: Filter[]; |
|
|
private portfolioService: PortfolioSnapshotService; |
|
|
private portfolioSnapshotService: PortfolioSnapshotService; |
|
|
private redisCacheService: RedisCacheService; |
|
|
private redisCacheService: RedisCacheService; |
|
|
private snapshot: PortfolioSnapshot; |
|
|
private snapshot: PortfolioSnapshot; |
|
|
private snapshotPromise: Promise<void>; |
|
|
private snapshotPromise: Promise<void>; |
|
@ -80,7 +80,7 @@ export abstract class PortfolioCalculator { |
|
|
currentRateService, |
|
|
currentRateService, |
|
|
exchangeRateDataService, |
|
|
exchangeRateDataService, |
|
|
filters, |
|
|
filters, |
|
|
portfolioService, |
|
|
portfolioSnapshotService, |
|
|
redisCacheService, |
|
|
redisCacheService, |
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { |
|
@ -91,7 +91,7 @@ export abstract class PortfolioCalculator { |
|
|
currentRateService: CurrentRateService; |
|
|
currentRateService: CurrentRateService; |
|
|
exchangeRateDataService: ExchangeRateDataService; |
|
|
exchangeRateDataService: ExchangeRateDataService; |
|
|
filters: Filter[]; |
|
|
filters: Filter[]; |
|
|
portfolioService: PortfolioSnapshotService; |
|
|
portfolioSnapshotService: PortfolioSnapshotService; |
|
|
redisCacheService: RedisCacheService; |
|
|
redisCacheService: RedisCacheService; |
|
|
userId: string; |
|
|
userId: string; |
|
|
}) { |
|
|
}) { |
|
@ -140,7 +140,7 @@ export abstract class PortfolioCalculator { |
|
|
return a.date?.localeCompare(b.date); |
|
|
return a.date?.localeCompare(b.date); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.portfolioService = portfolioService; |
|
|
this.portfolioSnapshotService = portfolioSnapshotService; |
|
|
this.redisCacheService = redisCacheService; |
|
|
this.redisCacheService = redisCacheService; |
|
|
this.userId = userId; |
|
|
this.userId = userId; |
|
|
|
|
|
|
|
@ -1078,7 +1078,7 @@ export abstract class PortfolioCalculator { |
|
|
|
|
|
|
|
|
if (isCachedPortfolioSnapshotExpired) { |
|
|
if (isCachedPortfolioSnapshotExpired) { |
|
|
// Compute in the background
|
|
|
// Compute in the background
|
|
|
this.portfolioService.addJobToQueue({ |
|
|
this.portfolioSnapshotService.addJobToQueue({ |
|
|
data: { |
|
|
data: { |
|
|
userId: this.userId |
|
|
userId: this.userId |
|
|
}, |
|
|
}, |
|
@ -1094,7 +1094,7 @@ export abstract class PortfolioCalculator { |
|
|
} else { |
|
|
} else { |
|
|
// Wait for computation
|
|
|
// Wait for computation
|
|
|
// TODO
|
|
|
// TODO
|
|
|
const job = await this.portfolioService.addJobToQueue({ |
|
|
const job = await this.portfolioSnapshotService.addJobToQueue({ |
|
|
data: { |
|
|
data: { |
|
|
userId: this.userId |
|
|
userId: this.userId |
|
|
}, |
|
|
}, |
|
|