{"id":21447161,"url":"https://github.com/metaapi/metaapi-javascript-sdk","last_synced_at":"2025-04-05T21:05:11.979Z","repository":{"id":206148585,"uuid":"715904140","full_name":"metaapi/metaapi-javascript-sdk","owner":"metaapi","description":"Browser and node.js javascript SDK for MetaApi, a professional cloud forex trading API for MetaTrader platform which supports both MetaTrader MetaTrader 5 and MetaTrader 4. Free usage tier available.","archived":false,"fork":false,"pushed_at":"2025-03-21T08:02:35.000Z","size":490,"stargazers_count":48,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T20:02:40.786Z","etag":null,"topics":["api","browser","cloud","forex","javascript","metaapi","metaapi-cloud","metatrader","metatrader4","metatrader5","mt4","mt4-api","mt5","mt5-api","nodejs","rest","trading","websocket","ws"],"latest_commit_sha":null,"homepage":"https://metaapi.cloud","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metaapi.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":"2023-11-08T04:08:28.000Z","updated_at":"2025-03-27T03:20:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3946fb0-ce8f-4ae5-b67b-ce2f672d6834","html_url":"https://github.com/metaapi/metaapi-javascript-sdk","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"4ae13474bc0d311bea4a404281d8c095f1d4e797"},"previous_names":["metaapi/metaapi-javascript-sdk"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaapi%2Fmetaapi-javascript-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaapi%2Fmetaapi-javascript-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaapi%2Fmetaapi-javascript-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaapi%2Fmetaapi-javascript-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metaapi","download_url":"https://codeload.github.com/metaapi/metaapi-javascript-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399871,"owners_count":20932876,"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":["api","browser","cloud","forex","javascript","metaapi","metaapi-cloud","metatrader","metatrader4","metatrader5","mt4","mt4-api","mt5","mt5-api","nodejs","rest","trading","websocket","ws"],"created_at":"2024-11-23T03:09:03.520Z","updated_at":"2025-04-05T21:05:11.959Z","avatar_url":"https://github.com/metaapi.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# metaapi.cloud SDK for node.js and browser javascript\n\nMetaApi is a powerful, fast, cost-efficient, easy to use and standards-driven cloud forex trading API for MetaTrader 4 and MetaTrader 5 platform designed for traders, investors and forex application developers to boost forex application development process. MetaApi can be used with any broker and does not require you to be a brokerage.\n\nCopyFactory is a simple yet powerful copy-trading API which is a part of MetaApi. See below for CopyFactory readme section.\n\nMetaApi is a paid service, however we may offer a free tier access in some cases.\n\nThe [MetaApi pricing](https://metaapi.cloud/#pricing) was developed with the intent to make your charges less or equal to what you would have to pay\nfor hosting your own infrastructure. This is possible because over time we managed to heavily optimize\nour MetaTrader infrastructure. And with MetaApi you can save significantly on application development and\nmaintenance costs and time thanks to high-quality API, open-source SDKs and convenience of a cloud service.\n\nOfficial REST and websocket API documentation: [https://metaapi.cloud/docs/client/](https://metaapi.cloud/docs/client/)\n\nPlease note that this SDK provides an abstraction over REST and websocket API to simplify your application logic.\n\nFor more information about SDK APIs please check esdoc documentation in source codes located inside lib folder of this npm package.\n\n## Working code examples\nPlease check [this short video](https://youtu.be/dDOUWBjdfA4) to see how you can download samples via our web application.\n\nYou can also find code examples at [examples folder of our github repo](https://github.com/metaapi/metaapi-javascript-sdk/tree/master/examples) or in the examples folder of the npm package.\n\nWe have composed a [short guide explaining how to use the example code](https://metaapi.cloud/docs/client/usingCodeExamples/)\n\n## Installation\n```bash\nnpm install --save metaapi.cloud-sdk\n```\n\n## Installing SDK in browser SPA applications\n```bash\nnpm install --save metaapi.cloud-sdk\n```\n\nExamples of integration with : \n\n1. [Angular](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/ui/angular.md)\n2. [React](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/ui/react.md)\n3. [Vue](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/ui/vue.md)\n\n## Installing SDK in browser HTML applications\n```html\n\u003cscript src=\"unpkg.com/metaapi.cloud-sdk\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const token = '...';\n  const api = new MetaApi.default(token);\n\u003c/script\u003e\n```\n\nDetails of [integration into HTML](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/ui/html.md). \n\n## Using SDK within native [Node ECMAScript modules](https://nodejs.org/docs/latest-v20.x/api/esm.html#modules-ecmascript-modules)\n```js\nimport MetaApi from 'metaapi.cloud-sdk/esm-node';\n\nconst token = '...';\nconst api = new MetaApi(token);\n```\n\n## Connecting to MetaApi\nPlease use one of these ways: \n1. [https://app.metaapi.cloud/api-access/generate-token](https://app.metaapi.cloud/api-access/generate-token) web UI to obtain your API token.\n2. An account access token which grants access to a single account. See section below on instructions on how to retrieve account access token.\n\nSupply token to the MetaApi class constructor.\n\n```javascript\nimport MetaApi from 'metaapi.cloud-sdk';\n\nconst token = '...';\nconst api = new MetaApi(token);\n```\n\n## Retrieving account access token\nAccount access token grants access to a single account. You can retrieve account access token via [token management API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/tokenManagementApi.md#narrow-down-access-specific-applications-resources-and-roles):\n```javascript\nconst accountId = '...';\nconst validityInHours = 24;\nconst accountAccessToken = await api.tokenManagementApi.narrowDownToken(\n  {\n    applications: ['trading-account-management-api', 'copyfactory-api', 'metaapi-rest-api', 'metaapi-rpc-api', 'metaapi-real-time-streaming-api', 'metastats-api', 'risk-management-api'],\n    roles: ['reader'],\n    resources: [{entity: 'account', id: accountId}]\n  }, \n  validityInHours\n);\nconsole.log(accountAccessToken);\n```\n\nAlternatively, you can retrieve account access token via web UI. For that go to https://app.metaapi.cloud/accounts page and choose \"Account access token\" option in the trading account card actions menu.\n\n## Table of contents\n1. [MT account management](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/metaApi/managingAccounts.md)\n\n2. [MetaApi RPC API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/metaApi/rpcApi.md)\n\n3. [MetaApi real-time streaming API (websocket API)](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/metaApi/streamingApi.md)\n\n4. [Risk management API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/riskManagement.md)\n\n5. [CopyFactory copy trading API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/copyTrading.md)\n\n6. [MetaStats trading statistics API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/metaStats.md)\n\n7. [MetaApi MT manager API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/managerApi.md)\n\n8. [Tracking latencies](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/trackingLatencies.md)\n\n9. [Enable log4js logging](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/logging.md)\n\n10. [Rate limits \u0026 quotas](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/rateLimits.md)\n\n11. [Token Management API](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/tokenManagementApi.md)\n\n12. [Intergration for Web UI](https://github.com/metaapi/metaapi-javascript-sdk/blob/master/docs/ui/index.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaapi%2Fmetaapi-javascript-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetaapi%2Fmetaapi-javascript-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaapi%2Fmetaapi-javascript-sdk/lists"}