Browse Source

Extend markets

pull/5076/head
Thomas Kaul 2 months ago
parent
commit
73370f092b
  1. 7
      apps/api/src/app/endpoints/market-data/market-data.controller.ts
  2. 5
      apps/client/src/app/components/markets/markets.component.ts
  3. 5
      apps/client/src/app/services/data.service.ts
  4. 2
      libs/common/src/lib/config.ts

7
apps/api/src/app/endpoints/market-data/market-data.controller.ts

@ -6,7 +6,8 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data/market-d
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
import {
ghostfolioFearAndGreedIndexDataSource,
ghostfolioFearAndGreedIndexSymbol
ghostfolioFearAndGreedIndexSymbolCryptocurrencies,
ghostfolioFearAndGreedIndexSymbolStocks
} from '@ghostfolio/common/config';
import { getCurrencyFromSymbol, isCurrency } from '@ghostfolio/common/helper';
import {
@ -59,14 +60,14 @@ export class MarketDataController {
includeHistoricalData,
dataGatheringItem: {
dataSource: 'MANUAL',
symbol: 'GF_FEAR_AND_GREED_INDEX_CRYPTO'
symbol: ghostfolioFearAndGreedIndexSymbolCryptocurrencies
}
}),
this.symbolService.get({
includeHistoricalData,
dataGatheringItem: {
dataSource: ghostfolioFearAndGreedIndexDataSource,
symbol: ghostfolioFearAndGreedIndexSymbol
symbol: ghostfolioFearAndGreedIndexSymbolStocks
}
})
]);

5
apps/client/src/app/components/markets/markets.component.ts

@ -102,10 +102,11 @@ export class MarketsComponent implements OnDestroy, OnInit {
public initialize() {
this.fearAndGreedIndex =
this.fearAndGreedIndexData[this.fearAndGreedIndexMode].marketPrice;
this.fearAndGreedIndexData[this.fearAndGreedIndexMode]?.marketPrice;
this.historicalDataItems = [
...this.fearAndGreedIndexData[this.fearAndGreedIndexMode].historicalData,
...(this.fearAndGreedIndexData[this.fearAndGreedIndexMode]
?.historicalData ?? []),
{
date: resetHours(new Date()).toISOString(),
value: this.fearAndGreedIndex

5
apps/client/src/app/services/data.service.ts

@ -498,11 +498,12 @@ export class DataService {
return this.http.get<any>('/api/v1/market-data/markets', { params }).pipe(
map((data) => {
for (const item of data.fearAndGreedIndex.CRYPTOCURRENCIES
.historicalData) {
?.historicalData ?? []) {
item.date = parseISO(item.date);
}
for (const item of data.fearAndGreedIndex.STOCKS.historicalData) {
for (const item of data.fearAndGreedIndex.STOCKS?.historicalData ??
[]) {
item.date = parseISO(item.date);
}

2
libs/common/src/lib/config.ts

@ -6,6 +6,8 @@ export const ghostfolioPrefix = 'GF';
export const ghostfolioScraperApiSymbolPrefix = `_${ghostfolioPrefix}_`;
export const ghostfolioFearAndGreedIndexDataSource = DataSource.RAPID_API;
export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`;
export const ghostfolioFearAndGreedIndexSymbolCryptocurrencies = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_CRYPTOCURRENCIES`;
export const ghostfolioFearAndGreedIndexSymbolStocks = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_STOCKS`;
export const locale = 'en-US';

Loading…
Cancel
Save