Trading

Close a position

Place an order to close an existing position. Isn't guaranteed to close the positions, or close it immediately. Will attempt to place an IOC, then GTC closing order, so the execution might be delayed. If you want to fully close position set parameter qty to 0, but if you want to partially close a position just set the qty parameter to the number of lots that you want to close.

NOTE: if you don't know what is the positionId value (you only have an orderId of the order that opened the position), you can use the GET /trade/accounts/{accountId}/ordersHistory route to get the list of all final orders and their IDs. Just match the orderId with the positionId.

delete/trade/positions/{positionId}

Request

  • Base URL
    https://demo.tradelocker.com/backend-api
  • URL
    https://demo.tradelocker.com/backend-api/trade/positions/{positionId}
  • Auth
    HTTP bearer

Path parameters

positionIdinteger required

Position identifier.

Query parameters

strategyIdstring

Strategy ID

Headers

accNuminteger required

Account number

developer-api-keystring

developer-api-key

Request body

qtynumber

Response

sstring required

Status will always be ok.

Example response

{
  "s": "ok"
}

Changes

No recorded changes to this operation across all 2 revisions of this API.