Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/set market state of exchange rate symbols to open in FMP service (#4915)

Thomas Kaulbe3be2060487
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11b2287994..218d1cd343 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 d0e674c4dd..a9f171f139 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) {