|
@ -30,16 +30,17 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
public async getAssetProfile( |
|
|
public async getAssetProfile( |
|
|
aSymbol: string |
|
|
aSymbol: string |
|
|
): Promise<Partial<SymbolProfile>> { |
|
|
): Promise<Partial<SymbolProfile>> { |
|
|
const { assetClass, assetSubClass, currency, name } = |
|
|
let symbol = aSymbol; |
|
|
await this.yahooFinanceDataEnhancerService.getAssetProfile(aSymbol); |
|
|
let { assetClass, assetSubClass, currency, name } = |
|
|
|
|
|
await this.yahooFinanceDataEnhancerService.getAssetProfile(symbol); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
assetClass, |
|
|
assetClass, |
|
|
assetSubClass, |
|
|
assetSubClass, |
|
|
currency, |
|
|
currency, |
|
|
name, |
|
|
name, |
|
|
dataSource: this.getName(), |
|
|
symbol, |
|
|
symbol: aSymbol |
|
|
dataSource: this.getName() |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -60,7 +61,7 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const historicalResult = await yahooFinance.historical( |
|
|
const historicalResult = await yahooFinance.historical( |
|
|
this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol( |
|
|
await this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol( |
|
|
symbol |
|
|
symbol |
|
|
), |
|
|
), |
|
|
{ |
|
|
{ |
|
@ -112,7 +113,7 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const historicalResult = await yahooFinance.historical( |
|
|
const historicalResult = await yahooFinance.historical( |
|
|
this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol( |
|
|
await this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol( |
|
|
aSymbol |
|
|
aSymbol |
|
|
), |
|
|
), |
|
|
{ |
|
|
{ |
|
@ -167,9 +168,17 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
return response; |
|
|
return response; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const yahooFinanceSymbols = symbols.map((symbol) => |
|
|
const yahooFinanceSymbols: string[] = []; |
|
|
this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol(symbol) |
|
|
const yahooFinanceSymbolMap: { [yahooFinanceSymbol: string]: string } = {}; |
|
|
|
|
|
|
|
|
|
|
|
for (const symbol of symbols) { |
|
|
|
|
|
const yahooFinanceSymbol = |
|
|
|
|
|
await this.yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol( |
|
|
|
|
|
symbol |
|
|
); |
|
|
); |
|
|
|
|
|
yahooFinanceSymbolMap[yahooFinanceSymbol] = symbol; |
|
|
|
|
|
yahooFinanceSymbols.push(yahooFinanceSymbol); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
let quotes: Pick< |
|
|
let quotes: Pick< |
|
@ -193,9 +202,10 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
for (const quote of quotes) { |
|
|
for (const quote of quotes) { |
|
|
// Convert symbols back
|
|
|
// Convert symbols back
|
|
|
const symbol = |
|
|
const symbol = |
|
|
this.yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol( |
|
|
this.yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol({ |
|
|
quote.symbol |
|
|
yahooFinanceSymbolMap, |
|
|
); |
|
|
yahooFinanceSymbol: quote.symbol |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
response[symbol] = { |
|
|
response[symbol] = { |
|
|
currency: quote.currency, |
|
|
currency: quote.currency, |
|
@ -332,9 +342,9 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const symbol = |
|
|
const symbol = |
|
|
this.yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol( |
|
|
this.yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol({ |
|
|
marketDataItem.symbol |
|
|
yahooFinanceSymbol: marketDataItem.symbol |
|
|
); |
|
|
}); |
|
|
|
|
|
|
|
|
const { assetClass, assetSubClass } = |
|
|
const { assetClass, assetSubClass } = |
|
|
this.yahooFinanceDataEnhancerService.parseAssetClass({ |
|
|
this.yahooFinanceDataEnhancerService.parseAssetClass({ |
|
|