Skip to content

Orders

Use the below apis to place and manage order:

method endpoint use case Rate Limit
GET /orders?limit={limit}&offset={offset} Fetch the entire order book 10/sec
GET /orders/{order_id} Fetch order history 10/sec
POST /orders/regular Place order 10/sec
PUT /orders/regular/{exchange}/{order_id} Modify Order 10/sec
DELETE /orders/regular/{exchange}/{order_id} Cancel an Order 10/sec

Fetching Order Book

Endpoint: /orders?limit={limit}&offset={offset}

Note

  • Offset should atleast be 1
  • Limit is the number of orders to be fetched.

Order Book Response

{
    "status": "success",
    "orders": [
        {
            "order_id": "NXAAE00003K3",
            "exchange": "NSE_EQ",
            "token": 14366,
            "order_number": "0",
            "status": "AMOACCEPTED",
            "error_reason": "",
            "transaction_type": "BUY",
            "product": "INTRADAY",
            "variety": "SL",
            "total_quantity": 1,
            "pending_quantity": 1,
            "traded_quantity": 0,
            "disclosed_quantity": 0,
            "disclosed_quantity_remaining": 0,
            "order_price": 9.50,
            "trigger_price": 9.20,
            "traded_price": 0.0,
            "validity": "DAY",
            "validity_days": 0,
            "symbol": "IDEA",
            "series": "EQ",
            "instrument_name": "",
            "expiry_date": "",
            "strike_price": 0.00,
            "option_type": "  ",
            "lot_size": 1,
            "order_created_at": "2023-03-27 18:47:41",
            "initiated_by": "MOBILE-Ex",
            "modified_by": "MOBILE-Ex",
            "is_amo": true,
            "order_identifier": "app=dev_1"
        }
    ],
    "metadata": {
        "total_records": 1,
        "all_records": 1,
        "completed_records": 0,
        "open_records": 1
    }
}

Fetching order history

Endpoint: /orders/{order_id}

Order History Response

{
    "status": "success",
    "code": "s-101",
    "message": "Order history data fetched successfully",
    "data": [
        {
            "order_id": "NXAAE00022D6",
            "exchange": "NSE_EQ",
            "token": 1624,
            "order_number": "1100000030057376",
            "status": "EXECUTED",
            "error_reason": "",
            "transaction_type": "SELL",
            "product": "INTRADAY",
            "variety": "RL-MKT",
            "total_quantity": 1,
            "pending_quantity": 0,
            "traded_quantity": 1,
            "disclosed_quantity": 0,
            "order_price": 91.95,
            "trigger_price": 0.00,
            "validity": "DAY",
            "validity_days": 0,
            "symbol": "IOC",
            "series": "EQ",
            "instrument_name": "",
            "expiry_date": "",
            "strike_price": 0.00,
            "option_type": "",
            "order_created_at": "2023-06-20 15:14:39",
            "exchange_order_created_at": "2023-06-20 15:14:39",
            "initiated_by": "MOBILE-Ex",
            "modified_by": "MOBILE-Ex",
            "is_amo": false,
            "order_identifier": ""
        },
        {
            "order_id": "NXAAE00022D6",
            "exchange": "NSE_EQ",
            "token": 1624,
            "order_number": "1100000030057376",
            "status": "PENDING",
            "error_reason": "",
            "transaction_type": "SELL",
            "product": "INTRADAY",
            "variety": "RL-MKT",
            "total_quantity": 1,
            "pending_quantity": 1,
            "traded_quantity": 0,
            "disclosed_quantity": 0,
            "order_price": 92.00,
            "trigger_price": 0.00,
            "validity": "DAY",
            "validity_days": 0,
            "symbol": "IOC",
            "series": "EQ",
            "instrument_name": "",
            "expiry_date": "",
            "strike_price": 0.00,
            "option_type": "",
            "order_created_at": "2023-06-20 15:14:39",
            "exchange_order_created_at": "2023-06-20 15:14:39",
            "initiated_by": "MOBILE-Ex",
            "modified_by": "MOBILE-Ex",
            "is_amo": false,
            "order_identifier": ""
        },
        {
            "order_id": "NXAAE00022D6",
            "exchange": "NSE_EQ",
            "token": 1624,
            "order_number": "0",
            "status": "OMSXMITTED",
            "error_reason": "",
            "transaction_type": "SELL",
            "product": "INTRADAY",
            "variety": "RL-MKT",
            "total_quantity": 1,
            "pending_quantity": 1,
            "traded_quantity": 0,
            "disclosed_quantity": 0,
            "order_price": 92.00,
            "trigger_price": 0.00,
            "validity": "DAY",
            "validity_days": 0,
            "symbol": "IOC",
            "series": "EQ",
            "instrument_name": "",
            "expiry_date": "",
            "strike_price": 0.00,
            "option_type": "",
            "order_created_at": "2023-06-20 15:14:39",
            "exchange_order_created_at": "1900-01-01 00:00:10",
            "initiated_by": "MOBILE-Ex",
            "modified_by": "MOBILE-Ex",
            "is_amo": false,
            "order_identifier": ""
        }
    ],
    "metadata": {
        "total_records": 3
    }
}

