Skip to main content

REST API Trading - Get trigger data

Get trigger data

Written by Albert
Updated today

Get trigger data

POST /frontoffice/api/v4/positions/{positionId}/trigger-data

Summary

Use this method to retrieve Stop loss and Take profit settings for an open position.

Request

Header parameters

accountId required

The trading account identifier.

Path parameters

positionId required

The position identifier.

Body

stopLoss.triggerType string · enum | nullable

The trigger calculation type for Stop loss.

Possible values:

  • Price

  • Rate

  • Points

  • Pnl

stopLoss.triggerSize decimal string | nullable

The trigger value in selected units.

stopLoss.isTrailing boolean | nullable

Indicates if Stop loss is Trailing.

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.

Request example

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

{
"stopLoss": {
"triggerSize": "-0.01",
"triggerType": "rate",
"isTrailing": true
},
"takeProfit": {
"triggerSize": 2500,
"triggerType": "points"
}
}

Response

In case of success, an object will be returned.

Each object contains the following information:

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

{
"takeProfit": {
"price": "248.27",
"rate": "0.1119",
"points": 2500,
"pnl": "21.5"
},
"stopLoss": {
"price": "221.04",
"rate": "-0.01",
"points": -223,
"pnl": "-1.91"
}
}

Did this answer your question?