Overview
This guide explains how to submit buy or sell orders for assets in a user’s portfolio using the Investment Orders endpointPOST /investments/orders.
All order operations require M2M authentication with a bearer token and the
x-user-id header to specify which user’s orders to manage.Key differences between order types
- Buy orders: Specify
amount(monetary value to invest). You must verify the user has sufficient cash balance before submitting. - Sell orders: Specify
quantity(asset units to sell). You must verify the user has sufficient holdings before submitting.
Prerequisites
- Access to API endpoints
- M2M bearer token with required scopes
x-user-idheader (user identifier, MongoDB ObjectId format)
Buy order flow
Use this flow to purchase an asset for a user’s portfolio.Verify available cash
Before submitting a buy order, retrieve the user’s cash balance to ensure sufficient funds are available.Call
GET /cash to retrieve the available cash balance across all currencies.Get asset buy preview
Get a preview of the asset buy transaction to show execution options, fees breakdown, and estimated quantity.Call
POST /investments/asset/preview with the asset ISIN, amount, and side set to “buy”.Submit the buy order
Call
POST /investments/orders with optional query params:- paymentMethod:
cash(default) orgift - executeEtfOrdersInRealtime:
trueonly for users enabled for real-time ETF execution
Render the transaction in UI
The response is an
AssetTransaction with display-ready fields such as displayAmount, displayQuantity, executionWindow, fees, and nested orders.- Show execution window: Use
executionWindow.type(e.g., real-time or market-hours) andexpectedExecutionDatewhen provided. - Show fees: Display
fees.commission.amount,fees.fx.amount, etc., when present. - Show order summary: From
orders[0], readisin,side,status, anddisplayQuantity.
Successful submission returns HTTP 200 with a populated transaction object.
Sell order flow
Use this flow to sell an asset from a user’s portfolio.Verify portfolio holdings
Before submitting a sell order, retrieve the user’s portfolio holdings to ensure sufficient quantity of the asset is available.Call
GET /portfolios/{id} to retrieve holdings with asset details and quantities.The holdings response includes an array of holdings, each with:
asset.isin: ISIN of the assetquantity: Available quantity to sellasset.currentTicker.price: Current price per unit
Get asset sell preview
Get a preview of the asset sell transaction to show execution options, fees breakdown, and estimated proceeds.Call
POST /investments/asset/preview with the asset ISIN, quantity, and side set to “sell”.Submit the sell order
Call
POST /investments/orders with optional query params:- paymentMethod:
cash(default) orgift - executeEtfOrdersInRealtime:
trueonly for users enabled for real-time ETF execution
Render the transaction in UI
The response is an
AssetTransaction with display-ready fields such as displayAmount, displayQuantity, executionWindow, fees, and nested orders.- Show execution window: Use
executionWindow.type(e.g., real-time or market-hours) andexpectedExecutionDatewhen provided. - Show fees: Display
fees.commission.amount,fees.fx.amount, etc., when present. - Show order summary: From
orders[0], readisin,side,status, anddisplayQuantity.
Successful submission returns HTTP 200 with a populated transaction object.
Error handling
- 400 Bad Request: Validation or business rule violation (e.g., invalid amount, missing required field, invalid ISIN).
- 401/403: Authentication/authorization failures.
- 404 Not Found: Portfolio or related resource not found.
See also
- API Reference → Preview Asset Buy or Sell
- API Reference → Submit Asset Order
- API Reference → Get Cash
- API Reference → Get Portfolio Holdings