Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

SplitOrder

Split a large order into multiple smaller orders to reduce market impact or comply with freeze quantity limits.

Endpoint URL

Local Host   :  POST http://127.0.0.1:5000/api/v1/splitorder
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/splitorder
Custom Domain:  POST https://<your-custom-domain>/api/v1/splitorder

Sample API Request

{
  "apikey": "<your_app_apikey>",
  "strategy": "Python",
  "symbol": "YESBANK",
  "exchange": "NSE",
  "action": "SELL",
  "quantity": "105",
  "splitsize": "20",
  "pricetype": "MARKET",
  "product": "MIS"
}

Sample cURL Request

Sample API Response

Request Body

Parameter
Description
Mandatory/Optional
Default Value

apikey

Your OpenAlgo API key

Mandatory

-

strategy

Strategy identifier

Mandatory

-

symbol

Trading symbol

Mandatory

-

exchange

Exchange code accepted by the shared validation constants

Mandatory

-

action

Order action: BUY or SELL

Mandatory

-

quantity

Positive numeric quantity to split

Mandatory

-

splitsize

Size of each split order

Mandatory

-

pricetype

Price type: MARKET, LIMIT, SL, SL-M

Optional

MARKET

product

Product type: MIS, CNC, NRML

Optional

MIS

price

Order price (for LIMIT orders)

Optional

0

trigger_price

Trigger price (for SL orders)

Optional

0

disclosed_quantity

Disclosed quantity applied to each child order

Optional

0

These eleven fields are the complete SplitOrderSchema. Any other field returns HTTP 400.

Response Fields

Field
Type
Description

status

string

"success" or "error"

split_size

number

Size used for splitting

total_quantity

number

Total quantity processed

results

array

Array of individual order results

Results Array Fields

Field
Type
Description

order_num

number

Order sequence number (1, 2, 3...)

orderid

string

Order ID from broker

quantity

number

Quantity for this order

status

string

"success" or "error"

message

string

Error message (on failure)

How Split Orders Work

For a total quantity of 105 with splitsize of 20:

Approval and execution outcomes

In Semi-Auto mode this request can return HTTP 200, status: "success", mode: "semi_auto" and pending_order_id after queuing for Action Center approval. It has not yet placed a broker order. In Auto/analyzer execution, inspect the placement result and confirm fills separately. See order outcomes and retries.

Inspect every child result even on HTTP 200. A child that reports a lost broker reply may already exist at the broker; reconcile before retrying. Resending the complete batch can duplicate successful or ambiguous children.

Notes

  • Maximum 100 child orders per split request. A quantity and splitsize combination that would produce more than 100 orders is rejected before any order is sent.

  • The last order contains the remainder (quantity % splitsize)

  • Rate limit: API_RATE_LIMIT, not ORDER_RATE_LIMIT

  • Live child orders are placed sequentially using a delay derived from ORDER_RATE_LIMIT; analyzer mode prefetches one quote and uses the sandbox path.

  • Fractional total quantities are accepted only for CRYPTO; non-crypto total quantities must be whole numbers. splitsize is always a positive integer.

  • Use for:

    • Large F&O orders: Splitting to stay within freeze quantity limits

    • Reducing market impact: Spreading execution over multiple orders

    • TWAP strategies: Time-weighted average price execution

  • If splitsize is larger than quantity, a single order is placed

  • All split orders share the same price type and price

Freeze quantities change and are loaded from data/qtyfreeze.csv; do not hard-code the example values from older releases.


Back to: API Documentation

Last updated