|
@ -1,5 +1,4 @@ |
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; |
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; |
|
|
import { IDataProviderHistoricalResponse } from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
@ -14,16 +13,14 @@ export class ExchangeRateService { |
|
|
}: { |
|
|
}: { |
|
|
date: Date; |
|
|
date: Date; |
|
|
symbol: string; |
|
|
symbol: string; |
|
|
}): Promise<IDataProviderHistoricalResponse> { |
|
|
}): Promise<number> { |
|
|
const [currency1, currency2] = symbol.split('-'); |
|
|
const [currency1, currency2] = symbol.split('-'); |
|
|
|
|
|
|
|
|
const marketPrice = await this.exchangeRateDataService.toCurrencyAtDate( |
|
|
return this.exchangeRateDataService.toCurrencyAtDate( |
|
|
1, |
|
|
1, |
|
|
currency1, |
|
|
currency1, |
|
|
currency2, |
|
|
currency2, |
|
|
date |
|
|
date |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return { marketPrice }; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|