Placing an order

When the place order API is called and the api returns success, it simply means that the Order has been submitted to us. It does not mean that the order has been placed on the exchange. We provide several checks before placing the order, including but not limited to:

  • Funds availability of the trader
  • Products and exchanges allowed to the trader
  • Timings
  • Availability of equity sold

This means that you can never be sure of the order's fate if you don't listen to the Postback url configured during developer onboarding or the websocket messages. Alternatively, you can call the orderbook api or the order detail api with some delay to know the latest status.

Endpoint: /orders/regular

Place Order Object

{
    "exchange": "NSE_EQ",
    "token": 14366,
    "transaction_type": "BUY",
    "product": "INTRADAY",
    "variety": "SL",
    "quantity": 2,
    "price": 10.5,
    "trigger_price": 10.2,
    "disclosed_quantity": 0,
    "validity": "DAY",
    "validity_days": 1,
    "is_amo": false,
}
field Required description
exchange Y Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
token Y Security token of the scrip. It can be found in the scripmaster file
transaction_type Y Possible values: [BUY , SELL]
product Y Possible values: [INTRADAY , DELIVERY , MTF].MTF product can only be used in NSE_EQ exchange.
variety Y Possible values: [RL, RL-MKT, SL, SL-MKT]. RL means regular orders, SL means Stop Loss order. MKT means that the trade will happen at market price
quantity Y For exchange NSE_FO, if you want to trade in 2 lots and lot size is 50, you should pass 100. In all other exchanges, you should pass just the number of lots. For example, in MCX_FO, if you want to trade 5 lots, you should pass just 5.
price Y Price should be an integer multiple of Tick Size. For example, IDEA's tick size is 0.05. So the price entered can be 9.5 or 9.65. It cannot be 9.67. In case of market orders, you should send the Last Trade Price as 0
trigger_price Y To be used for Stop loss orders. For BUY side SL orders, trigger_price should be lesser than price. for SELL side SL orders, trigger_price should be greater than price.
disclosed_quantity Y Can be any number lesser than or equal to quantity, including 0
validity Y Can be DAY for orders which are valid throughout the day, or IOC. IOC order will be cancelled if it is not traded immediately
validity_days Y
is_amo Y Possible values: [true,false]. Should be set to true if order is being placed after market hours

Place Order Response

Success

{
    "status": "success",
    "code": "s-101",
    "message": "Order Entry Sent to OMS",
    "data": {
        "orderId": "NXAAE00002K3"
    }
}

Error

{
    "status": "error",
    "code": "e-103",
    "message": "Only AMO allowed in AMO timing for segment : 1"
}
field description
status Possible values: [success,error]
code Error Code
message Description of the error, if any
data Contains order id of the order placed. This order id can be used to identify order in order book

Modifying an order

  • Only a subset of fields can be modified for a particular order. If for example you want to change the product from INTRADAY to DELIVERY, you must cancel the previous order and place a new order.

  • traded_quantity is the quantity already traded in the order. You must pass the latest value here as received in the orderbook. If for example you have placed an order for 100 quantity out of which 20 are already traded, and in the modify order object, you pass quantity as 100 and traded_quantity as 0, the order shall then become of total quanity 120 and traded_quantity 20.

  • price and trigger_price modification is applied to only the remaining quantity that is not yet traded.
  • RL orders cannot become SL orders. If an SL order is triggered, it cannot be modified as SL order again. You must cancel the previous order and create a new order.

Modify Order Object

{
    "variety": "SL",
    "quantity": 100,
    "traded_quantity": 20 , 
    "price": 10.5,
    "trigger_price": 10.2,
    "disclosed_quantity": 0,
    "validity": "DAY",
    "validity_days": 1
}

Modify Order Response

Success

{
    "status": "success",
    "code": "s-101",
    "message": "Order Entry Sent to OMS",
    "data": {
        "orderId": "NXAAE00002K3"
    }
}

Error

{
    "status": "error",
    "code": "e-103",
    "message": "Only AMO allowed in AMO timing for segment : 1"
}

Cancel an Order

Endpoint: /orders/regular/{exchange}/{order_id}

Cancel Order Response

{
    "status": "success",
    "code": "s-101",
    "message": "Order Cancellation Sent to OMS",
    "data": {
        "orderId": "NXAAE00003K3"
    }
}