pocketful logo light
pocketful logo light

Place AMO Order

You can place a after market order with the placeOrder API. All the parameters that needs to be passed are listed below. An instrument token will be required to place the order, to get the instrument token you can download the given CSV file. To place an amo order, feed the execution_type parameter as ‘amo’.

Endpoint: /api/v1/orders
Method-Type: POST

Headers

Header NameValueDescription
x-authorization-token<your_access_token>Valid JWT token for authentication
x-device-typeWEBThe device type (e.g., WEB, ANDROID, IOS)
Content-Typeapplication/jsonFormat of the request body

Request Packet

  {
    "exchange": "NSE",
    "instrument_token": "14366",
    "client_id": "clientId",
    "order_type": "LIMIT",
    "amo": true,
    "price": 13,
    "quantity": 1,
    "disclosed_quantity": 0,
    "validity": "DAY",
    "product": "MIS",
    "order_side": "BUY",
    "device": "WEB",
    "user_order_id": 1,
    "trigger_price": 0,
    "execution_type": "amo"
  }

Example cURL Request

curl --location 'https://algo.pocketful.in/api/v1/orders' \
--header 'Content-Type: application/json' \
--header 'x-authorization-token: <your_access_token>' \
--header 'x-device-type: WEB' \
--data '{
    "exchange": "NSE",
    "instrument_token": "14366",
    "client_id": "clientId",
    "order_type": "LIMIT",
    "amo": true,
    "price": 13,
    "quantity": 1,
    "disclosed_quantity": 0,
    "validity": "DAY",
    "product": "MIS",
    "order_side": "BUY",
    "device": "WEB",
    "user_order_id": 1,
    "trigger_price": 0,
    "execution_type": "amo"
}'

Body Params

FieldNameDatatypeDescription
exchangeStringName of the exchange where the order is being placed. Possible values include NSEBSENFOMCX.
instrument_tokenStringThe unique ID of the financial instrument.
client_idStringThe unique ID of the user placing the order.
order_typeStringThe type of order being placed. Possible values are LIMITSL.
amoBooleanIndicates whether the order is an After Market Order (AMO). It can be either TRUE or FALSE.
priceFloatThe price at which the order should be executed. If order_type is MARKET, the value is 0; otherwise, it’s the limit price.
quantityIntegerThe total quantity of the financial instrument to be traded.
disclosed_quantityIntegerThe quantity of the order that is hidden from the market.
validityStringThe validity of the order. Possible values are DAY (valid until the end of the trading day) or IOC (Immediate or Cancel).
productStringThe type of product being traded. Possible values are CNC (Cash and Carry), MIS (Margin Intraday Square off), NRML (Normal).
order_sideStringIndicates whether it’s a buy or sell order. Possible values are BUY or SELL.
deviceStringThe device from which the order is being placed. Possible values are Web or Mobile.
user_order_idIntegerThe unique order ID generated by the user.
trigger_priceFloatThe specified activation threshold for Stop Loss (SL) orders.
execution_typeStringThe execution type of the order, which is typically amo for after market orders.

Example Code

response = pocket.placeOrder({
    "exchange": "NSE",
    "instrument_token": "14366",
    "client_id": "clientId",
    "order_type": "LIMIT",
    "amo": False,
    "price": 13,"quantity": 1,
    "disclosed_quantity": 0,
    "validity": "DAY",
    "product": "MIS",
    "order_side": "BUY",
    "device": "WEB",
    "user_order_id": 1,
    "trigger_price": 0,
    "execution_type": "AMO"
    })

Response

{
    "data":
    {
       "oms_order_id": "200018000000003"
    },
    "message": "Order place successfully",
    "status": "success"
  }
KeyDescription
oms_order_idThe ID assigned to the order in the Order Management System.
messageA message indicating the result of the order placement.
statusThe status of the operation (success/failure).

Error Responses

In different scenarios, you can get different error responses, the error response will be like the below JSON example.

{
    "data": {},
    "error_code": 44000,
    "message": "`product` is invalid",
    "status": "error"
}

Various error codes can be seen depending on the errors encountered within the code. Below are some of the defined error codes.

Error CodeDescription
44000In case of any of the parameter like Exchangeorder_typeproduct being invalid
45000In case of Invalid Price or Quantity.
45010“Something Went Wrong” message occurs if you have given wrong instrument token