Feature/extend market data with currencies preset by activities count and date (#3460)

* Extend market data with currencies preset by activities count and date

* Update changelog
This commit is contained in:
Eduardo Marinho 2024-06-12 19:28:55 +01:00 committed by GitHub
parent e5d8faf2dc
commit 873fd53715
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 47 additions and 24 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Extended the historical market data table with currencies preset by date and activities count in the admin control panel
### Changed
- Improved the language localization for German (`de`)

View File

@ -409,9 +409,24 @@ export class AdminService {
by: ['dataSource', 'symbol']
});
const marketData: AdminMarketDataItem[] = this.exchangeRateDataService
const marketDataPromise: Promise<AdminMarketDataItem>[] =
this.exchangeRateDataService
.getCurrencyPairs()
.map(({ dataSource, symbol }) => {
.map(async ({ dataSource, symbol }) => {
const currency = symbol.replace(DEFAULT_CURRENCY, '');
const { _count, _min } = await this.prismaService.order.aggregate({
_count: true,
_min: {
date: true
},
where: {
SymbolProfile: {
currency
}
}
});
const marketDataItemCount =
marketDataItems.find((marketDataItem) => {
return (
@ -421,18 +436,22 @@ export class AdminService {
})?._count ?? 0;
return {
currency,
dataSource,
marketDataItemCount,
symbol,
activitiesCount: _count as number,
assetClass: AssetClass.LIQUIDITY,
assetSubClass: AssetSubClass.CASH,
countriesCount: 0,
currency: symbol.replace(DEFAULT_CURRENCY, ''),
date: _min.date,
id: undefined,
name: symbol,
sectorsCount: 0
};
});
const marketData = await Promise.all(marketDataPromise);
return { marketData, count: marketData.length };
}

View File

@ -6,13 +6,13 @@ export interface AdminMarketData {
}
export interface AdminMarketDataItem {
activitiesCount?: number;
activitiesCount: number;
assetClass?: AssetClass;
assetSubClass?: AssetSubClass;
countriesCount: number;
currency: string;
dataSource: DataSource;
date?: Date;
date: Date;
id: string;
isBenchmark?: boolean;
marketDataItemCount: number;