Browse Source

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

* Upgrade yahoo-finance2 to version 3.10.0

* Update changelog
pull/5529/head
Thomas Kaul 7 days ago
committed by GitHub
parent
commit
67da647d53
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      CHANGELOG.md
  2. 42
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
  3. 8
      package-lock.json
  4. 2
      package.json

3
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/), 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). 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 ### 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`) - Migrated to the _Prisma Configuration File_ approach (`prisma.config.ts`)
- Refactored the login with access token dialog component to standalone - Refactored the login with access token dialog component to standalone
- Prefixed the `crypto`, `fs` and `path` imports with `node:` - Prefixed the `crypto`, `fs` and `path` imports with `node:`
- Upgraded `yahoo-finance2` from version `3.8.0` to `3.10.0`
### Fixed ### Fixed

42
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

@ -35,6 +35,10 @@ import {
Quote, Quote,
QuoteResponseArray QuoteResponseArray
} from 'yahoo-finance2/esm/src/modules/quote'; } 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'; import { SearchQuoteNonYahoo } from 'yahoo-finance2/esm/src/modules/search';
@Injectable() @Injectable()
@ -191,10 +195,7 @@ export class YahooFinanceService implements DataProviderInterface {
); );
try { try {
let quotes: Pick< let quotes: Price[] | Quote[] = [];
Quote,
'currency' | 'marketState' | 'regularMarketPrice' | 'symbol'
>[] = [];
try { try {
quotes = await this.yahooFinance.quote(yahooFinanceSymbols); quotes = await this.yahooFinance.quote(yahooFinanceSymbols);
@ -357,23 +358,28 @@ export class YahooFinanceService implements DataProviderInterface {
private async getQuotesWithQuoteSummary(aYahooFinanceSymbols: string[]) { private async getQuotesWithQuoteSummary(aYahooFinanceSymbols: string[]) {
const quoteSummaryPromises = aYahooFinanceSymbols.map((symbol) => { const quoteSummaryPromises = aYahooFinanceSymbols.map((symbol) => {
return this.yahooFinance.quoteSummary(symbol).catch(() => { return this.yahooFinance.quoteSummary(symbol);
Logger.error(
`Could not get quote summary for ${symbol}`,
'YahooFinanceService'
);
return null;
});
}); });
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 return false;
.filter((item) => { }
return item !== null;
}) return true;
.map(({ price }) => { }
return price; )
.map(({ value }) => {
return value.price;
}); });
} }
} }

8
package-lock.json

@ -93,7 +93,7 @@
"svgmap": "2.12.2", "svgmap": "2.12.2",
"twitter-api-v2": "1.23.0", "twitter-api-v2": "1.23.0",
"uuid": "11.1.0", "uuid": "11.1.0",
"yahoo-finance2": "3.8.0", "yahoo-finance2": "3.10.0",
"zone.js": "0.15.1" "zone.js": "0.15.1"
}, },
"devDependencies": { "devDependencies": {
@ -42071,9 +42071,9 @@
} }
}, },
"node_modules/yahoo-finance2": { "node_modules/yahoo-finance2": {
"version": "3.8.0", "version": "3.10.0",
"resolved": "https://registry.npmjs.org/yahoo-finance2/-/yahoo-finance2-3.8.0.tgz", "resolved": "https://registry.npmjs.org/yahoo-finance2/-/yahoo-finance2-3.10.0.tgz",
"integrity": "sha512-em11JOlfSg23wevm4kXs1+A/CoSWD9eg7/hKRU3zKWuPknCfE4NkIhGVb601Nokid+KPE8Q0eoXK4qgLsMIjKA==", "integrity": "sha512-0mnvefEAapMS6M3tnqLmQlyE2W38AQqByaTS09l2dawLaVU7NNc0hJ4qI4F3qi3C7MU+ZWAb8DFVKpW6Zsj0Nw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@deno/shim-deno": "~0.18.0", "@deno/shim-deno": "~0.18.0",

2
package.json

@ -139,7 +139,7 @@
"svgmap": "2.12.2", "svgmap": "2.12.2",
"twitter-api-v2": "1.23.0", "twitter-api-v2": "1.23.0",
"uuid": "11.1.0", "uuid": "11.1.0",
"yahoo-finance2": "3.8.0", "yahoo-finance2": "3.10.0",
"zone.js": "0.15.1" "zone.js": "0.15.1"
}, },
"devDependencies": { "devDependencies": {

Loading…
Cancel
Save