Place and cancel a pending order
A pending order rests in the market until its trigger price is reached. It consumes no margin until it fills.
1. Token
TOKEN="<access_token>" # see the Open & close recipe for step-by-step
2. Place a BUY LIMIT
Pending order types: 1 BUY LIMIT, 2 BUY STOP, 3 SELL LIMIT,
4 SELL STOP. order_price is the trigger.
curl --request POST \
--url https://api.onlytradeplatform.com/api/v1/orders/accounts/me \
--header "Authorization: Bearer $TOKEN" \
--header "content-type: application/json" \
--data '{
"symbol_id": 26100001,
"type": 1,
"volume": 0.10,
"order_price": 1.07500,
"stop_loss": 1.07000,
"take_profit": 1.09000,
"fill_policy": 0
}'
3. List pending orders
curl --request GET \
--url "https://api.onlytradeplatform.com/api/v1/orders/accounts/me?active=true" \
--header "Authorization: Bearer $TOKEN"
Note the id of your order (e.g. 260610013).
4. Cancel it
Cancelling a pending order is a POST to the order's /accounts/me
path:
curl --request POST \
--url https://api.onlytradeplatform.com/api/v1/orders/260610013/accounts/me \
--header "Authorization: Bearer $TOKEN"
The order leaves the market; nothing changes on your balance or margin.
To modify (instead of cancel) a pending order, use
PUT /api/v1/orders/{order_id}/accounts/me with the new price/volume —
see the API Reference.