EMS API

EMS - Starter Guide

This section will provide general information about the Execution Management System API (EMS API) software product and enumerate a number of features that it provides.

What is EMS API?

Execution Management System (EMS) is a software that managing orders, executions and exposure in an efficient, fast, cost-effective, and straightforward manner. An EMS allows you to route orders to multiple cryptocurrency exchanges simultaneously using a simple, robust, and unified Application Programming Interface (API).

Software can be used in 2 different ways:

  • Managed Cloud - Everything on our side. Hosted in the Cloud by CoinAPI. You manage the deployment using the REST API.
  • Self Hosted - Software on our side, on your everything else.
Dimension ComparisonManaged CloudSelf Hosted
Ease of use/installationVery easyHard
Time to marketFastSlow
DevOps team required to maintainNoYes
Order-flow sent directly to the destinationNoYes
Who manage the infrastructure (incl. monitoring)CoinAPIYou
Who optimize the latencyCoinAPIYou (CoinAPI only in software)
How to installInstruct our Cloud Mgmt APIInstall on your infrastructure

Architecture and components

An self-hosted EMS cluster can be deployed on single server or multiple servers that will span multiple geographical locations, server sites or cloud providers. In the Managed Cloud version you did not care about that as we manage the server sites to be as close to the order destinations as possible.

EMS consist of several components listed and ordered by dependency relationship:

  1. Exchange - Order destination, exchange or broker.

  2. CoinAPI EMS Edge - Software that's responsible for communicating with the single specific order destination for which is deployed. This component is exposing the EMS API for diagnostics purposes which functions visibility are limited to this single destination.

  3. CoinAPI EMS API - Software that's responsible for exposing fully functional the EMS API, maintainitng connection with all instances of CoinAPI EMS Edge.

  4. CoinAPI EMS WebUI - Web interface (GUI) to the EMS API interface. (optional)

  5. Customer Application - Customer software using the EMS API exposed by CoinAPI EMS API component.

Benefits and features

Low latency support

Specific projects usually involving High-Frequency Trading (HFT) or Market Making (MM) requiring low latency access to the order destination. EMS API was designed to have native support for this kind of activity.

For every order destination in the cluster to which the submillisecond latency is required, this components should be deployed on a single server as close as possible to the order destination:

  • CoinAPI EMS Edge

  • CoinAPI EMS API

  • Customer Application

Closest proximity can be achieved using the:

  • cloud region and/or availability zone same as the destination

  • collocation near the destination

  • cross-connect or direct-connect to the destination network infrastructure

  • shortcutting the routers, SNAT/DNAT hosts, or proxies like CloudFlare

The cluster can naturally contain other order destinations at the same time in this setup, and this fact doesn't affect the latency to the locally provisioned destination(s).

Normalized API abstraction

Our EMS API provides an abstraction layer that consolidates all supported third-party APIs into a single set of simple and robust data models and protocols. The Exchanges and the Assets are standardized using the Market Data REST API to which this product is compatible. More information about the exchanges and assets standardization can be found in the Documentation of the Market Data Product.

Industry standard protocols

Our API's can be accessed using multiple protocols widely adopted by the industry as a standard:

  • REST

  • WebSocket

  • FIX 4.4, 5.0

  • FIXT 1.1

Self-host or in Cloud

Deploy your property applications and trading algorithms in your company collocated data centers or cloud providers if you need that, otherwise let us manage the infrasturcture and focus on using the API.

Security & Privacy

Don't need to worry about the issues at the audit. Order flow, exchange API keys, or execution reports are never leave your company infrastructure as the product is self-hosted.

Multi account support

Manage unlimited number exchange accounts in the cluster (for example, on behalf of your customers).

SDK and samples for 40+ languages

We have the SDK libraries and code samples available for more than 40+ languages. Full list is available here: https://github.com/coinapi/coinapi-sdk/tree/master (opens in a new tab)

Comprehensive support

Leverage support for all market types and order types.

High quality integrations

Our integrations with third-party APIs are heavily tested and crafted with the stability and latency in mind. For several third parties, we usually use multiple protocols simultaneously or tricks to acquire valuable pieces of information faster.

Enterprise-grade support and maintenance

EMS product is fully supported and maintained to stay ahead of the curve. This approach offloading the often disliked responsibilities of the Software and DevOps Engineers in the organization and enables them to focus on the core business.

High availability

The EMS software is designed to support high-availability deployments out of the box. For each order destination, we/you deploy multiple CoinAPI EMS Edge and CoinAPI EMS API components on different servers, availability zones, or cloud/infrastructure providers. Cluster using the service discovery backend, all components are automatically detected and interconnected.

P&L and asset monitoring

Using the EMS, your organization can manage exposure and positions in real-time across all supported order destinations and build sophisticated risk management controls.

Order lifecycle

This section will describe lifecycle of the order in the EMS sofware.

