Home/Glossary/API — Application Programming Interface
Execution & tools

API — Application Programming Interface

A set of rules and functions allowing software to use another system’s data or services. In trading, an API may provide quotes, history and account state, and, with the appropriate permissions, accept order requests. Capabilities, authentication and limits depend on the provider. An acknowledgement that a request was accepted does not necessarily confirm an executed trade.
Example. Software submits an order for 0.10 lot but loses its connection before receiving a response. Retrying without checking state could create a second order. Robust logic reconciles identifiers and executions; idempotency works only if the particular API provides it.

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?
No. It is an interface. Strategy rules, risk management and execution controls are separate components of the software.
Can I blindly retry an order after a timeout?

No. Reconcile the original request and executions; otherwise a previously accepted instruction can be duplicated.

← Back to the full glossary

Jarosław Wasiński

Editor-in-chief, ForexMechanics.com • Macro & FX analyst

Independent analyst and practitioner with over 20 years of experience in financial markets. Actively involved in Forex since 2007, with a focus on fundamental analysis, OTC market structure, and disciplined capital risk management.

  • Creator and editor-in-chief of MyBank.pl, providing reliable financial education since 2004.
  • Author of hundreds of in-depth market commentaries, structural analyses, and educational materials for traders and investors.
  • Advocate for market transparency, promoting education grounded in hard data and institutional reports (BIS, ESMA, CFTC).

Full author profile, credentials & published research →

All content is educational and informational only – it does not constitute investment advice or a recommendation. Remember: leveraged trading (Forex/CFD) carries a high risk of rapid capital loss.