Skip to main content

REST API Trading - Get CFD order data

Get CFD order data

Written by Albert
Updated today

Get CFD order data

POST /frontoffice/api/cfd/v4/order-data

Summary

Use this method to retrieve and validate order data for CFD market orders before placing.

Request

Header parameters

accountId required

The trading account identifier.

Body

order object

The order data.

order.marketId string

The market identifier, in the following format: {marketType}.{baseAssetId}_{quoteAssetId}, for example: spot.btc_usdt.

Must match one of the available markets returned by the Get markets endpoint.

order.side string

The order side, indicating the direction of the trade.

Possible values:

  • Buy

  • Sell

order.orderType string

The order type.

Possible values:

  • Market

  • Limit

order.leverage integer

The leverage factor applied to the position. Leverage determines margin required to open and maintain the position (for example, with leverage 10, only 10% of the position's notional value is required as margin).

order.requestedLotAmount decimal string

The quantity of the base asset to buy or sell, in lots. Lot size is defined per market and determines the base asset quantity represented by one lot. Upon execution, this defines the opened position size in lots.

order.requestedPrice decimal string | nullable

The limit price for Limit orders (the maximum price for a buy or minimum price for a sell).

Must be null or omitted for Market orders.

order.takeProfit.triggerType string · enum | nullable

The trigger calculation type for Take profit.

Possible values:

  • Price

  • Rate

  • Points

  • Pnl

order.takeProfit.triggerSize decimal string | nullable

The trigger value in selected units.

order.stopLoss.triggerType string · enum | nullable

The trigger calculation type for Stop loss.

Possible values:

  • Price

  • Rate

  • Points

  • Pnl

order.stopLoss.triggerSize decimal string | nullable

The trigger value in selected units.

order.stopLoss.isTrailing boolean | nullable

If true, enables the Trailing behavior for Stop loss.

Request example

POST /frontoffice/api/cfd/v4/order-data HTTP/1.1
Host: {host}
Authorization: Bearer JWT
accountId: {accountId}
Content-Type: application/json; x-api-version=4.0
Accept: */*

{
"order": {
"takeProfit": {
"triggerSize": 15000,
"triggerType": "points"
},
"stopLoss": {
"triggerSize": "4020",
"triggerType": "price",
"isTrailing": false
},
"marketId": "cfd.eth_eur",
"side": "Sell",
"orderType": "Market",
"leverage": 135,
"requestedLotAmount": 1
}
}

Response

In case of success, an object will be returned.

Each object contains the following information:

requiredMarginInRAT decimal string

The required margin amount, in conversion to RAT.

quoteAmount decimal string

The calculated quote asset amount for the order.

commissionAmountInRAT decimal string

The estimated commission amount to be charged, in conversion to RAT.

marginLevel decimal string | nullable

The resulting margin level.

takeProfit.price decimal string

The calculated Take profit price, based on trigger settings.

takeProfit.rate decimal string

The calculated Take profit rate.

takeProfit.points integer · int64

The calculated take profit offset, in points.

takeProfit.pnl decimal string

The projected PnL at Take profit.

stopLoss.price decimal string

The calculated Stop loss price, based on trigger settings.

stopLoss.rate decimal string

The calculated Stop loss rate.

stopLoss.points integer · int64

The calculated Stop loss offset, in points.

stopLoss.pnl decimal string

The projected PnL at Stop loss.

Response example — 200: OK

{
"order": {
"requiredMarginInRAT": "34.4613643",
"quoteAmount": "4004.345",
"commissionAmountInRAT": "0",
"marginLevel": "5.3015",
"takeProfit": {
"price": "3989.345",
"rate": "0.0037",
"points": 15000,
"pnl": "17.42713545"
},
"stopLoss": {
"price": "4020",
"rate": "-0.0039",
"points": -15655,
"pnl": "-18.18812036"
}
}
}

Did this answer your question?