Skip to main content

Options multi-order

Resolve and submit multiple option legs. Partial execution is possible; inspect each leg and split result.

Offline source contract; this page is not a production deployment announcement. Replace symbols, expiries, quantities and mode snapshots with current account evidence before use.

POST /api/v1/optionsmultiorder​

Authentication: apikey JSON; identity checked in route/service. Send a JSON object with Content-Type: application/json.

Parameters​

FieldTypeRequiredDefault / omissionMeaning
expected_modeStringYesrequiredCurrent server mode: live or analyze.
expected_balance_typeStringYesrequiredCurrent balance type: live or sandbox.
expected_mode_versionIntegerYesrequiredCurrent integer version returned by Funds/Analyzer; refresh after a mode switch.
request_idStringYesrequiredSave before submission. For protected placement retain the same ID and payload for an intentional retry; do not replay an ambiguous submission automatically.
apikeyStringYesrequiredPer-broker IMC key; never use the broker access token.
strategyStringYesrequiredStrategy name.
underlyingStringYesrequiredUnderlying index/equity/future symbol.
exchangeStringYesrequiredExchange identifier supported by the selected instrument and broker.
expiry_dateStringNoomitted; see behavior belowExpiry in DDMMMYY format; use an available master-contract expiry.
strike_intIntegerNoomitted; see behavior belowPositive strike interval override; omit to use actual strikes.
legsListYesrequiredNonempty option-leg array; see nested fields below.
legs[].offsetStringYesrequiredATM, ITM1–ITM50 or OTM1–OTM50.
legs[].option_typeStringYesrequiredCE or PE (lowercase accepted by schema).
legs[].actionStringYesrequiredBUY or SELL.
legs[].quantityIntegerYesrequiredPositive quantity; use the current lot size for derivatives.
legs[].splitsizeIntegerNo00 disables splitting; positive size divides the requested quantity.
legs[].expiry_dateStringNoomitted; see behavior belowExpiry in DDMMMYY format; use an available master-contract expiry.
legs[].pricetypeStringNo"MARKET"Execution price type; supported values depend on the operation.
legs[].productStringNo"MIS"Broker-supported product; see constraints below.
legs[].priceFloatNo0.0Non-negative price; LIMIT requires a usable positive price.
legs[].trigger_priceFloatNo0.0Stop-order trigger price.
legs[].disclosed_quantityIntegerNo0Disclosed quantity, subject to broker rules.

Request example​

{
"expected_mode": "analyze",
"expected_balance_type": "sandbox",
"expected_mode_version": 7,
"request_id": "saved-business-request-001",
"apikey": "YOUR_BROKER_IMC_KEY",
"strategy": "Python",
"underlying": "NIFTY",
"exchange": "NSE_INDEX",
"legs": [
{
"offset": "ATM",
"option_type": "CE",
"action": "BUY",
"quantity": 65
}
],
"expiry_date": "31DEC26"
}

Python SDK​

from layr0_imc import api

client = api(api_key="YOUR_BROKER_IMC_KEY", host="https://YOUR_IMC_HOST")
# Copy the current snapshot from Funds/Analyzer for this same key.
client.set_mode_context(expected_mode="analyze", expected_balance_type="sandbox", expected_mode_version=7)

result = client.optionsmultiorder(request_id='saved-business-request-001', strategy='Python', underlying='NIFTY', exchange='NSE_INDEX', legs=[{'offset': 'ATM', 'option_type': 'CE', 'action': 'BUY', 'quantity': 65}], expiry_date='31DEC26')
print(result)

Response and errors​

Illustrative 200 success; values are examples, not broker evidence:

{
"status": "success",
"underlying": "NIFTY",
"underlying_ltp": 25000,
"results": [
{
"leg": 1,
"symbol": "NIFTY31DEC2625000CE",
"exchange": "NFO",
"offset": "ATM",
"option_type": "CE",
"action": "BUY",
"status": "success",
"orderid": "EXAMPLE_ORDER_ID",
"mode": "analyze"
}
],
"mode": "analyze",
"balance_type": "sandbox",
"mode_version": 7
}

All incoming JSON objects and arrays follow recursive forbidden-field validation. A prohibited documentation key returns 400 before execution:

{
"status": "error",
"error_code": "FORBIDDEN_JSON_FIELD",
"message": "Documentation fields are not allowed in request JSON."
}

Schema errors use 400. Authentication and broker-session failures retain endpoint-specific errors. Missing mode preconditions use 428 in services (the REST schema can reject missing fields with 400); stale mode snapshots use 409. See HTTP errors and authentication/mode requirements. No error response authorizes an automatic order retry.

Modes, capabilities and usage​

The service owns one parent lease through all legs, including parallel leg work. Legs require offset, option_type, action and quantity; optional expiry_date overrides the top-level expiry. Each leg may split and has independent results. A top-level success can contain failed legs; it is not an atomic basket or proof of fills. Semi-auto handling and established child-order usage policies remain in effect; the route adds no separate usage-recording decorator.

Source handler: restx_api.options_multiorder.OptionsMultiOrder.post. Source services: services.options_multiorder_service.place_options_multiorder.