Skip to main content

Strategies

Bear Put Spread

The Bear Put Spread places two orders which both the legs will be put and in which the first one is bought and second one is sold, the strike price can be defined by the users

Method : POST

https://connect.thefirstock.com/api/V4/strategies/bearPutSpread

Request details

API Parameters
Parameter Description Example
symbol
String
Trading Symbol e.g.
("NIFTY", "BANKNIFTY")
NIFTY
putBuyStrikePrice
String
Strike Price of the symbol
e.g.("17500", "16130")
17500
putSellStrikePrice
String
Strike Price of the symbol
e.g.("17500", "16130")
17500
expiry
String
Date month year
e.g.("03NOV22")
16JAN23
product
String
C / M / I C -> Cash and Carry,
M -> F&O Normal, I -> Intraday
C
quantity
String
Order Quantity 1
remarks
String
User can send remarks for the order BearPutSpread
jKey
String
Key Obtained on login success. 28fa3983bd7a63348
(truncated for brevity)
userId
String
User Id of the login user AA1999

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

BPS = thefirstock.firstock_BearPutSpread(
    symbol="NIFTY",
    putBuyStrikePrice="18000",
    putSellStrikePrice="17800",
    expiry="23FEB23",
    product="C",
    quantity="10",
    remarks="Hello",
    userId="{{userId}}"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/strategies/bearPutSpread' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jKey": "{{jKey}}",
  "userId": "{{userID}}",
  "putBuyStrikePrice": "20000",
  "putSellStrikePrice": "19000",
  "expiry": "",
  "symbol"="NIFTY",
  "product": "",
  "quantity": "",
  "exchange": "",
  "priceType": "",
  "retention": "",
  "remarks": ""
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();
firstock.bearPutSpread(
  {
    userId: {{userId}},
    symbol: "NIFTY",
    putBuyStrikePrice: "17500",
    putSellStrikePrice: "17500",
    expiry: "10NOV22",
    product: "C",
    quantity: "1",
    remarks: "BearPutSpread",
  },
  (err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
  }
);
using thefirstock;

class Program
{
    public static void Main()
    {
        Firstock firstock = new Firstock();
        var result = firstock.bearPutSpread( userId: {{userId}},
                                             symbol: "NIFTY",
                                             putBuyStrikePrice: "17500",
                                             putSellStrikePrice: "17500",
                                             expiry: "02MAR23",
                                             product: "C",
                                             quantity: "1",
                                             remarks: "BearPutSpread"
                                              );
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the outcome of the API request success
data.requestTime
String
Timestamp indicating when the response
was received
14:10:13 15-02-2023
data.orderNumber
String
Unique identifier for the order,
provided upon successful placement
1234567890111
[
  {
    status: "success",
    data: {
      requestTime: "17:25:25 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
  {
    status: "success",
    data: {
      requestTime: "17:25:25 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
];

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the result status of
the API operation
failed
code
String
HTTP status code associated with
the error
401
name
String
Specifies the type or category
of the error encountered
INVALID_JKEY
error.field
String
Field in the request that
triggered the error
jKey
error.message
String
Detailed message describing the
error
jKey parameter is
invalid
[
  {
    status: "failed",
    code: "401",
    name: "INVALID_JKEY",
    error: {
      field: "jKey",
      message: "jKey parameter is invalid",
    },
  },
  {
    status: "failed",
    code: "401",
    name: "INVALID_JKEY",
    error: {
      field: "jKey",
      message: "jKey parameter is invalid",
    },
  },
];