|
|
|
@ -409,30 +409,49 @@ export class AdminService {
|
|
|
|
|
by: ['dataSource', 'symbol']
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const marketData: AdminMarketDataItem[] = this.exchangeRateDataService
|
|
|
|
|
.getCurrencyPairs()
|
|
|
|
|
.map(({ dataSource, symbol }) => {
|
|
|
|
|
const marketDataItemCount =
|
|
|
|
|
marketDataItems.find((marketDataItem) => {
|
|
|
|
|
return (
|
|
|
|
|
marketDataItem.dataSource === dataSource &&
|
|
|
|
|
marketDataItem.symbol === symbol
|
|
|
|
|
);
|
|
|
|
|
})?._count ?? 0;
|
|
|
|
|
const marketDataPromise: Promise<AdminMarketDataItem>[] =
|
|
|
|
|
this.exchangeRateDataService
|
|
|
|
|
.getCurrencyPairs()
|
|
|
|
|
.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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
dataSource,
|
|
|
|
|
marketDataItemCount,
|
|
|
|
|
symbol,
|
|
|
|
|
assetClass: AssetClass.LIQUIDITY,
|
|
|
|
|
countriesCount: 0,
|
|
|
|
|
currency: symbol.replace(DEFAULT_CURRENCY, ''),
|
|
|
|
|
id: undefined,
|
|
|
|
|
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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|