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. 38
      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/),
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

38
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(() => {
return this.yahooFinance.quoteSummary(symbol);
});
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 for ${symbol}`,
`Could not get quote summary: ${result.reason}`,
'YahooFinanceService'
);
return null;
});
});
const quoteSummaryItems = await Promise.all(quoteSummaryPromises);
return false;
}
return quoteSummaryItems
.filter((item) => {
return item !== null;
})
.map(({ price }) => {
return price;
return true;
}
)
.map(({ value }) => {
return value.price;
});
}
}

8
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",

2
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": {

Loading…
Cancel
Save