1.1.0 • Published 3 years ago
ig-rest-api v1.1.0
IG REST API JS Wrapper
Installation
yarn install ig-rest-api
Usage
1. Import library
// ES6
import IG from "ig-rest-api";
// Common
const IG = require("ig-rest-api");
2. Create a new instance
const ig = new IG(yourApiKey, isDemo);
3. Use
Using Promise
ig.login(username, password)
.then((res) => {
console.log(res);
//
ig.get("positions").then((positions) => {
console.log("positions:", positions);
});
})
.catch(console.error);
Using Async
try {
await ig.login(username, password);
const positions = await ig.get("positions");
console.log("positions:", positions);
} catch (error) {
console.error(error);
}