Socket
Socket
Sign inDemoInstall

yahoo-finance2

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yahoo-finance2 - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

14

dist/cjs/package.json
{
"name": "yahoo-finance2",
"version": "2.1.4",
"version": "2.1.5",
"description": "JS API for Yahoo Finance",

@@ -62,4 +62,4 @@ "type:": "commonjs",

"dependencies": {
"ajv": "8.9.0",
"ajv-formats": "^2.1.1",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
"node-fetch": "^2.6.1"

@@ -75,8 +75,8 @@ },

"@tsconfig/node12": "1.0.9",
"@types/jest": "27.4.0",
"@types/jest": "27.4.1",
"@types/node-fetch": "2.6.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-prettier": "8.4.0",
"globby": "13.1.1",

@@ -83,0 +83,0 @@ "jest": "27.5.1",

module.exports = {
"name": "yahoo-finance2",
"version": "2.1.4",
"version": "2.1.5",
"description": "JS API for Yahoo Finance",

@@ -62,4 +62,4 @@ "type:": "commonjs",

"dependencies": {
"ajv": "8.9.0",
"ajv-formats": "^2.1.1",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
"node-fetch": "^2.6.1"

@@ -75,8 +75,8 @@ },

"@tsconfig/node12": "1.0.9",
"@types/jest": "27.4.0",
"@types/jest": "27.4.1",
"@types/node-fetch": "2.6.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-prettier": "8.4.0",
"globby": "13.1.1",

@@ -83,0 +83,0 @@ "jest": "27.5.1",

@@ -10,2 +10,7 @@ declare type TransformFunc = (arg: any) => any;

/**
* If given, a runtime assertion is performed to check that the given
* argument is a string. If not, a helpful error is thrown.
*/
assertSymbol?: string;
/**
* URL of the API to query, WITHOUT query params.

@@ -12,0 +17,0 @@ */

@@ -40,2 +40,8 @@ "use strict";

const resultOpts = opts.result;
if (queryOpts.assertSymbol) {
const symbol = queryOpts.assertSymbol;
if (typeof symbol !== "string")
throw new Error(`yahooFinance.${moduleName}() expects a single string symbol as its ` +
`query, not a(n) ${typeof symbol}: ${JSON.stringify(symbol)}`);
}
// Check that query options passed by the user are valid for this module

@@ -42,0 +48,0 @@ (0, validateAndCoerceTypes_js_1.default)({

@@ -1,19 +0,1 @@

import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js";
export interface AutocResultSet {
Query: string;
Result: Array<AutocResult>;
}
export interface AutocResult {
symbol: string;
name: string;
exch: string;
type: string;
exchDisp: string;
typeDisp: string;
}
export interface AutocOptions {
region?: number;
lang?: string;
}
export default function autoc(this: ModuleThis, query: string, queryOptionsOverrides?: AutocOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<AutocResultSet>;
export default function autoc(this: ModuleThis, query: string, queryOptionsOverrides?: AutocOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;
export default function autoc(): Promise<any>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const queryOptionsDefaults = {
region: 1,
lang: "en",
};
function autoc(query, queryOptionsOverrides, moduleOptions) {
return this._moduleExec({
moduleName: "autoc",
query: {
url: "https://autoc.finance.yahoo.com/autoc",
schemaKey: "#/definitions/AutocOptions",
defaults: queryOptionsDefaults,
runtime: { query },
overrides: queryOptionsOverrides,
},
result: {
schemaKey: "#/definitions/AutocResultSet",
transformWith(result) {
if (!result.ResultSet)
throw new Error("Unexpected result: " + JSON.stringify(result));
return result.ResultSet;
},
},
moduleOptions,
function autoc() {
return __awaiter(this, void 0, void 0, function* () {
throw new Error("Yahoo decomissioned their autoc server sometime before 20 Nov 2021 " +
"(see https://github.com/gadicc/node-yahoo-finance2/issues/337])). " +
"Use `search` instead (just like they do).");
});
}
exports.default = autoc;

@@ -28,2 +28,3 @@ "use strict";

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v8/finance/chart/" + symbol,

@@ -45,2 +46,6 @@ schemaKey: "#/definitions/ChartOptions",

}
if (queryOptions.period1 === queryOptions.period2) {
throw new Error("yahooFinance.chart() options `period1` and `period2` " +
"cannot share the same value.");
}
// Don't pass this on to Yahoo

@@ -47,0 +52,0 @@ delete queryOptions.return;

@@ -12,2 +12,3 @@ "use strict";

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v7/finance/download/" + symbol,

@@ -29,2 +30,6 @@ schemaKey: "#/definitions/HistoricalOptions",

}
if (queryOptions.period1 === queryOptions.period2) {
throw new Error("yahooFinance.historical() options `period1` and `period2` " +
"cannot share the same value.");
}
return queryOptions;

@@ -31,0 +36,0 @@ },

@@ -100,3 +100,3 @@ import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js";

}
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>;
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>;
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;

@@ -9,6 +9,7 @@ "use strict";

};
function trendingSymbols(query, queryOptionsOverrides, moduleOptions) {
function trendingSymbols(symbol, queryOptionsOverrides, moduleOptions) {
return this._moduleExec({
moduleName: "insights",
query: {
assertSymbol: symbol,
url: "https://query2.finance.yahoo.com/ws/insights/v2/finance/insights",

@@ -18,3 +19,3 @@ schemaKey: "#/definitions/InsightsOptions",

overrides: queryOptionsOverrides,
runtime: { symbol: query },
runtime: { symbol },
},

@@ -21,0 +22,0 @@ result: {

@@ -12,2 +12,3 @@ "use strict";

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v7/finance/options/" + symbol,

@@ -14,0 +15,0 @@ schemaKey: "#/definitions/OptionsOptions",

@@ -47,2 +47,3 @@ "use strict";

query: {
assertSymbol: symbol,
url: "https://query2.finance.yahoo.com/v10/finance/quoteSummary/" + symbol,

@@ -49,0 +50,0 @@ schemaKey: "#/definitions/QuoteSummaryOptions",

{
"name": "yahoo-finance2",
"version": "2.1.4",
"version": "2.1.5",
"description": "JS API for Yahoo Finance",

@@ -62,4 +62,4 @@ "type": "module",

"dependencies": {
"ajv": "8.9.0",
"ajv-formats": "^2.1.1",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
"node-fetch": "^2.6.1"

@@ -75,8 +75,8 @@ },

"@tsconfig/node12": "1.0.9",
"@types/jest": "27.4.0",
"@types/jest": "27.4.1",
"@types/node-fetch": "2.6.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-prettier": "8.4.0",
"globby": "13.1.1",

@@ -83,0 +83,0 @@ "jest": "27.5.1",

export default {
"name": "yahoo-finance2",
"version": "2.1.4",
"version": "2.1.5",
"description": "JS API for Yahoo Finance",

@@ -62,4 +62,4 @@ "type": "module",

"dependencies": {
"ajv": "8.9.0",
"ajv-formats": "^2.1.1",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
"node-fetch": "^2.6.1"

@@ -75,8 +75,8 @@ },

"@tsconfig/node12": "1.0.9",
"@types/jest": "27.4.0",
"@types/jest": "27.4.1",
"@types/node-fetch": "2.6.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-prettier": "8.4.0",
"globby": "13.1.1",

@@ -83,0 +83,0 @@ "jest": "27.5.1",

@@ -10,2 +10,7 @@ declare type TransformFunc = (arg: any) => any;

/**
* If given, a runtime assertion is performed to check that the given
* argument is a string. If not, a helpful error is thrown.
*/
assertSymbol?: string;
/**
* URL of the API to query, WITHOUT query params.

@@ -12,0 +17,0 @@ */

@@ -25,2 +25,8 @@ /*

const resultOpts = opts.result;
if (queryOpts.assertSymbol) {
const symbol = queryOpts.assertSymbol;
if (typeof symbol !== "string")
throw new Error(`yahooFinance.${moduleName}() expects a single string symbol as its ` +
`query, not a(n) ${typeof symbol}: ${JSON.stringify(symbol)}`);
}
// Check that query options passed by the user are valid for this module

@@ -27,0 +33,0 @@ validateAndCoerceTypes({

@@ -1,19 +0,1 @@

import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js";
export interface AutocResultSet {
Query: string;
Result: Array<AutocResult>;
}
export interface AutocResult {
symbol: string;
name: string;
exch: string;
type: string;
exchDisp: string;
typeDisp: string;
}
export interface AutocOptions {
region?: number;
lang?: string;
}
export default function autoc(this: ModuleThis, query: string, queryOptionsOverrides?: AutocOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<AutocResultSet>;
export default function autoc(this: ModuleThis, query: string, queryOptionsOverrides?: AutocOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;
export default function autoc(): Promise<any>;

@@ -1,25 +0,5 @@

const queryOptionsDefaults = {
region: 1,
lang: "en",
};
export default function autoc(query, queryOptionsOverrides, moduleOptions) {
return this._moduleExec({
moduleName: "autoc",
query: {
url: "https://autoc.finance.yahoo.com/autoc",
schemaKey: "#/definitions/AutocOptions",
defaults: queryOptionsDefaults,
runtime: { query },
overrides: queryOptionsOverrides,
},
result: {
schemaKey: "#/definitions/AutocResultSet",
transformWith(result) {
if (!result.ResultSet)
throw new Error("Unexpected result: " + JSON.stringify(result));
return result.ResultSet;
},
},
moduleOptions,
});
export default async function autoc() {
throw new Error("Yahoo decomissioned their autoc server sometime before 20 Nov 2021 " +
"(see https://github.com/gadicc/node-yahoo-finance2/issues/337])). " +
"Use `search` instead (just like they do).");
}

@@ -16,2 +16,3 @@ // Co-authored by @gadicc, @PythonCreator27 and @huned.

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v8/finance/chart/" + symbol,

@@ -33,2 +34,6 @@ schemaKey: "#/definitions/ChartOptions",

}
if (queryOptions.period1 === queryOptions.period2) {
throw new Error("yahooFinance.chart() options `period1` and `period2` " +
"cannot share the same value.");
}
// Don't pass this on to Yahoo

@@ -35,0 +40,0 @@ delete queryOptions.return;

@@ -10,2 +10,3 @@ const queryOptionsDefaults = {

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v7/finance/download/" + symbol,

@@ -27,2 +28,6 @@ schemaKey: "#/definitions/HistoricalOptions",

}
if (queryOptions.period1 === queryOptions.period2) {
throw new Error("yahooFinance.historical() options `period1` and `period2` " +
"cannot share the same value.");
}
return queryOptions;

@@ -29,0 +34,0 @@ },

@@ -100,3 +100,3 @@ import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js";

}
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>;
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>;
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>;

@@ -7,6 +7,7 @@ const queryOptionsDefaults = {

};
export default function trendingSymbols(query, queryOptionsOverrides, moduleOptions) {
export default function trendingSymbols(symbol, queryOptionsOverrides, moduleOptions) {
return this._moduleExec({
moduleName: "insights",
query: {
assertSymbol: symbol,
url: "https://query2.finance.yahoo.com/ws/insights/v2/finance/insights",

@@ -16,3 +17,3 @@ schemaKey: "#/definitions/InsightsOptions",

overrides: queryOptionsOverrides,
runtime: { symbol: query },
runtime: { symbol },
},

@@ -19,0 +20,0 @@ result: {

@@ -10,2 +10,3 @@ const queryOptionsDefaults = {

query: {
assertSymbol: symbol,
url: "https://query1.finance.yahoo.com/v7/finance/options/" + symbol,

@@ -12,0 +13,0 @@ schemaKey: "#/definitions/OptionsOptions",

@@ -44,2 +44,3 @@ export const quoteSummary_modules = [

query: {
assertSymbol: symbol,
url: "https://query2.finance.yahoo.com/v10/finance/quoteSummary/" + symbol,

@@ -46,0 +47,0 @@ schemaKey: "#/definitions/QuoteSummaryOptions",

{
"name": "yahoo-finance2",
"version": "2.1.4",
"version": "2.1.5",
"description": "JS API for Yahoo Finance",

@@ -62,4 +62,4 @@ "type": "module",

"dependencies": {
"ajv": "8.9.0",
"ajv-formats": "^2.1.1",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
"node-fetch": "^2.6.1"

@@ -75,8 +75,8 @@ },

"@tsconfig/node12": "1.0.9",
"@types/jest": "27.4.0",
"@types/jest": "27.4.1",
"@types/node-fetch": "2.6.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-prettier": "8.4.0",
"globby": "13.1.1",

@@ -83,0 +83,0 @@ "jest": "27.5.1",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc