API — Application Programming Interface
How it works
Separate data access from trading permissions. Handle errors, delays, request limits and reconnection. Log timestamps, request identifiers, responses and actual executions. APIs may use REST, streaming connections or local libraries; their behaviour is not interchangeable.
Common mistake
A missing response does not prove an order failed to reach the server. Test outages and partial execution before using real capital. Do not put credentials into public code or order logs.
Further learning
In the course: 11.8 Python in trading – data analysis, automation and research. Sources: MetaTrader 5: Python integration.
Permissions and operational limits
Use the minimum required permissions, protect secrets and plan how access is revoked. A quote endpoint can be live while order submission or account updates are unavailable. Monitor each service separately and define a safe response to stale data instead of assuming that a successful connection proves the whole workflow is healthy.
FAQ
Is an API itself an automated strategy?
Can I blindly retry an order after a timeout?
No. Reconcile the original request and executions; otherwise a previously accepted instruction can be duplicated.