Unofficial IG Trading API for Node.js, written in TypeScript and covered by tests.
- Typed. Source code is 100% TypeScript. No need to install external typings.
- Tested. Code coverage is 100%. No surprises when using ig-trading-api.
- Maintained. Automated security updates. No threats from outdated dependencies.
- Documented. Get started with the generated documentation.
npm
npm install ig-trading-api
Yarn
yarn add ig-trading-api
You can set the API gateway, when initializing the API client. Use APIClient.URL_DEMO
(demo-api.ig.com) for demo accounts and APIClient.URL_LIVE
(api.ig.com) for live account access.
JavaScript / Node.js
const {APIClient} = require('ig-trading-api');
const client = new APIClient(APIClient.URL_LIVE, 'your-api-key');
TypeScript
import {APIClient} from 'ig-trading-api';
const client = new APIClient(APIClient.URL_LIVE, 'your-api-key');
const session = await client.rest.login.createSession('your-username', 'your-password');
console.info(`Your client ID is "${session.clientId}".`);
Breakdown for "IX.D.DOW.DAILY.IP":
Symbol | Description | Example |
---|---|---|
IX | Hours of trading | "Index Out of Hours" |
D | Tradability | "D" when tradeable |
DOW | Underlying market | "Dow Jones" |
DAILY | Indicator for processing method | "Daily" funded bet |
IP | Asset type | "Intellectual Property" |
You can get up and running in just a few simple steps:
- Run
yarn
(to install or update third-party dependencies) - Have a lock at the .env.defaults file and make a copy (including your own credentials) with the name
.env
in the root directory of this repository (read more about dotenv files) - Run
yarn demo:login
to test your credentials
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
This project is MIT licensed.
Please leave a star if you find this project useful.