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:
parent
e5d8faf2dc
commit
873fd53715
@ -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`)
|
||||
|
@ -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 };
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user