Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
twelvedata
Advanced tools
Readme
A npm package to access Twelve Data's stock market APIs. NodeJS and Browser (Vanila JS or frameworks like ReactJS) supported using Javascript or Typescript.
Install
$ yarn add twelvedata
// or
$ npm install twelvedata --save
Import on NodeJS or ReactJS
// CommonJS import for NodeJS.
const twelvedata = require("twelvedata");
// or
// ES6 import for React/NodeJS versions > 15.3.0
import twelvedata from "twelvedata";
// "type": "module" on your package.json file will be required.
Load straight on the browser in your HTML page
// Your .html file
<script type="module" src="./app.js"></script>
// App.js file
import twelvedata from "https://unpkg.com/twelvedata@latest/dist-esm/twelvedata.js?module";
Use it
// setup the config
const config = {
key: "API_KEY",
};
// initialize and use the client
const client = twelvedata(config);
// time series
let params = {
symbol: "AAPL",
interval: "1min",
outputsize: 5,
};
client
.timeSeries(params)
.then((data) => {
// consume array of data
})
.catch((error) => {
// handle error
});
// earnings
params = {
symbol: "AAPL",
};
client
.earnings(params)
.then((data) => {
// use earnings data
})
.catch((error) => {
// handle error
});
// api usage
client
.apiUsage()
.then((data) => {
console.log(data);
// {"timestamp":"2020-10-07 03:53:25","current_usage":0,"plan_limit":55}
})
.catch((error) => {
// handle error
});
// complex data (batched requests)
params = {
symbols: ["AAPL", "MSFT", "GOOG"],
intervals: ["5min", "1day"],
outputsize: 5,
methods: [
"time_series",
{
name: "ema",
time_period: 12,
},
],
};
client
.complexData(params)
.then((data) => {
// consume array of data
})
.catch((error) => {
// handle error
});
// price
params = {
symbol: "AAPL",
};
client
.price(params)
.then((data) => {
console.log(data);
// {"price":"113.16000"}
})
.catch((error) => {
// handle error
});
// technical indicators
params = {
symbol: "AAPL",
interval: "1min",
outputsize: 5,
indicator: "stoch",
};
client
.technicalIndicators(params)
.then((data) => {
// use technical indicator data
})
.catch((error) => {
// handle error
});
The available API methods are following an universal approach, which is inline with the available backend endpoints.
This is NOT an official Twelve Data library, and the authors of this library are not affiliated with Twelve Data in any way, shape or form. Twelve Data APIs and data are Copyright © 2020 Twelve Data Pte. Ltd.
If you want to contribute, feel free to submit a pull request.
If you found this project useful, consider donating.
BTC: bc1qy3vudcfalr6ur9x2wqldlxja9hjah6hts0cje5
ETH: 0x6b71bd471142f064B4A9E083f3766214999ED0D5
LTC: MNsnZ2ENbrseegGiwPcPK5KVhoh4pwLPmV
FAQs
A simple wrapper around the twelve data API
The npm package twelvedata receives a total of 71 weekly downloads. As such, twelvedata popularity was classified as not popular.
We found that twelvedata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.