From be3be2060487e450990b67629b109a967f8789f1 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Jun 2025 10:07:06 +0200 Subject: [PATCH] Feature/set market state of exchange rate symbols to open in FMP service (#4915) * Set market state of exchange rate symbols to open * Update changelog --- CHANGELOG.md | 1 + .../financial-modeling-prep.service.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b228799..218d1cd34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the style of the assistant - Reused the value component in the data providers management of the admin control panel +- Set the market state of exchange rate symbols to `open` in the _Financial Modeling Prep_ service - Migrated the `@ghostfolio/ui/assistant` component to control flow - Migrated the `@ghostfolio/ui/value` component to control flow - Migrated the `HtmlTemplateMiddleware` to use `@Injectable()` diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts index d0e674c4d..a9f171f13 100644 --- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts +++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts @@ -22,6 +22,7 @@ import { LookupItem, LookupResponse } from '@ghostfolio/common/interfaces'; +import { MarketState } from '@ghostfolio/common/types'; import { Injectable, Logger } from '@nestjs/common'; import { @@ -378,12 +379,22 @@ export class FinancialModelingPrepService implements DataProviderInterface { ); for (const { price, symbol } of quotes) { + let marketState: MarketState = 'delayed'; + + if ( + isCurrency( + symbol.substring(0, symbol.length - DEFAULT_CURRENCY.length) + ) + ) { + marketState = 'open'; + } + response[symbol] = { + marketState, currency: currencyBySymbolMap[symbol]?.currency, dataProviderInfo: this.getDataProviderInfo(), dataSource: DataSource.FINANCIAL_MODELING_PREP, - marketPrice: price, - marketState: 'delayed' + marketPrice: price }; } } catch (error) {