|
@ -11,7 +11,10 @@ import { |
|
|
IDataProviderHistoricalResponse, |
|
|
IDataProviderHistoricalResponse, |
|
|
IDataProviderResponse |
|
|
IDataProviderResponse |
|
|
} from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
} from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config'; |
|
|
import { |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbol, |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks |
|
|
|
|
|
} from '@ghostfolio/common/config'; |
|
|
import { DATE_FORMAT, getYesterday } from '@ghostfolio/common/helper'; |
|
|
import { DATE_FORMAT, getYesterday } from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
import { |
|
|
DataProviderInfo, |
|
|
DataProviderInfo, |
|
@ -62,11 +65,16 @@ export class RapidApiService implements DataProviderInterface { |
|
|
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse }; |
|
|
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse }; |
|
|
}> { |
|
|
}> { |
|
|
try { |
|
|
try { |
|
|
if (symbol === ghostfolioFearAndGreedIndexSymbol) { |
|
|
if ( |
|
|
|
|
|
[ |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbol, |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks |
|
|
|
|
|
].includes(symbol) |
|
|
|
|
|
) { |
|
|
const fgi = await this.getFearAndGreedIndex(); |
|
|
const fgi = await this.getFearAndGreedIndex(); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
[ghostfolioFearAndGreedIndexSymbol]: { |
|
|
[symbol]: { |
|
|
[format(getYesterday(), DATE_FORMAT)]: { |
|
|
[format(getYesterday(), DATE_FORMAT)]: { |
|
|
marketPrice: fgi.previousClose.value |
|
|
marketPrice: fgi.previousClose.value |
|
|
} |
|
|
} |
|
@ -99,11 +107,16 @@ export class RapidApiService implements DataProviderInterface { |
|
|
try { |
|
|
try { |
|
|
const symbol = symbols[0]; |
|
|
const symbol = symbols[0]; |
|
|
|
|
|
|
|
|
if (symbol === ghostfolioFearAndGreedIndexSymbol) { |
|
|
if ( |
|
|
|
|
|
[ |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbol, |
|
|
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks |
|
|
|
|
|
].includes(symbol) |
|
|
|
|
|
) { |
|
|
const fgi = await this.getFearAndGreedIndex(); |
|
|
const fgi = await this.getFearAndGreedIndex(); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
[ghostfolioFearAndGreedIndexSymbol]: { |
|
|
[symbol]: { |
|
|
currency: undefined, |
|
|
currency: undefined, |
|
|
dataSource: this.getName(), |
|
|
dataSource: this.getName(), |
|
|
marketPrice: fgi.now.value, |
|
|
marketPrice: fgi.now.value, |
|
|