Skip to main content

Strategies

Long Strangle

The Long Strangle places two orders which one leg will be call and another will be put, the strike price can be defined by the users for both the call and put leg.

Method :POST

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

Request details

API Parameters
Parameter Description Example
symbol
string
Trading Symbol e.g. ("NIFTY", "BANKNIFTY") NIFTY
callStrikePrice
string
Strike Price of the symbol 17500
putStrikePrice
string
Strike Price of the symbol 17500
expiry
string
Date month year 03NOV22
product
string
C / M / I C
quantity
string
Order Quantity 1
remarks
string
User can send remarks for
the order
longStrangle
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

LS = thefirstock.firstock_LongStrangle(
    symbol="NIFTY",
    callStrikePrice="18000",
    putStrikePrice="17800",
    expiry="23FEB23",
    product="C",
    quantity="10",
    remarks="Hello",
    priceType="MKT",
    retention="DAY",
    jKey="{{jKey}}",
    userId="{{userId}}"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/strategies/longStrangle' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jKey": "{{jKey}}",
  "userId": "{{userID}}",
  "symbol": "",
  "callStrikePrice": "",
  "putStrikePrice": "",
  "strikePrice": "",
  "expiry": "",
  "product": "",
  "quantity": "",
  "exchange": "",
  "priceType": "",
  "retention": "",
  "remarks": ""
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();
firstock.longStrangle(
  {
    userId: {{userId}},
    symbol: "NIFTY",
    callStrikePrice: "18000",
    putStrikePrice: "17000",
    expiry: "10NOV22",
    product: "I",
    quantity: "1",
    remarks: "longStrangle",

  },
  (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.longStraddle(userId: {{userId}},
                                           symbol: "NIFTY",
                                           strikePrice: "17000",
                                           expiry: "02MAR23",
                                           product: "I",
                                           quantity: "1",
                                           remarks: "longStraddle"
                                           );
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the success status
of the API operation
success
data.requestTime
String
Timestamp indicating when
the response was received
17:34:47 16-02-2023
data.orderNumber
String
Unique identifier for the order
, provided upon successful placement
to OMS
1234567890
[
  {
    status: "success",
    data: {
      requestTime: "17:34:47 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
  {
    status: "success",
    data: {
      requestTime: "17:34:48 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
400
name
String
Specifies the type or category
of the error encountered
BAD_REQUEST
error.field
String
Field in the request that
triggered the error
symbol
error.message
String
Detailed message describing
the error
symbol cannot be undefined
or NULL
{
    "status": "failed",
    "code": "400",
    "name": "BAD_REQUEST",
    "error": {
        "field": "symbol",
        "message": "symbol cannot be undefined or NULL"
    }
}