npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ig-trading-api

v0.13.9

Published

IG Trading API for Node.js, written in TypeScript.

Downloads

162

Readme

IG Trading API

Language Details Code Coverage License Package Version Dependency Updates

Unofficial IG Trading API for Node.js, written in TypeScript and covered by tests.

Features

  • 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.

Installation

npm

npm install ig-trading-api

Yarn

yarn add ig-trading-api

Usage

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.

Login

import {APIClient} from 'ig-trading-api';

const client = new APIClient(APIClient.URL_LIVE, {
  apiKey: 'your-api-key',
  username: 'your-username',
  password: 'your-password',
});

Search Trading Symbol

Make sure to use IG's Epic codes to find a trading symbol:

const query = 'BITCOIN';
const response = await client.rest.market.searchMarkets(query);
console.log(response.markets[0].epic);

Show available resolutions

Check the available intervals for retrieving data:

import {APIClient, Resolution} from 'ig-trading-api';
console.log(Resolution);

Retrieve historical data

const epic = 'UC.D.MSFT.CASH.IP';
const prices = await client.rest.market.price.getPrices(epic, Resolution.DAY, 5);

Subscribe to live data

Here is how you can subscribe to live candles and other updates from IG:

More Examples

More code examples can be found in the demo directory.

Resources

IG Instrument Identifier (Epic)

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" |

Epics for testing:

| Epic | Name | Environment | Trading Time | | ------------------- | ------------------- | ----------- | ---------------------- | | ED.D.DHERGY.CASH.IP | Delivery Hero SE | Live / Demo | Germany: 09:00 - 17:30 | | UC.D.MSFT.CASH.IP | Microsoft Corp | Live / Demo | Germany: 10:00 - 03:00 | | UA.D.COINUS.CASH.IP | Coinbase Global Inc | Live | Germany: 15:30 - 22:00 |

Development Setup

You can get up and running in just a few simple steps:

  1. Run yarn (to install or update third-party dependencies)
  2. Have a look 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)
  3. Run yarn demo:login to test your credentials

Maintainers

Benny Neugebauer on Stack Exchange

Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

License

This project is MIT licensed.

⭐️ Show your support ⭐️

Please leave a star if you find this project useful.