Comparing version 1.0.0 to 1.0.1
25
index.js
require("dotenv").config(); | ||
const URL = process.env.URL; | ||
const URL1 = process.env.URL1; // Fetch closing price | ||
const URL2 = process.env.URL2; | ||
const getClosingPrice = async (symbol) => { | ||
const res = await fetch(URL + symbol.toUpperCase()); | ||
const res = await fetch(URL1 + symbol.toUpperCase()); | ||
const data = await res.json(); | ||
const history = await fetch(URL2.replace("{}", symbol.toUpperCase())); | ||
const data2 = await history.json(); | ||
console.log(data2); | ||
if (data.info === null) return null; | ||
// Just return name, closing price and percentage change | ||
data.info === null | ||
? null | ||
: { | ||
name: data["info"]["full_name"], | ||
price: data["price"]["today_price"], | ||
percentage_change: data["price"]["percent_change"], | ||
}; | ||
const d = { | ||
name: data["info"]["full_name"], | ||
price: data["price"]["today_price"], | ||
percentage_change: data["price"]["percent_change"], | ||
}; | ||
return d; | ||
}; | ||
module.exports = { getClosingPrice }; |
{ | ||
"name": "nepse_api", | ||
"version": "1.0.0", | ||
"description": "Simple NEPSE API to get close price of Stocks", | ||
"version": "1.0.1", | ||
"description": "Simple NEPSE API Wrapper to get closing price of Stocks", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1968
5
21
1
25
3
2