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
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Extended the historical market data table with currencies preset by date and activities count in the admin control panel
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
|
@ -409,30 +409,49 @@ export class AdminService {
|
|||||||
by: ['dataSource', 'symbol']
|
by: ['dataSource', 'symbol']
|
||||||
});
|
});
|
||||||
|
|
||||||
const marketData: AdminMarketDataItem[] = this.exchangeRateDataService
|
const marketDataPromise: Promise<AdminMarketDataItem>[] =
|
||||||
.getCurrencyPairs()
|
this.exchangeRateDataService
|
||||||
.map(({ dataSource, symbol }) => {
|
.getCurrencyPairs()
|
||||||
const marketDataItemCount =
|
.map(async ({ dataSource, symbol }) => {
|
||||||
marketDataItems.find((marketDataItem) => {
|
const currency = symbol.replace(DEFAULT_CURRENCY, '');
|
||||||
return (
|
|
||||||
marketDataItem.dataSource === dataSource &&
|
|
||||||
marketDataItem.symbol === symbol
|
|
||||||
);
|
|
||||||
})?._count ?? 0;
|
|
||||||
|
|
||||||
return {
|
const { _count, _min } = await this.prismaService.order.aggregate({
|
||||||
dataSource,
|
_count: true,
|
||||||
marketDataItemCount,
|
_min: {
|
||||||
symbol,
|
date: true
|
||||||
assetClass: AssetClass.LIQUIDITY,
|
},
|
||||||
countriesCount: 0,
|
where: {
|
||||||
currency: symbol.replace(DEFAULT_CURRENCY, ''),
|
SymbolProfile: {
|
||||||
id: undefined,
|
currency
|
||||||
name: symbol,
|
}
|
||||||
sectorsCount: 0
|
}
|
||||||
};
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
const marketDataItemCount =
|
||||||
|
marketDataItems.find((marketDataItem) => {
|
||||||
|
return (
|
||||||
|
marketDataItem.dataSource === dataSource &&
|
||||||
|
marketDataItem.symbol === symbol
|
||||||
|
);
|
||||||
|
})?._count ?? 0;
|
||||||
|
|
||||||
|
return {
|
||||||
|
currency,
|
||||||
|
dataSource,
|
||||||
|
marketDataItemCount,
|
||||||
|
symbol,
|
||||||
|
activitiesCount: _count as number,
|
||||||
|
assetClass: AssetClass.LIQUIDITY,
|
||||||
|
assetSubClass: AssetSubClass.CASH,
|
||||||
|
countriesCount: 0,
|
||||||
|
date: _min.date,
|
||||||
|
id: undefined,
|
||||||
|
name: symbol,
|
||||||
|
sectorsCount: 0
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const marketData = await Promise.all(marketDataPromise);
|
||||||
return { marketData, count: marketData.length };
|
return { marketData, count: marketData.length };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ export interface AdminMarketData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminMarketDataItem {
|
export interface AdminMarketDataItem {
|
||||||
activitiesCount?: number;
|
activitiesCount: number;
|
||||||
assetClass?: AssetClass;
|
assetClass?: AssetClass;
|
||||||
assetSubClass?: AssetSubClass;
|
assetSubClass?: AssetSubClass;
|
||||||
countriesCount: number;
|
countriesCount: number;
|
||||||
currency: string;
|
currency: string;
|
||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
date?: Date;
|
date: Date;
|
||||||
id: string;
|
id: string;
|
||||||
isBenchmark?: boolean;
|
isBenchmark?: boolean;
|
||||||
marketDataItemCount: number;
|
marketDataItemCount: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user