Skip to main content

Place Order Examples

Firstock

Welcome, everyone! In this comprehensive guide, we will walk you through the process of placing orders on Firstock for various types of instruments, including NFO (NSE - Futures & Options), BFO (BSE - Futures & Options), BSE (Bombay Stock Exchange), and NSE (National Stock Exchange).

We will also explore the execution of these orders using different environments, such as Postman, Python, and various libraries. Whether you're a beginner or an experienced trader, this post will provide you with step-by-step examples and insights to help you navigate the world of stock trading on Firstock.

Before we start with the order placements let's understand the parameters included with the place order.

Request Body

The request body should be a JSON object containing the following parameters:

  • userId (string, Required): The userId is the unique parameter accquired during the onboarding with Firstock, example: AA0013

  • exchange (string, Required): This parameter lets you place order in their respective exchanges, Currently Firstock supports NSE, NFO, BSE, BFO, example: NFO

  • tradingSymbol (string, Required): It's the encoded trading symbol provided by the respective exchanges, you download the entire symbol list from Packages & Installations., example: BANKNIFTY28DEC23C42400

Note: If a trading Symbol consists of a special symbol, please use the URL encoding. example: L&TFH-EQ should be sent as L%26TFH-EQ

  • quantity (string, Required): Number of shares to be traded and this is usually given in lots, and varies from one trading symbol to another.
    example: For NIFTY 50 one(1) lot is 50 quantity

  • price (string, Required): The price of the particular shares, if the price is given 0 then the order will be placed to the price available in the market then the price type should be MKT and if the LMT parameter is mentioned then the price must be specified. example: 13.13

  • triggerPrice (string, Required): The price at which the order will be triggered, this can be set if the price type is set to SL-LMT
    example: 11

  • product (string, Required): The type of order to be placed, if the exchange is NSE/BSE then the product type will be C and if NFO/BFO then the product type will be M or I
    example: M

  • transactionType (string, Required):Transaction type indicates whether to buy or sell the stocks.
    example: B

  • priceType (string, Required): The priceType refers to the order type where there are multiple parameter dependent on this, if the priceType is mentioned as LMT then the price must be specified and if MKT then the price can be 0.
    example: LMT

  • retention (string, Required): Provides the order validity terms,for NSE we use DAY and for BSE we use EOS and IOS means Immediate or cancel where if the order is not executed then it will be cancled.
    example: DAY

  • remarks (string, Required):The user can provide a remarks for the order placed
    example: test order

  • jKey (string, Required):The token provided during login where it is used to authenticate other API.
    example: test order

Here's an example of a request body:

{
    "userId": "{{userId}}",
    "exchange": "NSE", 
    "tradingSymbol": "ITC-EQ",
    "quantity": "250",
    "price": "413",
    "product": "C",
    "transactionType": "B",
    "priceType": "LMT",
    "retention": "DAY",
    "triggerPrice": "0",
    "remarks": "Place Order",
    "jKey": "{{jKey}}"
}

NSE Place Order

To place the NSE order you need to choose the exchange as NSE and tradingSymbol should be chosen from the NSE list, you can find the list in the following link NSE Symbols, you can set the quantity as per provided in the symbol list. The symboy list mentions the minimun qunatity and the order should be placed in (quantity*/lots) eg: 50 x 5 = 250 quantity, and as for the price we can be specify the amount and then the priceType should be set to LMT and if you are unaware of the price you can set it to 0 and push the order to the availabe price in the market by setting priceType to MKT.

For NSE the product must be C as NSE orders are cash market, for transaction type the user can either Sell or Buy.

The price type has three parameters they are LMT, MKT, SL-LMT, this parameter depends on the price and triggerprice.

For retention as it is NSE order we can only specify it as either DAY or IOC.

Trigger Price can only be set if the priceType is SL-LMT.

remarks is to be given out by the user as per his wish.

jKey is the token validation given to the user during login to execute the API.