Skip to main content

Strategies

Bull Call Spread

The Bull Call Spread places two orders which both the legs will be call 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/bullCallSpread

Request details

API Parameters
Parameter Description Example
symbol
String
Trading Symbol e.g. "NIFTY",
"BANKNIFTY"
NIFTY
callBuyStrikePrice
String
Strike Price of the symbol for
buying
17500
callSellStrikePrice
String
Strike Price of the symbol
for selling
18000
expiry
String
Expiry date of the contract
(e.g., "03NOV22")
16JAN23
product
String
Product type (C -> Cash and Carry,
M -> F&O Normal, I -> Intraday)
I
quantity
String
Order Quantity 1
remarks
String
User can send remarks for
the order
BullCallSpread
jKey
String
Key Obtained on login success 28fa3983bd7a6
userId
String
User Id of the login user AA1999

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

BCS = thefirstock.firstock_BullCallSpread(
    symbol="NIFTY",
    callBuyStrikePrice="18000",
    callSellStrikePrice="17800",
    expiry="23FEB23",
    product="C",
    quantity="15",
    remarks="Hello",
    userId="PV0013"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/strategies/bullCallSpread' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jKey": "{{jKey}}",
  "userId": "{{userId}}",
  "callBuyStrikePrice": "20000",
  "callSellStrikePrice": "19000",
  "symbol"="NIFTY",
  "expiry": "",
  "product": "",
  "quantity": "",
  "exchange": "",
  "priceType": "",
  "retention": "",
  "remarks": ""
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();
firstock.bullCallSpread(
  {
    userId: {{userId}},
    symbol: "NIFTY",
    callBuyStrikePrice: "18000",
    callSellStrikePrice: "17000",
    expiry: "10NOV22",
    product: "I",
    quantity: "1",
    remarks: "BullCallSpread",
  },
  (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.bullCallSpread(userId: {{userId}},
                                             symbol: "NIFTY",
                                             callBuyStrikePrice: "18000",
                                             callSellStrikePrice: "17000",
                                             expiry: "02MAR23",
                                             product: "I",
                                             quantity: "1",
                                             remarks: "BullCallSpread"
                                             );
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Status of the API request,
indicating whether it was
successful or not.
success
data.requestTime
String
Indicates the time at which
the response was received, providing
a timestamp for the transaction.
17:49:14 16-02-2023
data.orderNumber
String
Unique identifier for the order,
present only on successful Order
placement to OMS.
1234567890
[
  {
    status: "success",
    data: {
      requestTime: "17:49:14 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
  {
    status: "success",
    data: {
      requestTime: "17:49:14 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",
    },
  },
];