add sorting and symbol as a result

pull/239/head
Valentin Zickner 3 years ago committed by Thomas
parent c88ad2c225
commit 7b696e39de

@ -25,7 +25,8 @@ export class CurrentRateService {
const dataProviderResult = await this.dataProviderService.get([symbol]);
return {
date: resetHours(date),
marketPrice: dataProviderResult?.[symbol]?.marketPrice ?? 0
marketPrice: dataProviderResult?.[symbol]?.marketPrice ?? 0,
symbol: symbol
};
}
@ -37,6 +38,7 @@ export class CurrentRateService {
if (marketData) {
return {
date: marketData.date,
symbol: marketData.symbol,
marketPrice: this.exchangeRateDataService.toCurrency(
marketData.marketPrice,
currency,
@ -65,6 +67,7 @@ export class CurrentRateService {
return marketData.map((marketDataItem) => {
return {
date: marketDataItem.date,
symbol: marketDataItem.symbol,
marketPrice: this.exchangeRateDataService.toCurrency(
marketDataItem.marketPrice,
currencies[marketDataItem.symbol],
@ -99,5 +102,6 @@ export interface GetValuesParams {
export interface GetValueObject {
date: Date;
symbol: string;
marketPrice: number;
}

@ -33,6 +33,14 @@ export class MarketDataService {
symbols: string[];
}): Promise<MarketData[]> {
return await this.prisma.marketData.findMany({
orderBy: [
{
date: 'asc'
},
{
symbol: 'asc'
}
],
where: {
date: {
gte: dateRangeStart,

Loading…
Cancel
Save