Browse Source

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
pull/4916/head^2
Thomas Kaul 3 weeks ago
committed by GitHub
parent
commit
be3be20604
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 15
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

1
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()`

15
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) {

Loading…
Cancel
Save