Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/ghostfolio/commit/3a99b81ade8cb90f4929143120ec8190eda5a76f
You should set ROOT_URL correctly, otherwise the web may not work correctly.
2 changed files with
41 additions and
1 deletions
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Added a fallback to use `quoteSummary(symbol)` if `quote(symbols)` fails in the _Yahoo Finance_ service
- Added the missing `dataSource` attribute to the activities import
## 1.265.0 - 2023-05-01
@ -14,6 +14,7 @@ import { DataSource, SymbolProfile } from '@prisma/client';
import Big from 'big.js' ;
import { addDays , format , isSameDay } from 'date-fns' ;
import yahooFinance from 'yahoo-finance2' ;
import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote' ;
@Injectable ( )
export class YahooFinanceService implements DataProviderInterface {
@ -175,7 +176,23 @@ export class YahooFinanceService implements DataProviderInterface {
try {
const response : { [ symbol : string ] : IDataProviderResponse } = { } ;
const quotes = await yahooFinance . quote ( yahooFinanceSymbols ) ;
let quotes : Pick <
Quote ,
'currency' | 'marketState' | 'regularMarketPrice' | 'symbol'
> [ ] = [ ] ;
try {
quotes = await yahooFinance . quote ( yahooFinanceSymbols ) ;
} catch ( error ) {
Logger . error ( error , 'YahooFinanceService' ) ;
Logger . warn (
'Fallback to yahooFinance.quoteSummary()' ,
'YahooFinanceService'
) ;
quotes = await this . getQuotesWithQuoteSummary ( yahooFinanceSymbols ) ;
}
for ( const quote of quotes ) {
// Convert symbols back
@ -358,4 +375,26 @@ export class YahooFinanceService implements DataProviderInterface {
return value ;
}
private async getQuotesWithQuoteSummary ( aYahooFinanceSymbols : string [ ] ) {
const quoteSummaryPromises = aYahooFinanceSymbols . map ( ( symbol ) = > {
return yahooFinance . quoteSummary ( symbol ) . catch ( ( ) = > {
Logger . error (
` Could not get quote summary for ${ symbol } ` ,
'YahooFinanceService'
) ;
return null ;
} ) ;
} ) ;
const quoteSummaryItems = await Promise . all ( quoteSummaryPromises ) ;
return quoteSummaryItems
. filter ( ( item ) = > {
return item !== null ;
} )
. map ( ( { price } ) = > {
return price ;
} ) ;
}
}