Bugfix/fix fear and greed index (#359)
* Fix fear and greed index * Refactor fear and greed index symbol * GF.FEAR_AND_GREED_INDEX -> _GF_FEAR_AND_GREED_INDEX * Update changelog
This commit is contained in:
parent
63ee33b685
commit
3c46bde8d5
@ -5,6 +5,12 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the _Fear & Greed Index_ (market mood)
|
||||
|
||||
## 1.49.0 - 08.09.2021
|
||||
|
||||
### Added
|
||||
|
@ -17,7 +17,7 @@ export class SymbolService {
|
||||
const response = await this.dataProviderService.get([aSymbol]);
|
||||
const { currency, dataSource, marketPrice } = response[aSymbol] ?? {};
|
||||
|
||||
if (currency && dataSource && marketPrice) {
|
||||
if (dataSource && marketPrice) {
|
||||
return {
|
||||
dataSource,
|
||||
marketPrice,
|
||||
|
@ -1,4 +1,8 @@
|
||||
import { benchmarks, currencyPairs } from '@ghostfolio/common/config';
|
||||
import {
|
||||
benchmarks,
|
||||
currencyPairs,
|
||||
ghostfolioFearAndGreedIndexSymbol
|
||||
} from '@ghostfolio/common/config';
|
||||
import {
|
||||
DATE_FORMAT,
|
||||
getUtc,
|
||||
@ -295,7 +299,7 @@ export class DataGatheringService {
|
||||
benchmarksToGather.push({
|
||||
dataSource: DataSource.RAKUTEN,
|
||||
date: startDate,
|
||||
symbol: 'GF.FEAR_AND_GREED_INDEX'
|
||||
symbol: ghostfolioFearAndGreedIndexSymbol
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';
|
||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
|
||||
import { PrismaService } from '@ghostfolio/api/services/prisma.service';
|
||||
import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';
|
||||
import {
|
||||
DATE_FORMAT,
|
||||
getToday,
|
||||
@ -47,11 +48,11 @@ export class RakutenRapidApiService implements DataProviderInterface {
|
||||
try {
|
||||
const symbol = aSymbols[0];
|
||||
|
||||
if (symbol === 'GF.FEAR_AND_GREED_INDEX') {
|
||||
if (symbol === ghostfolioFearAndGreedIndexSymbol) {
|
||||
const fgi = await this.getFearAndGreedIndex();
|
||||
|
||||
return {
|
||||
'GF.FEAR_AND_GREED_INDEX': {
|
||||
[ghostfolioFearAndGreedIndexSymbol]: {
|
||||
currency: undefined,
|
||||
dataSource: DataSource.RAKUTEN,
|
||||
marketPrice: fgi.now.value,
|
||||
@ -82,7 +83,7 @@ export class RakutenRapidApiService implements DataProviderInterface {
|
||||
try {
|
||||
const symbol = aSymbols[0];
|
||||
|
||||
if (symbol === 'GF.FEAR_AND_GREED_INDEX') {
|
||||
if (symbol === ghostfolioFearAndGreedIndexSymbol) {
|
||||
const fgi = await this.getFearAndGreedIndex();
|
||||
|
||||
try {
|
||||
@ -118,7 +119,7 @@ export class RakutenRapidApiService implements DataProviderInterface {
|
||||
} catch {}
|
||||
|
||||
return {
|
||||
'GF.FEAR_AND_GREED_INDEX': {
|
||||
[ghostfolioFearAndGreedIndexSymbol]: {
|
||||
[format(getYesterday(), DATE_FORMAT)]: {
|
||||
marketPrice: fgi.previousClose.value
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import {
|
||||
SettingsStorageService
|
||||
} from '@ghostfolio/client/services/settings-storage.service';
|
||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||
import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';
|
||||
import {
|
||||
PortfolioPerformance,
|
||||
PortfolioSummary,
|
||||
@ -111,7 +112,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
|
||||
|
||||
if (this.hasPermissionToAccessFearAndGreedIndex) {
|
||||
this.dataService
|
||||
.fetchSymbolItem('GF.FEAR_AND_GREED_INDEX')
|
||||
.fetchSymbolItem(ghostfolioFearAndGreedIndexSymbol)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(({ marketPrice }) => {
|
||||
this.fearAndGreedIndex = marketPrice;
|
||||
|
@ -28,6 +28,7 @@ export const currencyPairs: Partial<
|
||||
|
||||
export const ghostfolioScraperApiSymbolPrefix = '_GF_';
|
||||
export const ghostfolioCashSymbol = `${ghostfolioScraperApiSymbolPrefix}CASH`;
|
||||
export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`;
|
||||
|
||||
export const locale = 'de-CH';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user