Single forex trading API for all your MetaTrader accounts#
Note to reader: We aimed to create a powerful yet simple API. If you'll find a missing feature you need, please drop us a message via online chat.
MetaApi 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.
We created a PaaS application which makes it easy for our users to deploy the API. In order to launch the API for MetaTrader you'll need to add your MetaTrader account to our app. Your API server will be provisioned in automatic manner in a cloud. MetaApi provides a comprehensive set of tools via standard-based REST and Websocket APIs for interacting with the MetaTrader platform in order to create variety of classic trading applications using virtually any programming language. Primary anticipated use cases of MetaApi are creating automated trading strategies, monitoring your trading and using MetaTrader as a market data server to backtest your strategies.
MetaApi is a paid service, but API access to one MetaTrader account is free of charge.
The MetaApi pricing was developed with the intent to make your charges less or equal to what you would have to pay for hosting your own infrastructure. This is possible because over time we managed to heavily optimize our MetaTrader infrastructure. And with MetaApi you can save significantly on application development and maintenance costs and time thanks to high-quality API, open-source SDKs and convenience of a cloud service.
Official SDKs are listed on https://metaapi.cloud/sdks page. SDK simplifies application implementation by hiding some low level details of REST and websocket API. Please note that we do not cover SDKs docs in this document. Please check readme files of corresponding pacakges for SDK docs.
Working code examples#
Please check this short video to see how you can download samples via our web application.
Working code examples are also available on GitHub.
- node.js: https://github.com/agiliumtrade-ai/metaapi-node.js-sdk/tree/master/examples
- Python: https://github.com/agiliumtrade-ai/metaapi-python-sdk/tree/master/examples
- same identical API for both MT4 and MT5 platforms
- read terminal state, such as account information, positions and open orders
- read trading history (deals and history orders)
- execute trades
- stream real-time quotes
- read historical market data (coming soon)
The features described above are available for use using the RESTful API or socket.io WebSocket server (socket.io). We choose socket.io protocol for our Websocket server because socket.io clients are available on most popular programming languages.
Although you can trade via REST API, the primary intended use of REST API is creating trade monitoring applications. For automatic trading we recommend using Websocket server since it provides lower latencies and real time synchronization with terminal state.
REST APIsection describes how to interact with the terminal using the RESTful API
Websocket API (socket.io)section describes how to interact with the terminal using Websocket API
Modelssection describes the response schemas that the application uses to communicate with the client
Current level of MetaTrader feature support#
At this point we do not support some rarely used features of MetaTrader such as pending stop limit orders or close by orders. Please contact us if you need support for extra features and we will consider adding them to our platform.
Feature limitations depending on offering type#
- quote streaming in G1 and self-hosted EA offering is limited to one tick per 2.5 seconds