Feature/eliminate search request in get quotes of eod service (#3019)
* Eliminate search request to get quotes * Update changelog
This commit is contained in:
parent
a3cdb23776
commit
266c0a9a2c
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Improved the usability of the holdings table
|
- Improved the usability of the holdings table
|
||||||
- Refactored the query to filter activities of excluded accounts
|
- Refactored the query to filter activities of excluded accounts
|
||||||
|
- Eliminated the search request to get quotes in the _EOD Historical Data_ service
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
- Upgraded `ng-extract-i18n-merge` from version `2.9.1` to `2.10.0`
|
- Upgraded `ng-extract-i18n-merge` from version `2.9.1` to `2.10.0`
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
IDataProviderHistoricalResponse,
|
IDataProviderHistoricalResponse,
|
||||||
IDataProviderResponse
|
IDataProviderResponse
|
||||||
} from '@ghostfolio/api/services/interfaces/interfaces';
|
} from '@ghostfolio/api/services/interfaces/interfaces';
|
||||||
|
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
||||||
import {
|
import {
|
||||||
DEFAULT_CURRENCY,
|
DEFAULT_CURRENCY,
|
||||||
REPLACE_NAME_PARTS
|
REPLACE_NAME_PARTS
|
||||||
@ -35,7 +36,8 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
private readonly URL = 'https://eodhistoricaldata.com/api';
|
private readonly URL = 'https://eodhistoricaldata.com/api';
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private readonly configurationService: ConfigurationService
|
private readonly configurationService: ConfigurationService,
|
||||||
|
private readonly symbolProfileService: SymbolProfileService
|
||||||
) {
|
) {
|
||||||
this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA');
|
this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA');
|
||||||
}
|
}
|
||||||
@ -228,27 +230,22 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
? [realTimeResponse]
|
? [realTimeResponse]
|
||||||
: realTimeResponse;
|
: realTimeResponse;
|
||||||
|
|
||||||
const searchResponse = await Promise.all(
|
const symbolProfiles = await this.symbolProfileService.getSymbolProfiles(
|
||||||
eodHistoricalDataSymbols
|
symbols.map((symbol) => {
|
||||||
.filter((symbol) => {
|
return {
|
||||||
return !symbol.endsWith('.FOREX');
|
symbol,
|
||||||
})
|
dataSource: this.getName()
|
||||||
.map((symbol) => {
|
};
|
||||||
return this.search({ query: symbol });
|
})
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const lookupItems = searchResponse.flat().map(({ items }) => {
|
|
||||||
return items[0];
|
|
||||||
});
|
|
||||||
|
|
||||||
response = quotes.reduce(
|
response = quotes.reduce(
|
||||||
(
|
(
|
||||||
result: { [symbol: string]: IDataProviderResponse },
|
result: { [symbol: string]: IDataProviderResponse },
|
||||||
{ close, code, timestamp }
|
{ close, code, timestamp }
|
||||||
) => {
|
) => {
|
||||||
const currency = lookupItems.find((lookupItem) => {
|
const currency = symbolProfiles.find(({ symbol }) => {
|
||||||
return lookupItem.symbol === code;
|
return symbol === code;
|
||||||
})?.currency;
|
})?.currency;
|
||||||
|
|
||||||
if (isNumber(close)) {
|
if (isNumber(close)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user