Order status description

This table describes how to interpret a specific order status.

NameCan transit toStatus description
RECEIVEDREJECTED
ROUTING
The order is processed by the EMS.
ROUTINGROUTEDThe order is (on the wire) between the EMS and the Exchange.
ROUTEDREJECTED
NEW
PARTIALLY_FILLED
FILLED
CANCELED
The order has been sent to the exchange and not yet active in the order book.
NEWPARTIALLY_FILLED
FILLED
PENDING_CANCEL
CANCELED
The order is active in the book in its original state.
PENDING_CANCELNEW
PARTIALLY_FILLED
FILLED
CANCELED
The order cancelation message has been sent to the Order destination.
PARTIALLY_FILLEDFILLED
PENDING_CANCEL
CANCELED
The order is partially filled and active in the order book.
FILLEDThe order is filled and removed from the order book. This state is terminal.
CANCELEDThe order is canceled and removed from the order book. This state is terminal.
REJECTEDThe order is rejected. This state is terminal.

Order status lifecycle

This table describes how to interpret transitions between order statuses and their initial values.

Source StatusDestination statusDescription
RECEIVEDEMS received a new order via the API.
NEWEMS received an unseen new order from the Order destination. The order was relayed to the destination outside the EMS.
PARTIALLY_FILLEDEMS received unseen partially filled order from the Order destination. The order was relayed to the destination outside the EMS.
RECEIVEDREJECTEDEMS rejected the order.
RECEIVEDROUTINGEMS delivering the order to the Order destination.
ROUTINGROUTEDEMS sent the order to the Order destination.
ROUTEDREJECTEDEMS received a message from the exchange that the order was rejected.
ROUTEDNEWEMS received a message from the exchange that the order is active in the book in its original state.
ROUTEDPARTIALLY_FILLEDEMS received a message from the exchange that part of the order was executed aggressively (removed liquidity). The remaining passive part is active in the book.
ROUTEDFILLEDEMS received a message from the exchange that the order was executed aggressively (removed liquidity).
ROUTEDCANCELEDEMS received a message from the exchange that the order is in the canceled state. The order has not been in the book as the conditions for the entry were not satisfied.
NEWPARTIALLY_FILLEDEMS received a message from the exchange that part of the passive order was filled.
NEWFILLEDEMS received a message from the exchange that the passive order is filled.
NEWPENDING_CANCELEMS received cancel request for the order and successfully relayed it to the Order destination.
NEWCANCELEDEMS received a message from the exchange that the passive order was canceled.
PARTIALLY_FILLEDFILLEDEMS received a message from the exchange that the remaining part of the passive order is filled.
PARTIALLY_FILLEDPENDING_CANCELEMS received cancel request for the remaining part of the passive order and successfully relayed it to the Order destination.
PARTIALLY_FILLEDCANCELEDEMS received a message from the exchange that the remaining part of the passive order is canceled.
PENDING_CANCELNEWEMS received a message from the exchange that updated the order before processing the cancellation request or the order cancellation request was rejected.
PENDING_CANCELPARTIALLY_FILLEDEMS received a message from the exchange that updated the order before processing the cancellation request or the order cancellation request was rejected.
PENDING_CANCELFILLEDEMS received a message from the exchange that updated the order before processing the cancellation request or the order cancellation request was rejected.
PENDING_CANCELCANCELEDEMS received a message from exchange` that updated the order before processing the cancellation request or the order cancellation request was rejected.

Order parameters

This section will describe parameters of the order in the EMS sofware.

Order type

EMS supports only the LIMIT order type. Market orders don't have price protection, and because of that, they are not supported. As an alternative, you can use the Immediate or Cancel IOC order and provide the worst execution price to achieve the same result.

Time in force

Time in force is a special instruction used when placing a trade to indicate how long an order will remain active before it expires.

The table below describes how to interpret time in force parameter values.

Time in forceShortcodeDescription
GOOD_TILL_CANCELGTCA Good Till Cancel (GTC) is a default type of time-in-force. The order that lasts until is completed or canceled.
GOOD_TILL_TIME_EXCHANGEGTTEThe Good Till Time Exchange (GTTE) time in force lets you set an expiration date and time up until which an order will be active in the book. The exchange handles the execution of the cancel originated from parameter.
GOOD_TILL_TIME_OEMLGTTOThe Good Till Time OEML (GTTO) time in force lets you set an expiration date and time up until which an order will be active in the book. The CoinAPI EMS Edge sending the cancel request originated from the parameter. Worth mentioning that: (a) The cancellation request will not be sent if the software will be not be running at the time of expiration. (b) This parameter does not depend on the exchange. (c) The clock of the server running CoinAPI EMS Edge is used to trigger the cancelation request at the expiration.
FILL_OR_KILLFOKFill or kill (FOK) is a type of time in force used to instruct an exchange to execute a transaction immediately and completely or not at all. This order will only remove liquidity from the order book. It must be filled in its entirety or canceled (killed).
IMMEDIATE_OR_CANCELIOCAn immediate or cancel order (IOC) is a type of time in force used to instruct an exchange to execute all or part immediately and cancels any unfilled portion of the order. This order will only remove liquidity from the order book. It will fill whatever part of the order it can immediately and cancel any remaining amount so that no part of the order is added to the order book.

The table below displays a breakdown of the EMS support of specific time in force values by the Order destination.

Order destination idGTCGTTEGTTOFOKIOC
BINANCEXXXX
BINANCEUATXXXX
BINANCEJEXXXX
BINANCEUSXXXX
BINANCEFTSXXXX
BINANCEFTSUATXXXX
BINANCEFTSCXXXX
BINANCEFTSCUATXXXX
BINANCEOPTVXXXX
BINANCEOPTVUATXXXX
BITFINEXXXXXX
BITMEXXXXX
BITMEXUATXXXX
BITSTAMPXXXX
BLOCKCHAINEXCHANGEXXXX
COINBASEXXXX
GEMINIXXXX
HITBTCXXXXX
KRAKENXXX
KRAKENFTSXXX
POLONIEXXXXX
LMAXDIGITALXXXX
LMAXDIGITALUATXXXX
FTXXXX
FTXUSXXX
DERIBITXXXX
DERIBITUATXXXX

Legend: X - supported.

Execution instructions

Execution instruction puts restrictions on order handling at the matching engine. More than one instruction can apply to an order. The table below describes how to interpret execution instructions parameter values. Legend: X - supported.

InstructionShortcodeDescription
AUCTION_ONLYAOAn Auction Only (AO) instructs exchange that this order is for the auction only book for the next auction. The order may be cancelled up until the the auction locks, after which cancel requests will be rejected.
INDICATION_OF_INTERESTIOIAn indication of interest (IOI) instructs exchange that this order should be processed as request for liquidity from block trading market markets.
MAKER_OR_CANCELMOCA Maker or cancel (MOC) instructs exchange that this order will only add liquidity to the order book. If any part of the order could be filled immediately, the whole order will instead be rejected before any execution occurs. This instruction is also known as Post only or Participate don't initiate.
CANCEL_ON_DISCONNECTCODCancel on System Failure (Cancel on disconnect)
DO_NOT_CANCEL_ON_DISCONNECTNCODReinstate on System Failure (Do not cancel on disconnect)
DO_NOT_INCREASEDNI(Reduce only) If part of a position is closed by any other means than the reduce-only order, the reduce-only order will be automatically adjusted downwards. If the trader decides to increase their position before the reduce-only order is executed, the quantity of the reduce-only order will not increase as well.

The table below displays a breakdown of the EMS support of specific execution instructions by the Order destination.

Order destination idMOCAOIOICODNCODDNI
BINANCEX
BINANCEUATX
BINANCEJEX
BINANCEUSX
BINANCEFTSX
BINANCEFTSUATX
BINANCEFTSCX
BINANCEFTSCUATX
BINANCEOPTVX
BINANCEOPTVUATX
BITFINEXX
BITMEXX
BITMEXUATX
BITSTAMP
BLOCKCHAINEXCHANGEX
COINBASEX
GEMINIXXX
HITBTC
KRAKENFTSX
KRAKENX
POLONIEXX
LMAXDIGITALXX
LMAXDIGITALUATXX
FTXXX
FTXUSXX
DERIBITXX
DERIBITUATXX

Legend: X - supported.

Time

For all input and output time values ISO 8601 standard is used.

Format specifierDescription
yyyyThe year as a four-digit number.
MMThe month, from 01 through 12.
ddThe day of the month, from 01 through 31.
HHThe hour, using a 24-hour clock from 00 to 23.
mmThe minute, from 00 through 59.
ssThe second, from 00 through 59.
fffThe milliseconds in a date and time value.
fffffffThe ten millionths of a second in a date and time value.

Input time values are parsed using the following formats as far as possible:

  • yyyy-MM-ddTHH:mm:ss.fffffff
  • yyyy-MM-ddTHH:mm:ss.fff
  • yyyy-MM-ddTHH:mm:ss
  • yyyy-MM-ddTHH:mm
  • yyyy-MM-ddTHH
  • yyyy-MM-dd
  • yyyyMMddTHHmmssfffffff
  • yyyyMMddTHHmmssfff
  • yyyyMMddTHHmmss
  • yyyyMMddTHHmm
  • yyyyMMddTHH
  • yyyyMMdd

Output time values are formatted using the following patterns:

  1. yyyy-MM-ddTHH:mm:ss.fffffffZ
  2. yyyy-MM-dd

Copyright 2022 COINAPI LTD or its affiliates. All rights reserved.
StatusPage: