Skip to main content

REST API v2 Reference

REST API v2 lets clients and automation scripts issue and query orders and control a running Ember installation: halt and resume trading, manage risk limits and positions, and control services and FIX sessions. To enable the API and set up authentication, see REST API v2 Configuration.

Conventions​

  • Base URL: https://<monitor-host>:<port>/api/v2
  • Request and response bodies are JSON (application/json, UTF-8).
  • Decimal values (order quantity and price, position size, average cost, PnL, limits) are transferred as JSON strings to preserve full precision, for example "-1.5". Absent values are returned as null.
  • source, destination, exchange and currency are alphanumeric codes of up to 10 characters.
  • Projection path identifies a node in the position/risk tree, for example Source[FIXTRADER1]/Account[GOLD]. An empty string or an omitted value means the root level (system-wide).
  • Projection is a /-separated list of projection keys, for example Exchange/Symbol or Account/Symbol. An empty string is the root level.
  • Requests to Ember wait up to 10 seconds for a response. Order submit, replace, cancel and discard return as soon as the request is published. Their outcome is observed by querying the order.
  • Mutating requests are never retried by the server. Do not blindly retry them in clients either: a request that timed out may still have been applied. Re-read the state first.
  • Every mutating operation is written to the Ember Monitor log with the name of the user who made it.

OpenAPI Specification​

Machine-readable OpenAPI 3.1 documentation is generated by the server and requires the same credentials as the API. The document covers /api/v2.

URLDescription
/v3/api-docsOpenAPI document (JSON)
/swagger-ui.htmlInteractive Swagger UI

Use the OpenAPI document to generate typed clients.

Error Handling​

Errors return a JSON body:

{
"status": 400,
"error": "Bad Request",
"message": "Unknown projection key: Acount"
}
StatusMeaning
400 Bad RequestMalformed or invalid request (missing required field, invalid decimal, unknown projection key, risk update rejected by Ember, position query that is not a position projection)
401 UnauthorizedMissing, expired or invalid credentials. Returned by the security layer, without the JSON body above
403 ForbiddenThe caller lacks EMBER_ACCESS or the permission required by the operation, or the order source is not allowed by allowed_order_sources. A permission or source denial includes the JSON body, and the message names the permission or the claim
404 Not FoundUnknown order, service, FIX gateway or FIX session, or a risk or position projection that is not configured
429 Too Many RequestsEmber message bus is overloaded. Retry later
503 Service UnavailableEmber message bus is not available
504 Gateway TimeoutEmber did not respond within 10 seconds
500 Internal Server ErrorUnexpected failure. See the Ember Monitor log

API Reference​

Orders​

Order calls act for one order source. The source must be allowed by allowed_order_sources, or the claim must contain *. File and LDAP callers may use any source. See Order sources.

Submit, replace, cancel and discard publish the request to Ember and respond with 202 Accepted and an empty body. A rejected order is reported later as order status REJECTED.

side is BUY, SELL, SELL_SHORT, SELL_SHORT_EXEMPT or BUY_COVER. orderType is an Ember order type, for example MARKET, LIMIT, STOP or STOP_LIMIT. timeInForce defaults to DAY. instrumentType is an Ember instrument type, for example EQUITY, FX or FUTURE.

Submit Order​

POST /api/v2/orders/submit

Requires ORDER_ENTRY. Setting trader to a user other than the caller also requires ORDER_IMPERSONATE.

Request body

FieldTypeDescription
sourcestring, requiredOrder source the order is issued for
symbolstring, requiredInstrument symbol
instrumentTypeenum, requiredInstrument type
orderIdstring, requiredClient order id, unique within the source
sideenum, requiredOrder side
orderTypeenum, requiredOrder type
quantitydecimal string, requiredOrder quantity
destinationstring, optionalTrade connector or algorithm
limitPrice, stopPrice, pegDifferencedecimal string, optionalPrices required by the order type
minQuantity, displayQuantitydecimal string, optional
timeInForceenum, optionalDefaults to DAY
expireTimetimestamp, optionalISO-8601 instant. Used with GOOD_TILL_DATE
exchange, currency, accountstring, optional
party, clearingBroker, clearingAccountstring, optional
traderstring, optionalDefaults to the caller
traderGroup, moduleKey, portfolioKey, userData, quoteId, parentOrderIdstring, optional
attributesobject, optionalCustom attributes keyed by integer (FIX tag numbers are recommended)
{
"source": "ALGO1",
"destination": "SIM",
"symbol": "BTCUSD",
"instrumentType": "FX",
"orderId": "ord-1",
"side": "BUY",
"orderType": "LIMIT",
"quantity": "1.5",
"limitPrice": "100"
}

Response 202, empty body.

Replace Order​

POST /api/v2/orders/replace

Requires ORDER_ENTRY, and ORDER_IMPERSONATE when trader is not the caller. The body is a submit request plus:

FieldTypeDescription
originalOrderIdstring, requiredId of the working order being replaced
orderIdstring, requiredClient id of the replacement

Response 202, empty body.

Cancel Order​

POST /api/v2/orders/cancel

Requires ORDER_CANCEL.

FieldTypeDescription
sourcestring, requiredOrder source
orderIdstring, requiredOrder to cancel
requestIdstring, optionalId of this request. Generated when omitted
symbol, instrumentType, side, orderTypeoptionalEchoed on the cancel when set
reasonstring, optional

Response 202, empty body.

Discard Order​

POST /api/v2/orders/discard

Requires ORDER_CANCEL. Forgets the order without sending a cancel to its destination.

FieldTypeDescription
sourcestring, requiredOrder source
orderIdstring, requiredOrder to discard
symbol, instrumentType, reasonoptional

Response 202, empty body.

Get Order​

GET /api/v2/orders/status

Query parameterTypeDescription
sourcestring, requiredOrder source
orderIdstring, requiredClient order id

Response 200 – one order, in the format below. 404 when Ember does not know the order.

List Active Orders​

GET /api/v2/orders

Returns the active orders of one source.

Query parameterTypeDescription
sourcestring, requiredOrder source
symbol, account, trader, exchangestring, optionalNarrow the result

Response 200 – array of orders:

FieldTypeDescription
source, destination, orderIdstring
correlationOrderId, externalOrderId, originalOrderIdstring
statusenumFor example NEW, PARTIALLY_FILLED, COMPLETELY_FILLED, CANCELED, REJECTED
symbol, instrumentType, side, orderType
quantity, limitPrice, stopPricedecimal string
cumulativeQuantity, averagePrice, remainingQuantitydecimal string
timeInForce, expireTime
exchange, account, trader, traderGroupstring
moduleKey, portfolioKey, userDatastring
totalCommissiondecimal string
timestamptimestamp

Trading Control​

Get Trading Status​

GET /api/v2/trading/status

Returns the current kill switch state at a projection path.

Query parameterTypeDescription
projectionPathstring, optionalProjection path, for example Source[FIXTRADER1]/Account[GOLD]. Default: system-wide

Response 200

FieldTypeDescription
projectionPathstringProjection path the state belongs to. Empty means system-wide
haltedbooleantrue when trading is halted
reasonstringReason reported by the last kill switch event
{ "projectionPath": "", "halted": true, "reason": "Emergency drill by alice via Ember REST API" }

Halt Trading​

POST /api/v2/trading/halt

Halts trading system-wide or at a projection path. Requires HALT_RESUME_TRADING.

Request body

FieldTypeDescription
projectionPathstring, optionalProjection path. Empty or omitted means system-wide
reasonstring, optionalReason recorded in the audit log. Default: Trading halted
cancelOrdersboolean, optionalCancel working orders. Honored by Ember only for system-wide halt. Default: false
{ "projectionPath": "", "reason": "Emergency drill", "cancelOrders": false }

Response 200, empty body. The halt is asynchronous, use Get Trading Status to confirm it.

Resume Trading​

POST /api/v2/trading/resume

Resumes trading system-wide or at a projection path. Requires HALT_RESUME_TRADING.

Request body

FieldTypeDescription
projectionPathstring, optionalProjection path. Empty or omitted means system-wide
reasonstring, optionalReason recorded in the audit log. Default: Trading resumed

Response 200, empty body.

Risk Limits​

Get Risk Table​

GET /api/v2/risk/table

Returns the risk case table of a projection. 404 when the projection is not configured.

Query parameterTypeDescription
projectionstring, optionalProjection, for example Account/Symbol. Default: root level

Response 200

FieldTypeDescription
projectionstringProjection of the table
rowsarrayTable rows
rows[].conditionsobjectConditional columns keyed by projection key, for example {"Account": "GOLD"}
rows[].limitsobjectLimit values keyed by limit name, for example {"MaxOrderSize": "100"}. A null value means unlimited
{
"projection": "Account",
"rows": [
{ "conditions": { "Account": "GOLD" }, "limits": { "MaxOrderSize": "100", "MaxOrderNotional": null } }
]
}

Update Risk Table​

POST /api/v2/risk/update

Applies a batch of changes to a risk case table. Requires CHANGE_RISK_LIMITS. An unknown projection returns 404. If Ember rejects the update for another reason, the API returns 400 and the message is Risk update rejected: followed by the reason.

Request body

FieldTypeDescription
projectionstring, requiredProjection of the table, for example Account/Symbol. Empty string for root level
commandsarray, requiredOne or more commands, must not be empty
commands[].typeenum, requiredINSERT, UPDATE or DELETE
commands[].conditionsobject, requiredConditional columns identifying the row. Keys are projection keys and must follow the order of the projection. Use "*" as a wildcard
commands[].limitsobjectLimits to apply, for example {"MaxOrderSize": "100"}. Ignored for DELETE
{
"projection": "Account/Symbol",
"commands": [
{ "type": "UPDATE", "conditions": { "Account": "GOLD", "Symbol": "*" }, "limits": { "MaxOrderSize": "100" } },
{ "type": "DELETE", "conditions": { "Account": "SILVER", "Symbol": "*" } }
]
}

Response 200 – the risk table as it looks after the update, same format as Get Risk Table.

Positions​

Position queries follow the same allowed_order_sources rule as orders. A caller limited to specific sources must set source to one of them, and the projection must include Source. A caller whose claim is *, and file or LDAP callers, may omit source. See Order sources.

Query Positions​

POST /api/v2/positions

Returns positions of a projection. This is a read-only operation despite using POST. 404 when the projection is not configured. 400 when the projection is not a position projection, or the filter does not match the projection (Bad query condition).

Request body

FieldTypeDescription
projectionstring, requiredPosition projection configured in Ember, for example Exchange/Symbol
sourcestring, conditionalOrder source owning the position. Required unless the caller may read every source
destinationstring, optionalDestination owning the position
accountstring, optionalAccount
traderIdstring, optionalTrader
traderGroupstring, optionalTrader group
exchangestring, optionalExchange
userDatastring, optionalUser data
symbolstring, optionalInstrument. Also matches Currency and RootSymbol projections
moduleKeystring, optionalModule key
portfolioKeystring, optionalPortfolio key

Optional fields narrow the result.

{ "projection": "Source/Symbol", "source": "ALGO1" }

Response 200 – array of positions:

FieldTypeDescription
projectionstringProjection path of the position
source, destination, account, trader, traderGroup, exchange, userData, symbol, moduleKey, portfolioKeystringProjection keys of the position. Present only for keys that are part of the projection
sizedecimal stringPosition size (negative for short)
averageCostdecimal stringAverage cost
realizedPnLdecimal stringRealized PnL
unrealizedPnLdecimal stringUnrealized PnL
marketValuedecimal stringMarket value
totalCommissiondecimal stringTotal commission
openBuySizedecimal stringSize of open buy orders
openSellSizedecimal stringSize of open sell orders
[
{
"projection": "Exchange[CME]/Symbol[ESZ26]",
"exchange": "CME",
"symbol": "ESZ26",
"size": "10",
"averageCost": "6543.25",
"realizedPnL": "125.5",
"unrealizedPnL": "-12.25",
"marketValue": "65432.5",
"totalCommission": "4.2",
"openBuySize": "0",
"openSellSize": "5"
}
]

Adjust Position​

POST /api/v2/positions/adjust

Sets or changes the position at a projection path. Requires POSITION_ADJUSTMENT. The path may name any source. This operation is not limited by allowed_order_sources.

Request body

FieldTypeDescription
projectionPathstring, requiredPosition projection path, for example Source[FIXTRADER1]/Account[GOLD]. Empty for root level
sizedecimal string, requiredNew position size, or the change when relative is true
relativeboolean, optionalWhen true the size is added to the current value, otherwise it replaces it. Default: false
averageCostdecimal string, optionalNew average cost. NaN stops tracking average cost
realizedPnLdecimal string, optionalNew realized PnL. NaN stops tracking realized PnL
{ "projectionPath": "Source[FIXTRADER1]/Account[GOLD]/Symbol[ESZ26]", "size": "-1.5", "relative": true }

Response 200, empty body. An invalid decimal results in 400.

Services​

A service is a trade connector or an algorithm known to Ember.

List Services​

GET /api/v2/services

Response 200 – array of services:

FieldTypeDescription
namestringService identifier used to enable or disable it
typeenumService type (for example Algorithm or Connector)
systembooleanSystem algorithms do not accept orders
dmabooleanService provides direct market access
enabledbooleanWhether the service currently accepts orders
statusenumConnected or Disconnected. Applicable to trade connectors only
[ { "name": "FIX1", "type": "Connector", "system": false, "dma": true, "enabled": true, "status": "Connected" } ]

Get Service​

GET /api/v2/services/{name}

Returns a single service in the format above. 404 if the service is unknown.

Disable Service​

POST /api/v2/services/{name}/disable

Requires ENABLE_DISABLE_SERVICE. The request body is optional:

FieldTypeDescription
reasonstring, optionalReason recorded in the audit log. Default: Service disabled
{ "reason": "Venue maintenance window" }

Response 200, empty body.

Enable Service​

POST /api/v2/services/{name}/enable

Requires ENABLE_DISABLE_SERVICE. Same optional request body as Disable Service (default reason Service enabled). Response 200, empty body.

FIX Gateways and Sessions​

List FIX Gateways​

GET /api/v2/fix/gateways

Response 200 – array of gateways:

FieldTypeDescription
gatewayNamestringGateway name
gatewayTypeenumMarketData, OrderEntry, RFQ or TradeConnector
updateTimestamplongTime of the last update, epoch milliseconds

Get FIX Gateway​

GET /api/v2/fix/gateways/{gateway}

Returns the fields above plus statistics:

FieldTypeDescription
sessionslongNumber of sessions
acceptedConnections, rejectedConnectionslongConnection counters
messagesSent, messagesReceivedlongMessage counters
bytesSent, bytesReceivedlongTraffic counters

List FIX Sessions​

GET /api/v2/fix/gateways/{gateway}/sessions

Response 200 – array of sessions:

FieldTypeDescription
gatewayNamestringGateway name
sessionIdstringSession identifier
statusenumConnected, Disconnected or Disabled
localPortlongLocal port
remoteIpstringRemote IP address
remotePortlongRemote port
inboundSequencelongNext expected inbound sequence number
outboundSequencelongNext outbound sequence number

Get FIX Session​

GET /api/v2/fix/gateways/{gateway}/sessions/{session}

Returns the fields above plus:

FieldTypeDescription
gatewayTypeenumType of the gateway
senderId, targetIdstringFIX SenderCompID and TargetCompID
localIpstringLocal IP address
connectTimestamp, disconnectTimestamplongEpoch milliseconds
messagesSent, messagesReceivedlongMessage counters
bytesSent, bytesReceivedlongTraffic counters

Disable, Enable and Disconnect a FIX Session​

Method and pathDescription
POST /api/v2/fix/gateways/{gateway}/sessions/{session}/disableDisable the session
POST /api/v2/fix/gateways/{gateway}/sessions/{session}/enableEnable the session
POST /api/v2/fix/gateways/{gateway}/sessions/{session}/disconnectDrop the current connection

All three require CONTROL_FIX_SESSION, take no request body and return the updated session in the Get FIX Session format.

Examples​

Using a bearer token. The token needs EMBER_ACCESS, and order calls also need allowed_order_sources and ORDER_ENTRY:

TOKEN=$(...) # obtain from your identity provider

curl -H "Authorization: Bearer $TOKEN" \
https://monitor.example.com:8988/api/v2/trading/status

curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"source":"ALGO1","symbol":"BTCUSD","instrumentType":"FX","orderId":"ord-1","side":"BUY","orderType":"LIMIT","quantity":"1.5","limitPrice":"100"}' \
https://monitor.example.com:8988/api/v2/orders/submit

curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"reason": "Emergency drill", "cancelOrders": true}' \
https://monitor.example.com:8988/api/v2/trading/halt

Using HTTP Basic. Directory users have EMBER_ACCESS and are not limited by allowed_order_sources:

curl -u operator:secret https://monitor.example.com:8988/api/v2/services