Bracket and cover orders
Orders the broker protects with its own stop-loss and target.
Place a bracket or cover order #
/v1/orders/bracket scope ordersPlaces a broker bracket (BO: entry + stop-loss + target) or cover (CO: entry + stop-loss) order in one account; the legs show up in the order book as ordinary orders.
More about this
Once the request is valid the answer is 200 with the broker's verdict in status; request-level problems are 4xx and place nothing.
Repeat a request with the same Idempotency-Key to get the first answer back (Idempotent-Replayed: true) instead of placing again.
Parameters
- Idempotency-Key header · string required
A new UUID per order request (1-128 printable characters).
Body fields
- account string required
Account id (see
/v1/accounts). - instrument_token string required
Instrument id (see
/v1/instruments). - kind string required
BO(bracket: entry + stop-loss + target) orCO(cover: entry + stop-loss).One of: BO, CO
- side string required
Order side.
One of: BUY, SELL
- order_type string required
Entry order type:
LIMITorMARKET.One of: MARKET, LIMIT, SL, SL_M
- product string required
MIS(intraday),CARRYFORWARD(overnight derivatives, NRML),DELIVERY(equity delivery, CNC) orMTF(margin trading facility).One of: MIS, CARRYFORWARD, DELIVERY, MTF
- quantity integer (int64) required
Units, or lots when
qty_is_in_lot. Units round down to whole lots; under one lot is refused. - stop_loss number (double) required
Stop-loss price.
- qty_is_in_lot boolean
quantitycounts lots, not units. - price number (double)
Entry limit price (
LIMIT); 0 or absent forMARKET. - target number (double) | null
Target price: required for
BO, not allowed forCO. - trailing_stop_loss number (double) | null
Trailing stop-loss step, in points (on the tick grid).
- client_tag string | null
Your own reference for the entry (1-64 letters, digits,
_,.,:or-), echoed in the answer and kept on the order:GET /v1/orders/{client_tag}finds it.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | idempotency_key_required | The |
| 400 | invalid_idempotency_key | The |
| 400 | malformed_json | The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types). |
| 401 | unauthorized | No credential, or the credential is invalid, expired or revoked. |
| 403 | forbidden | The credential may not use this route (missing scope, app-session-only route, IP not allowed). |
| 404 | account_not_found | No linked broker account with this id for the caller. |
| 409 | request_in_progress | A request with this |
| 422 | invalid_request | The request is well-formed but not valid; |
| 422 | idempotency_key_reused | This |
| 429 | rate_limited | Too many requests for this credential (or too many failed attempts); retry after the |
| 503 | service_unavailable | A dependency is temporarily unavailable, or the feature is off on this server; retry later. |
All fields (request and response schema)
Loading fields…
curl -X POST "https://cirrus.pocketful.in/v1/orders/bracket" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"order_type": "LIMIT",
"product": "MIS",
"quantity": 5,
"price": 2500,
"stop_loss": 2450,
"target": 2600
}'import os
import uuid
import requests
response = requests.post(
"https://cirrus.pocketful.in/v1/orders/bracket",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"order_type": "LIMIT",
"product": "MIS",
"quantity": 5,
"price": 2500,
"stop_loss": 2450,
"target": 2600,
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v1/orders/bracket', {
method: 'POST',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"order_type": "LIMIT",
"product": "MIS",
"quantity": 5,
"price": 2500,
"stop_loss": 2450,
"target": 2600
}),
});
const body = await response.json();
console.log(response.status, body);{
"status": "success",
"data": {
"account": "PF1",
"basket_id": "777",
"order_id": null,
"status": "accepted",
"message": null
},
"error": null
}Modify a bracket or cover order #
/v1/orders/bracket/{order_id} scope ordersChanges the entry price or quantity, or the legs, of a bracket / cover order in one account.
More about this
Once the request is valid the answer is 200 with the broker's verdict in status.
Parameters
- order_id path · string required
Broker order id,
order_tagorclient_tagof the entry, asGET /v1/orders/{order_id}takes it (1-64 letters, digits,-,_,.or:).
Body fields
- account string required
Account id the order is in.
- instrument_token string required
Instrument id of the order.
- kind string required
BO(bracket: entry + stop-loss + target) orCO(cover: entry + stop-loss).One of: BO, CO
- side string required
Side of the entry.
One of: BUY, SELL
- entry_price number (double) required
Entry price the legs are measured from.
- price number (double) | null
New entry limit price.
- quantity integer (int64) | null
New quantity, in units.
- stop_loss number (double) | null
New stop-loss price.
- target number (double) | null
New target price (
BOonly). - trailing_stop_loss number (double) | null
New trailing stop-loss step, in points.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | malformed_json | The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types). |
| 401 | unauthorized | No credential, or the credential is invalid, expired or revoked. |
| 403 | forbidden | The credential may not use this route (missing scope, app-session-only route, IP not allowed). |
| 404 | account_not_found | No linked broker account with this id for the caller. |
| 422 | invalid_request | The request is well-formed but not valid; |
| 429 | rate_limited | Too many requests for this credential (or too many failed attempts); retry after the |
| 503 | service_unavailable | A dependency is temporarily unavailable, or the feature is off on this server; retry later. |
All fields (request and response schema)
Loading fields…
curl -X PATCH "https://cirrus.pocketful.in/v1/orders/bracket/<order_id>" \
-H "Authorization: token $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"entry_price": 2500,
"stop_loss": 2460,
"target": 2620
}'import os
import requests
response = requests.patch(
"https://cirrus.pocketful.in/v1/orders/bracket/<order_id>",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
json={
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"entry_price": 2500,
"stop_loss": 2460,
"target": 2620,
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v1/orders/bracket/<order_id>', {
method: 'PATCH',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"account": "PF1",
"instrument_token": "CT:TEST:RELIANCE",
"kind": "BO",
"side": "BUY",
"entry_price": 2500,
"stop_loss": 2460,
"target": 2620
}),
});
const body = await response.json();
console.log(response.status, body);{
"status": "success",
"data": {
"account": "PF1",
"basket_id": null,
"order_id": "250929000001",
"status": "accepted",
"message": null
},
"error": null
}Cancel a bracket or cover order #
/v1/orders/bracket/{order_id} scope ordersCancels a bracket / cover order (entry and legs) in one account.
More about this
Once the request is valid the answer is 200 with the broker's verdict in status.
Parameters
- order_id path · string required
Broker order id,
order_tagorclient_tagof the entry, asGET /v1/orders/{order_id}takes it (1-64 letters, digits,-,_,.or:). - account query · string required
Account id the order is in.
- kind query · string required
BOorCO.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_query | The query string does not fit the route's parameters. |
| 401 | unauthorized | No credential, or the credential is invalid, expired or revoked. |
| 403 | forbidden | The credential may not use this route (missing scope, app-session-only route, IP not allowed). |
| 404 | account_not_found | No linked broker account with this id for the caller. |
| 422 | invalid_request | The request is well-formed but not valid; |
| 429 | rate_limited | Too many requests for this credential (or too many failed attempts); retry after the |
| 503 | service_unavailable | A dependency is temporarily unavailable, or the feature is off on this server; retry later. |
All fields (request and response schema)
Loading fields…
curl -X DELETE "https://cirrus.pocketful.in/v1/orders/bracket/<order_id>?account=<account>&kind=<kind>" \
-H "Authorization: token $CIRRUS_API_KEY"import os
import requests
response = requests.delete(
"https://cirrus.pocketful.in/v1/orders/bracket/<order_id>",
headers={
"Authorization": f"token {os.environ['CIRRUS_API_KEY']}",
},
params={
"account": "<account>",
"kind": "<kind>",
},
timeout=10,
)
print(response.status_code, response.json())const response = await fetch('https://cirrus.pocketful.in/v1/orders/bracket/<order_id>?account=<account>&kind=<kind>', {
method: 'DELETE',
headers: {
Authorization: `token ${process.env.CIRRUS_API_KEY}`,
},
});
const body = await response.json();
console.log(response.status, body);{
"status": "success",
"data": {
"account": "PF1",
"basket_id": null,
"order_id": "250929000001",
"status": "accepted",
"message": null
},
"error": null
}