Single forex trading API for all your MetaTrader accounts#
Note: this is a technical documentation website. Commercial landing page is located here https://metaapi.cloud
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.
Pricing#
MetaApi is a paid service. A free tier is available for testing and personal use.
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#
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 packages 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/metaapi/metaapi-javascript-sdk/tree/master/examples
- Python: https://github.com/metaapi/metaapi-python-sdk/tree/master/examples
- Java: https://github.com/metaapi/metaapi-java-sdk/tree/master/examples
Features#
Features supported:
- 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, candles, ticks and order book
- read historical market data
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.
Documentation structure#
- the
REST API
section describes how to interact with the terminal using the RESTful API - the
Websocket API (socket.io)
section describes how to interact with the terminal using Websocket API - the
Models
section describes the response schemas that the application uses to communicate with the client
Current level of MetaTrader feature support#
At this point we have good coverage of MetaTrader features except retrieving historical market data.
Feature limitations depending on offering type#
- quote streaming in G1 is limited to one tick per 2.5 seconds
- real-time streaming of candles, ticks and access to market depth data is currently available on G1 and MT4 G2 only
- brokers with more than 5000 symbols defined are currently supported on G1 infrastructure only
- historical market data is available for G1 and MT4 G2 only
Related projects:#
Take a look at our website for the full list of APIs and features supported https://metaapi.cloud/#features
Some of the APIs you might decide to use together with MetaStats API are:
- CopyFactory copy trading API https://metaapi.cloud/docs/copyfactory/
- MetaTrader account management API https://metaapi.cloud/docs/provisioning/
- MetaStats forex trading metrics API https://metaapi.cloud/docs/metastats/
- MetaApi MT Manager API https://metaapi.cloud/docs/manager/
- MetaApi risk management API https://metaapi.cloud/docs/risk-management/