Local MetaTrader Python or a hosted API?
Compare deployment, authentication, costs and cleanup when choosing local MetaTrader integration or hosted REST and WebSockets.
There are two separate decisions: where your application runs, and where the MetaTrader terminal runs. A hosted API lets those environments differ. It does not remove the broker account or the terminal from the workflow.
| Question | Local MetaTrader Python integration | MetaRPC hosted API |
|---|---|---|
| Where does Python run? | Alongside a compatible installed MetaTrader terminal and supported Python package. | Your client can run on Linux, macOS or Windows and call HTTPS or supported SDK methods. |
| Who maintains the terminal? | You manage its installation, updates, session and operating environment. | MetaRPC hosts the managed terminal. You still manage your application and broker credentials. |
| How does the client authenticate? | Through the local terminal/account connection workflow. | REST calls use the APIKey header and returned connection ID; gRPC SDKs supply their own authentication metadata. Follow your SDK's reference and keep credentials private. |
| What does it cost? | Your machine/VPS, maintenance and any broker charges. | Hosted connection usage and optional services, plus any broker charges. See the live pricing table. |
| What can fail? | Local terminal availability, account authorization, package/runtime compatibility and broker execution. | Those relevant broker conditions plus network/API availability, authentication and service balance. |
Start with one complete demo workflow.
- Choose a disposable demo account and confirm the broker server.
- Connect, then read the account summary and symbols.
- Open one small demo position only when the market and account permit it.
- Inspect the actual result and ticket. A successful HTTP response alone does not prove a fill.
- Close the test position, verify it is closed, then disconnect.
If a trade request times out, read the current orders and history before retrying. Treat an unknown result as unknown; an automatic repeat can create a second position.
Move the integration in small steps.
Keep your strategy separate from the transport layer. Map account reads, symbols, order submission and history to explicit operations, and test error handling alongside successful calls. Do not silently substitute mocked SDK output for broker data.
Try a small, bounded example.
- Read one account snapshot: connect, read balance/equity/free margin, then attempt cleanup.
- Run a terminal dashboard: six timestamped account reads, with no web server or trade controls.
- Stream quotes with an end time: stop at the event or time limit, including when no ticks arrive. This example uses gRPC.
Installation, private environment variables and cleanup checks. These examples do not place trades; hosted connection usage is still billed. Check the portal if a network failure leaves cleanup uncertain.
Watch the Python walkthrough · Browse the quote-streaming tutorial
Official MetaTrader Python reference · MetaRPC Python SDK documentation
Run the existing browser demo →