Place After Market Order (AMO)
This document provides a detailed overview of the Place After Market Order (AMO) API for the Firstock trading platform. This endpoint is designed for placing orders outside of regular market hours.
Overview
The Place Order AMO API allows authenticated clients to create new orders. Depending on the specified parameters (e.g., price type, product type), it can handle multiple order scenarios, such as limit orders, market orders, and stop-loss orders.
Key benefits:
- Versatile Order Types: Supports market, limit, and SL-based orders.
- Broad Exchange Coverage: Place trades on NSE, BSE, NFO, and more.
- Seamless Integration: Easily incorporate order placement into your trading application’s workflow.
Endpoint & Method
POST
/placeAfterMarketOrder
URL:
https://api.firstock.in/V1/placeAfterMarketOrderHeaders:
| Name | Value |
|---|---|
| Content-Type |
application/json |
Body:
Below is the JSON body for the request. All fields must be sent as strings
| Field | Type | Mandatory | Description | Example |
|---|---|---|---|---|
| userId |
string |
Yes |
Unique identifier for |
AB1234 |
| jKey |
string |
Yes |
Active session token obtained from a successful login. |
ce1c4471eb95... |
| exchange |
string |
Yes |
Exchange name ("NSE", "BSE", |
"NSE" |
| retention |
string |
Yes |
Order validity (Default: "DAY"). |
"DAY" |
| product |
string |
Yes |
Product type (e.g., "C" for CNC, "I" for MIS). |
"C" |
| priceType |
string |
Yes |
Pricing model: "LMT", "MKT", "SL-LMT". |
"LMT" |
| tradingSymbol |
string |
Yes |
Instrument identifier. |
"RELIANCE-EQ" |
| transactionType |
string |
Yes |
"B" (Buy) or "S" (Sell). |
"B" |
| price |
string |
Yes |
Limit price in Rupees. (e.g., "150.50"). |
"150.50" |
| triggerPrice |
string |
No |
rigger price in Rupees. |
"145.00" |
| quantity |
string |
Yes |
Number of shares/lots. |
"10" |
| remarks |
string |
No |
Optional order comment |
"After hours trade" |
Request:
{
"userId": "AB1234",
"jKey": "session_token_here",
"exchange": "NSE",
"retention": "DAY",
"product": "C",
"priceType": "LMT",
"tradingSymbol": "IDEA-EQ",
"transactionType": "B",
"price": "8.9",
"triggerPrice": "0",
"quantity": "100",
"remarks": "AMO Test"
}
Example Usage
curl --location 'https://api.firstock.in/V1/placeAMO' \
--header 'Content-Type: application/json' \
--data '{
"userId": "{{userId}}",
"jKey": "{{jKey}}",
"exchange": "NSE",
"retention": "DAY",
"product": "C",
"priceType": "LMT",
"tradingSymbol": "IDEA-EQ",
"transactionType": "B",
"price": "8.90",
"triggerPrice": "0",
"quantity": "1",
"remarks": "AMO Order"
}'
from firstock import firstock
placeAMO = firstock.placeAMO(
userId="{{userId}}",
exchange="NSE",
tradingSymbol="ITC-EQ",
quantity="1",
price="300",
product="I",
transactionType="B",
priceType="LMT",
retention="DAY",
triggerPrice="0",
remarks="Python Package AMO"
)
print(placeAMO)
const { Firstock } = require("firstock");
const firstock = new Firstock();
firstock.placeAMO(
{
userId: "{{userId}}",
exchange: "NSE",
tradingSymbol: "IDEA-EQ",
quantity: "1",
price: "7.00",
product: "C",
transactionType: "B",
priceType: "LMT",
retention: "DAY",
triggerPrice: "0",
remarks: "NodeJS AMO Order",
},
(err, result) => {
if (err) {
console.log("AMO Error: ", err);
} else {
console.log("AMO Result: ", result);
}
}
);
import (
"fmt"
"github.com/the-firstock/firstock-developer-sdk-golang/Firstock"
)
func main() {
placeAMORequest := Firstock.PlaceOrderRequest{
UserId: "{{userId}}",
Exchange: "BSE",
Retention: "DAY",
Product: "C",
PriceType: "LMT",
TradingSymbol: "SAWACA",
TransactionType: "B",
Price: "0.42",
TriggerPrice: "0.40",
Quantity: "1",
Remarks: "Golang AMO Order",
}
placeAMO, err := Firstock.PlaceAMO(placeAMORequest)
fmt.Println("Error:", err)
fmt.Println("Result:", placeAMO)
}
Response Structure
Success Response (200 OK):
If the After Market Order (AMO) is placed successfully, you will receive a 200 OK status. The logic ensures that even if there is a slight delay in the backend, the API will attempt to retrieve the order number from the order book or Redis before responding.
- status: Typically "success".
- message: Brief description of the outcome (e.g., "Order details").
- data: An object containing the processed order details.
Key Fields in the data object:
- orderNumber: A unique identifier for the placed order (Noren Order Number)..
- requestTime: The timestamp when the order was processed, formatted as HH:MM:SS DD-MM-YYYY.
Failure Response (400/401):
If the request is malformed, authentication fails, or the downstream gRPC service is unavailable, you will receive a failure response.
- status: failed.
- code: The HTTP status code (e.g., "400", "401").
- name : A brief descriptor of the error category (e.g., "BAD_REQUEST", "UNAUTHORIZED", "SERVICE_UNAVAILABLE")
- error: An object or string indicating which field caused the issue and a descriptive error message.
Response
{
"status": "success",
"message": "Order details",
"data": {
"orderNumber": "26030400001234",
"requestTime": "09:45:08 04-03-2026"
}
}
{
"status": "failed",
"code": 400,
"name": "BAD_REQUEST",
"error": {
"field": "price",
"message": "Invalid price format. Must be a numeric string."
}
}
Usage & Best Practices
- Mandatory Defaults
- If you send an empty
retentionfield, it will default to"DAY". ordersource is always mapped to"API"
- If you send an empty
- Numeric Fields
- Even though fields like
priceandquantityrepresent numbers, they must be sent as strings in the JSON payload to ensure strict parsing.
- Even though fields like
Conclusion
The Place After Market Order (AMO) API is a vital component for developers building comprehensive trading applications on the Firstock platform. It bridges the gap between market sessions, allowing users to plan and queue their trades with confidence while the exchange is closed.