fix(stocks): Fix Yahoo provider request handling and bump dependency versions
This commit is contained in:
		@@ -1,5 +1,14 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
## 2025-09-24 - 1.6.1 - fix(stocks)
 | 
			
		||||
Fix Yahoo provider request handling and bump dependency versions
 | 
			
		||||
 | 
			
		||||
- Refactored Yahoo Finance provider to use SmartRequest.create() builder and await response.json() for HTTP responses (replaces direct getJson usage).
 | 
			
		||||
- Improved batch and single-price fetching to use the SmartRequest API, keeping User-Agent header and timeouts.
 | 
			
		||||
- Added a compile-time type-check alias to ensure IStockPrice matches tsclass.finance.IStockPrice.
 | 
			
		||||
- Bumped development and runtime dependency versions (notable bumps include @git.zone/tsbuild, @git.zone/tstest, @push.rocks/qenv, @push.rocks/smartarchive, @push.rocks/smartdata, @push.rocks/smartfile, @push.rocks/smartlog, @push.rocks/smartpath, @push.rocks/smartrequest, @tsclass/tsclass).
 | 
			
		||||
- Added .claude/settings.local.json to grant local CI permissions for a few Bash commands.
 | 
			
		||||
 | 
			
		||||
## 2025-07-12 - 1.6.0 - feat(readme)
 | 
			
		||||
Revamp documentation and package description for enhanced clarity
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							@@ -14,29 +14,29 @@
 | 
			
		||||
    "buildDocs": "(tsdoc)"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@git.zone/tsbuild": "^2.6.4",
 | 
			
		||||
    "@git.zone/tsbuild": "^2.6.8",
 | 
			
		||||
    "@git.zone/tsbundle": "^2.5.1",
 | 
			
		||||
    "@git.zone/tsrun": "^1.3.3",
 | 
			
		||||
    "@git.zone/tstest": "^2.3.1",
 | 
			
		||||
    "@git.zone/tstest": "^2.3.8",
 | 
			
		||||
    "@types/node": "^22.14.0"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@push.rocks/lik": "^6.2.2",
 | 
			
		||||
    "@push.rocks/qenv": "^6.1.0",
 | 
			
		||||
    "@push.rocks/smartarchive": "^4.0.39",
 | 
			
		||||
    "@push.rocks/qenv": "^6.1.3",
 | 
			
		||||
    "@push.rocks/smartarchive": "^4.2.2",
 | 
			
		||||
    "@push.rocks/smartarray": "^1.1.0",
 | 
			
		||||
    "@push.rocks/smartbrowser": "^2.0.8",
 | 
			
		||||
    "@push.rocks/smartdata": "^5.15.1",
 | 
			
		||||
    "@push.rocks/smartdata": "^5.16.4",
 | 
			
		||||
    "@push.rocks/smartdelay": "^3.0.5",
 | 
			
		||||
    "@push.rocks/smartfile": "^11.2.5",
 | 
			
		||||
    "@push.rocks/smartlog": "^3.1.8",
 | 
			
		||||
    "@push.rocks/smartpath": "^5.0.18",
 | 
			
		||||
    "@push.rocks/smartfile": "^11.2.7",
 | 
			
		||||
    "@push.rocks/smartlog": "^3.1.10",
 | 
			
		||||
    "@push.rocks/smartpath": "^6.0.0",
 | 
			
		||||
    "@push.rocks/smartpromise": "^4.2.3",
 | 
			
		||||
    "@push.rocks/smartrequest": "^2.1.0",
 | 
			
		||||
    "@push.rocks/smartrequest": "^4.3.1",
 | 
			
		||||
    "@push.rocks/smartstream": "^3.2.5",
 | 
			
		||||
    "@push.rocks/smartunique": "^3.0.9",
 | 
			
		||||
    "@push.rocks/smartxml": "^1.1.1",
 | 
			
		||||
    "@tsclass/tsclass": "^9.2.0"
 | 
			
		||||
    "@tsclass/tsclass": "^9.3.0"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3614
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3614
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -3,6 +3,6 @@
 | 
			
		||||
 */
 | 
			
		||||
