{"id":17028408,"url":"https://github.com/bennycode/ig-trading-api","last_synced_at":"2025-03-06T14:22:28.736Z","repository":{"id":39528608,"uuid":"318649099","full_name":"bennycode/ig-trading-api","owner":"bennycode","description":"IG Trading API for Node.js, written in TypeScript.","archived":false,"fork":false,"pushed_at":"2024-09-01T02:23:49.000Z","size":2950,"stargazers_count":39,"open_issues_count":14,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-27T16:50:47.594Z","etag":null,"topics":["cfd","derivatives","finance","fintech","hacktoberfest","rest-client","trading-api"],"latest_commit_sha":null,"homepage":"https://bennycode.com/ig-trading-api/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bennycode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-04T22:27:31.000Z","updated_at":"2025-01-05T07:04:34.000Z","dependencies_parsed_at":"2024-02-01T02:45:58.669Z","dependency_job_id":"e6e534e1-5422-4219-b3aa-a277d8a93abf","html_url":"https://github.com/bennycode/ig-trading-api","commit_stats":{"total_commits":579,"total_committers":9,"mean_commits":64.33333333333333,"dds":0.3523316062176166,"last_synced_commit":"fcea3e1abadfadd0f2a0a546ce0dee8743afe45f"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fig-trading-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fig-trading-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fig-trading-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fig-trading-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bennycode","download_url":"https://codeload.github.com/bennycode/ig-trading-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242223648,"owners_count":20092281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cfd","derivatives","finance","fintech","hacktoberfest","rest-client","trading-api"],"created_at":"2024-10-14T07:54:08.256Z","updated_at":"2025-03-06T14:22:28.713Z","avatar_url":"https://github.com/bennycode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IG Trading API\n\n![Language Details](https://img.shields.io/github/languages/top/bennycode/ig-trading-api) ![Code Coverage](https://img.shields.io/codecov/c/github/bennycode/ig-trading-api/main) ![License](https://img.shields.io/npm/l/ig-trading-api.svg) ![Package Version](https://img.shields.io/npm/v/ig-trading-api.svg) ![Dependency Updates](https://img.shields.io/david/bennycode/ig-trading-api.svg)\n\nUnofficial [IG Trading API](https://labs.ig.com/rest-trading-api-guide.html) for Node.js, written in TypeScript and covered by tests.\n\n## Features\n\n- **Typed.** Source code is 100% TypeScript. No need to install external typings.\n- **Tested.** Code coverage is 100%. No surprises when using [ig-trading-api][1].\n- **Maintained.** Automated security updates. No threats from outdated dependencies.\n- **Documented.** Get started with the [generated documentation][2].\n\n## Installation\n\n**npm**\n\n```bash\nnpm install ig-trading-api\n```\n\n**Yarn**\n\n```bash\nyarn add ig-trading-api\n```\n\n## Usage\n\nYou 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.\n\n### Login\n\n```ts\nimport {APIClient} from 'ig-trading-api';\n\nconst client = new APIClient(APIClient.URL_LIVE, {\n  apiKey: 'your-api-key',\n  username: 'your-username',\n  password: 'your-password',\n});\n```\n\n### Search Trading Symbol\n\nMake sure to use [IG's Epic codes](https://trading-ig.readthedocs.io/en/latest/faq.html#how-do-i-find-the-epic-for-market-x) to find a trading symbol:\n\n```ts\nconst query = 'BITCOIN';\nconst response = await client.rest.market.searchMarkets(query);\nconsole.log(response.markets[0].epic);\n```\n\n### Show available resolutions\n\nCheck the available intervals for retrieving data:\n\n```ts\nimport {APIClient, Resolution} from 'ig-trading-api';\nconsole.log(Resolution);\n```\n\n### Retrieve historical data\n\n```ts\nconst epic = 'UC.D.MSFT.CASH.IP';\nconst prices = await client.rest.market.price.getPrices(epic, Resolution.DAY, 5);\n```\n\n### Subscribe to live data\n\nHere is how you can subscribe to live candles and other updates from IG:\n\n- [stream.ts](./src/demo/stream.ts)\n\n### More Examples\n\nMore code examples can be found in the [demo directory](./src/demo/).\n\n## Resources\n\n- [IG REST Trading API Reference](https://labs.ig.com/rest-trading-api-reference.html)\n- [IG API Companion](https://labs.ig.com/sample-apps/api-companion/index.html)\n- [IG Streaming Companion](https://labs.ig.com/sample-apps/streaming-companion/index.html)\n- [IG REST Trading API Limits](https://labs.ig.com/faq.html)\n- [Spreads, commissions and margins](https://www.ig.com/en/cfd-trading/charges-and-margins) ([in Germany](https://www.ig.com/de/hilfe-und-support/cfds/kosten-und-gebuehren/wie-lauten-die-produktinformationen-fuer-aktien-cfds#information-banner-dismiss))\n\n### IG Instrument Identifier (Epic)\n\nBreakdown for \"IX.D.DOW.DAILY.IP\":\n\n| Symbol | Description                     | Example                                                            |\n| ------ | ------------------------------- | ------------------------------------------------------------------ |\n| IX     | Hours of trading                | \"[Index Out of Hours](https://www.ig.com/uk/out-of-hours-trading)\" |\n| D      | Tradability                     | \"D\" when tradeable                                                 |\n| DOW    | Underlying market               | \"Dow Jones\"                                                        |\n| DAILY  | Indicator for processing method | \"Daily\" funded bet                                                 |\n| IP     | Asset type                      | \"Intellectual Property\"                                            |\n\nEpics for testing:\n\n| Epic                | Name                | Environment | Trading Time           |\n| ------------------- | ------------------- | ----------- | ---------------------- |\n| ED.D.DHERGY.CASH.IP | Delivery Hero SE    | Live / Demo | Germany: 09:00 - 17:30 |\n| UC.D.MSFT.CASH.IP   | Microsoft Corp      | Live / Demo | Germany: 10:00 - 03:00 |\n| UA.D.COINUS.CASH.IP | Coinbase Global Inc | Live        | Germany: 15:30 - 22:00 |\n\n## Development Setup\n\nYou can get up and running in just a few simple steps:\n\n1. Run `yarn` (to install or update third-party dependencies)\n1. Have a look at the [.env.defaults](./.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](https://github.com/mrsteele/dotenv-defaults#usage))\n1. Run `yarn demo:login` to test your credentials\n\n## Maintainers\n\n[![Benny Neugebauer on Stack Exchange][stack_exchange_bennyn_badge]][stack_exchange_bennyn_url]\n\n## Contributing\n\nContributions, issues and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/bennycode/ig-trading-api/issues).\n\n## License\n\nThis project is [MIT](./LICENSE) licensed.\n\n## ⭐️ Show your support ⭐️\n\n[Please leave a star](https://github.com/bennycode/ig-trading-api/stargazers) if you find this project useful.\n\n[1]: https://www.npmjs.com/package/ig-trading-api\n[2]: https://bennycode.com/ig-trading-api\n[stack_exchange_bennyn_badge]: https://stackexchange.com/users/flair/203782.png?theme=default\n[stack_exchange_bennyn_url]: https://stackexchange.com/users/203782/benny-neugebauer?tab=accounts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennycode%2Fig-trading-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbennycode%2Fig-trading-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennycode%2Fig-trading-api/lists"}