|
|
@ -40,7 +40,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
assetClass: searchResult?.assetClass,
|
|
|
|
assetClass: searchResult?.assetClass,
|
|
|
|
assetSubClass: searchResult?.assetSubClass,
|
|
|
|
assetSubClass: searchResult?.assetSubClass,
|
|
|
|
currency: searchResult?.currency,
|
|
|
|
currency: this.convertCurrency(searchResult?.currency),
|
|
|
|
dataSource: this.getName(),
|
|
|
|
dataSource: this.getName(),
|
|
|
|
isin: searchResult?.isin,
|
|
|
|
isin: searchResult?.isin,
|
|
|
|
name: searchResult?.name,
|
|
|
|
name: searchResult?.name,
|
|
|
@ -147,7 +147,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|
|
|
{ close, code, timestamp }
|
|
|
|
{ close, code, timestamp }
|
|
|
|
) => {
|
|
|
|
) => {
|
|
|
|
result[code] = {
|
|
|
|
result[code] = {
|
|
|
|
currency: searchResponse?.items[0]?.currency,
|
|
|
|
currency: this.convertCurrency(searchResponse?.items[0]?.currency),
|
|
|
|
dataSource: DataSource.EOD_HISTORICAL_DATA,
|
|
|
|
dataSource: DataSource.EOD_HISTORICAL_DATA,
|
|
|
|
marketPrice: close,
|
|
|
|
marketPrice: close,
|
|
|
|
marketState: isToday(new Date(timestamp * 1000)) ? 'open' : 'closed'
|
|
|
|
marketState: isToday(new Date(timestamp * 1000)) ? 'open' : 'closed'
|
|
|
@ -184,16 +184,26 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
assetClass,
|
|
|
|
assetClass,
|
|
|
|
assetSubClass,
|
|
|
|
assetSubClass,
|
|
|
|
currency,
|
|
|
|
|
|
|
|
dataSource,
|
|
|
|
dataSource,
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
symbol
|
|
|
|
symbol,
|
|
|
|
|
|
|
|
currency: this.convertCurrency(currency)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private convertCurrency(aCurrency: string) {
|
|
|
|
|
|
|
|
let currency = aCurrency;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currency === 'GBX') {
|
|
|
|
|
|
|
|
currency = 'GBp';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return currency;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async getSearchResult(aQuery: string): Promise<
|
|
|
|
private async getSearchResult(aQuery: string): Promise<
|
|
|
|
(LookupItem & {
|
|
|
|
(LookupItem & {
|
|
|
|
assetClass: AssetClass;
|
|
|
|
assetClass: AssetClass;
|
|
|
@ -213,14 +223,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|
|
|
const response = await get();
|
|
|
|
const response = await get();
|
|
|
|
|
|
|
|
|
|
|
|
searchResult = response.map(
|
|
|
|
searchResult = response.map(
|
|
|
|
({
|
|
|
|
({ Code, Currency, Exchange, ISIN: isin, Name: name, Type }) => {
|
|
|
|
Code,
|
|
|
|
|
|
|
|
Currency: currency,
|
|
|
|
|
|
|
|
Exchange,
|
|
|
|
|
|
|
|
ISIN: isin,
|
|
|
|
|
|
|
|
Name: name,
|
|
|
|
|
|
|
|
Type
|
|
|
|
|
|
|
|
}) => {
|
|
|
|
|
|
|
|
const { assetClass, assetSubClass } = this.parseAssetClass({
|
|
|
|
const { assetClass, assetSubClass } = this.parseAssetClass({
|
|
|
|
Exchange,
|
|
|
|
Exchange,
|
|
|
|
Type
|
|
|
|
Type
|
|
|
@ -229,9 +232,9 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
assetClass,
|
|
|
|
assetClass,
|
|
|
|
assetSubClass,
|
|
|
|
assetSubClass,
|
|
|
|
currency,
|
|
|
|
|
|
|
|
isin,
|
|
|
|
isin,
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
|
|
|
|
currency: this.convertCurrency(Currency),
|
|
|
|
dataSource: this.getName(),
|
|
|
|
dataSource: this.getName(),
|
|
|
|
symbol: `${Code}.${Exchange}`
|
|
|
|
symbol: `${Code}.${Exchange}`
|
|
|
|
};
|
|
|
|
};
|
|
|
|