Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yahoo-nse-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yahoo-nse-api - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

lib/yahoo.charts.types.d.ts

2

lib/index.d.ts

@@ -0,3 +1,5 @@

import { YahooChartResponse } from "./yahoo.charts.types";
import { YahooQuoteResponse, YahooQuoteResult } from "./yahoo.quotes.types";
export declare const getMultipleLTPs: (symbols: string[]) => Promise<YahooQuoteResponse>;
export declare const getLTP: (symbol: string) => Promise<YahooQuoteResult>;
export declare const getHistoricalData: (symbol: string, interval: string, range: string) => Promise<YahooChartResponse>;

@@ -39,3 +39,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getLTP = exports.getMultipleLTPs = void 0;
exports.getHistoricalData = exports.getLTP = exports.getMultipleLTPs = void 0;
var fetch = function (url, init) {

@@ -89,1 +89,31 @@ return Promise.resolve().then(function () { return require("node-fetch"); }).then(function (_a) {

exports.getLTP = getLTP;
var getHistoricalData = function (symbol, interval, range) { return __awaiter(void 0, void 0, void 0, function () {
var baseV8YahooFinanceURL, symbolWithNSE, url, response, data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
validateFrame(range, "range");
validateFrame(interval, "interval");
baseV8YahooFinanceURL = "https://query1.finance.yahoo.com/v8/finance/chart/";
symbolWithNSE = symbol + ".NS";
url = "".concat(baseV8YahooFinanceURL).concat(symbolWithNSE, "?&interval=").concat(interval, "&range=").concat(range);
return [4 /*yield*/, fetch(url)];
case 1:
response = _a.sent();
return [4 /*yield*/, response.json()];
case 2:
data = _a.sent();
return [2 /*return*/, data];
}
});
}); };
exports.getHistoricalData = getHistoricalData;
function validateFrame(frame, frameType) {
// should begin with a number
// should end with either d,mo,y, or max
// should not contain any other characters
var regex = /^[0-9]+[dmy]|max$/;
if (!regex.test(frame)) {
throw new Error("Invalid" + frameType);
}
}

2

package.json
{
"name": "yahoo-nse-api",
"version": "1.0.4",
"version": "1.0.5",
"description": "A Yahoo API Wrapper for getting quotes from the national stock exchance (NSE) ",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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