Release 2.63.2 (#3138)
This commit is contained in:
parent
473136e9aa
commit
671e4e316b
@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## 2.63.1 - 2024-03-11
|
## 2.63.2 - 2024-03-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
@ -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');
|
||||||
}
|
}
|
||||||
@ -230,42 +232,54 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
? [realTimeResponse]
|
? [realTimeResponse]
|
||||||
: realTimeResponse;
|
: realTimeResponse;
|
||||||
|
|
||||||
response = quotes.reduce(
|
const symbolProfiles = await this.symbolProfileService.getSymbolProfiles(
|
||||||
async (
|
symbols.map((symbol) => {
|
||||||
result: { [symbol: string]: IDataProviderResponse },
|
return {
|
||||||
{ close, code, timestamp }
|
symbol,
|
||||||
) => {
|
dataSource: this.getName()
|
||||||
let currency: string;
|
};
|
||||||
|
})
|
||||||
if (symbols.length === 1) {
|
|
||||||
const { items } = await this.search({ query: symbols[0] });
|
|
||||||
|
|
||||||
if (items.length === 1) {
|
|
||||||
currency = items[0].currency;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNumber(close)) {
|
|
||||||
result[this.convertFromEodSymbol(code)] = {
|
|
||||||
currency,
|
|
||||||
dataSource: this.getName(),
|
|
||||||
marketPrice: close,
|
|
||||||
marketState: isToday(new Date(timestamp * 1000))
|
|
||||||
? 'open'
|
|
||||||
: 'closed'
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
Logger.error(
|
|
||||||
`Could not get quote for ${this.convertFromEodSymbol(code)} (${this.getName()})`,
|
|
||||||
'EodHistoricalDataService'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
{}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for (const { close, code, timestamp } of quotes) {
|
||||||
|
let currency: string;
|
||||||
|
|
||||||
|
if (code.endsWith('.FOREX')) {
|
||||||
|
currency = this.convertFromEodSymbol(code)?.replace(
|
||||||
|
DEFAULT_CURRENCY,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currency) {
|
||||||
|
currency = symbolProfiles.find(({ symbol }) => {
|
||||||
|
return symbol === code;
|
||||||
|
})?.currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currency) {
|
||||||
|
const { items } = await this.search({ query: code });
|
||||||
|
|
||||||
|
if (items.length === 1) {
|
||||||
|
currency = items[0].currency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNumber(close)) {
|
||||||
|
response[this.convertFromEodSymbol(code)] = {
|
||||||
|
currency,
|
||||||
|
dataSource: this.getName(),
|
||||||
|
marketPrice: close,
|
||||||
|
marketState: isToday(new Date(timestamp * 1000)) ? 'open' : 'closed'
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
Logger.error(
|
||||||
|
`Could not get quote for ${this.convertFromEodSymbol(code)} (${this.getName()})`,
|
||||||
|
'EodHistoricalDataService'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let message = error;
|
let message = error;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ghostfolio",
|
"name": "ghostfolio",
|
||||||
"version": "2.63.1",
|
"version": "2.63.2",
|
||||||
"homepage": "https://ghostfol.io",
|
"homepage": "https://ghostfol.io",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"repository": "https://github.com/ghostfolio/ghostfolio",
|
"repository": "https://github.com/ghostfolio/ghostfolio",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user