Skip to content

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

Feature/upgrade yahoo-finance2 to version 3.10.0 (#5469)

Thomas Kaul67da647d532e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54983a2d00..79389d1f60 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@ 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).
-## 2.199.0-beta.0 - 2025-09-14
+## Unreleased
### Added
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Migrated to the _Prisma Configuration File_ approach (`prisma.config.ts`)
- Refactored the login with access token dialog component to standalone
- Prefixed the `crypto`, `fs` and `path` imports with `node:`
+- Upgraded `yahoo-finance2` from version `3.8.0` to `3.10.0`
### Fixed
diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
index 40298de15f..390449d783 100644
--- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
+++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
@@ -35,6 +35,10 @@ import {
Quote,
QuoteResponseArray
} from 'yahoo-finance2/esm/src/modules/quote';
+import {
+ Price,
+ QuoteSummaryResult
+} from 'yahoo-finance2/esm/src/modules/quoteSummary';
import { SearchQuoteNonYahoo } from 'yahoo-finance2/esm/src/modules/search';
@Injectable()
@@ -191,10 +195,7 @@ export class YahooFinanceService implements DataProviderInterface {
);
try {
- let quotes: Pick<
- Quote,
- 'currency' | 'marketState' | 'regularMarketPrice' | 'symbol'
- >[] = [];
+ let quotes: Price[] | Quote[] = [];
try {
quotes = await this.yahooFinance.quote(yahooFinanceSymbols);
@@ -357,23 +358,28 @@ export class YahooFinanceService implements DataProviderInterface {
private async getQuotesWithQuoteSummary(aYahooFinanceSymbols: string[]) {
const quoteSummaryPromises = aYahooFinanceSymbols.map((symbol) => {
- return this.yahooFinance.quoteSummary(symbol).catch(() => {
- Logger.error(
- `Could not get quote summary for ${symbol}`,
- 'YahooFinanceService'
- );
- return null;
- });
+ return this.yahooFinance.quoteSummary(symbol);
});
- const quoteSummaryItems = await Promise.all(quoteSummaryPromises);
+ const settledResults = await Promise.allSettled(quoteSummaryPromises);
+
+ return settledResults
+ .filter(
+ (result): result is PromiseFulfilledResult<QuoteSummaryResult> => {
+ if (result.status === 'rejected') {
+ Logger.error(
+ `Could not get quote summary: ${result.reason}`,
+ 'YahooFinanceService'
+ );
- return quoteSummaryItems
- .filter((item) => {
- return item !== null;
- })
- .map(({ price }) => {
- return price;
+ return false;
+ }
+
+ return true;
+ }
+ )
+ .map(({ value }) => {
+ return value.price;
});
}
}
diff --git a/package-lock.json b/package-lock.json
index d9f440703a..a7a9df6c79 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -93,7 +93,7 @@
"svgmap": "2.12.2",
"twitter-api-v2": "1.23.0",
"uuid": "11.1.0",
- "yahoo-finance2": "3.8.0",
+ "yahoo-finance2": "3.10.0",
"zone.js": "0.15.1"
},
"devDependencies": {
@@ -42071,9 +42071,9 @@
}
},
"node_modules/yahoo-finance2": {
- "version": "3.8.0",
- "resolved": "https://registry.npmjs.org/yahoo-finance2/-/yahoo-finance2-3.8.0.tgz",
- "integrity": "sha512-em11JOlfSg23wevm4kXs1+A/CoSWD9eg7/hKRU3zKWuPknCfE4NkIhGVb601Nokid+KPE8Q0eoXK4qgLsMIjKA==",
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/yahoo-finance2/-/yahoo-finance2-3.10.0.tgz",
+ "integrity": "sha512-0mnvefEAapMS6M3tnqLmQlyE2W38AQqByaTS09l2dawLaVU7NNc0hJ4qI4F3qi3C7MU+ZWAb8DFVKpW6Zsj0Nw==",
"license": "MIT",
"dependencies": {
"@deno/shim-deno": "~0.18.0",
diff --git a/package.json b/package.json
index c701a5fbdb..ac62690b9a 100644
--- a/package.json
+++ b/package.json
@@ -139,7 +139,7 @@
"svgmap": "2.12.2",
"twitter-api-v2": "1.23.0",
"uuid": "11.1.0",
- "yahoo-finance2": "3.8.0",
+ "yahoo-finance2": "3.10.0",
"zone.js": "0.15.1"
},
"devDependencies": {