export const commitinfo = {
 | 
			
		||||
  name: '@fin.cx/opendata',
 | 
			
		||||
  version: '1.6.0',
 | 
			
		||||
  version: '1.6.1',
 | 
			
		||||
  description: 'A comprehensive TypeScript library for accessing business data and real-time financial information. Features include German company data management with MongoDB integration, JSONL bulk processing, automated Handelsregister interactions, and real-time stock market data from multiple providers.'
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
import * as plugins from '../../plugins.js';
 | 
			
		||||
 | 
			
		||||
export interface IStockPrice {
 | 
			
		||||
  ticker: string;
 | 
			
		||||
  price: number;
 | 
			
		||||
@@ -11,6 +13,10 @@ export interface IStockPrice {
 | 
			
		||||
  exchange?: string;
 | 
			
		||||
  exchangeName?: string;
 | 
			
		||||
}
 | 
			
		||||
type CheckStockPrice = plugins.tsclass.typeFest.IsEqual<
 | 
			
		||||
  IStockPrice,
 | 
			
		||||
  plugins.tsclass.finance.IStockPrice
 | 
			
		||||
>;
 | 
			
		||||
 | 
			
		||||
export interface IStockPriceError {
 | 
			
		||||
  ticker: string;
 | 
			
		||||
@@ -27,4 +33,4 @@ export interface IStockQuoteRequest {
 | 
			
		||||
export interface IStockBatchQuoteRequest {
 | 
			
		||||
  tickers: string[];
 | 
			
		||||
  includeExtendedHours?: boolean;
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,14 +20,15 @@ export class YahooFinanceProvider implements IStockProvider {
 | 
			
		||||
  public async fetchPrice(request: IStockQuoteRequest): Promise<IStockPrice> {
 | 
			
		||||
    try {
 | 
			
		||||
      const url = `${this.baseUrl}/v8/finance/chart/${request.ticker}`;
 | 
			
		||||
      const response = await plugins.smartrequest.getJson(url, {
 | 
			
		||||
        headers: {
 | 
			
		||||
      const response = await plugins.smartrequest.SmartRequest.create()
 | 
			
		||||
        .url(url)
 | 
			
		||||
        .headers({
 | 
			
		||||
          'User-Agent': this.userAgent
 | 
			
		||||
        },
 | 
			
		||||
        timeout: this.config?.timeout || 10000
 | 
			
		||||
      });
 | 
			
		||||
        })
 | 
			
		||||
        .timeout(this.config?.timeout || 10000)
 | 
			
		||||
        .get();
 | 
			
		||||
 | 
			
		||||
      const responseData = response.body as any;
 | 
			
		||||
      const responseData = await response.json() as any;
 | 
			
		||||
      
 | 
			
		||||
      if (!responseData?.chart?.result?.[0]) {
 | 
			
		||||
        throw new Error(`No data found for ticker ${request.ticker}`);
 | 
			
		||||
@@ -66,14 +67,15 @@ export class YahooFinanceProvider implements IStockProvider {
 | 
			
		||||
      const symbols = request.tickers.join(',');
 | 
			
		||||
      const url = `${this.baseUrl}/v8/finance/spark?symbols=${symbols}&range=1d&interval=5m`;
 | 
			
		||||
      
 | 
			
		||||
      const response = await plugins.smartrequest.getJson(url, {
 | 
			
		||||
        headers: {
 | 
			
		||||
      const response = await plugins.smartrequest.SmartRequest.create()
 | 
			
		||||
        .url(url)
 | 
			
		||||
        .headers({
 | 
			
		||||
          'User-Agent': this.userAgent
 | 
			
		||||
        },
 | 
			
		||||
        timeout: this.config?.timeout || 15000
 | 
			
		||||
      });
 | 
			
		||||
        })
 | 
			
		||||
        .timeout(this.config?.timeout || 15000)
 | 
			
		||||
        .get();
 | 
			
		||||
 | 
			
		||||
      const responseData = response.body as any;
 | 
			
		||||
      const responseData = await response.json() as any;
 | 
			
		||||
      const prices: IStockPrice[] = [];
 | 
			
		||||
      
 | 
			
		||||
      for (const [ticker, data] of Object.entries(responseData)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user