Skip to main content

Strategies

Long Straddle

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

Method: POST

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

Request details

API Parameters
Parameter Description Example
symbol
String
Trading Symbol
(e.g., "NIFTY", "BANKNIFTY")
NIFTY
strikePrice
String
Strike Price of the symbol
(e.g., "17500", "16130")
17500
expiry
String
Expiry Date
(e.g., "03NOV22")
16JAN23
product
String
Product Type (C / M / I) C
quantity
String
Order Quantity 1
remarks
String
User Remarks for the order longStraddle
jKey
String
Key Obtained on login success 28fa3983bd7a63348
userId
String
User Id of the login
user
AA1999

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

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

const firstock = new Firstock();
firstock.longStraddle(
  {
    userId: {{userId}},
    symbol: "NIFTY",
    strikePrice: "17000",
    expiry: "10NOV22",
    product: "I",
    quantity: "1",
    remarks: "longStraddle",
  },
  (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 result status of
the API operation
success
data.requestTime
String
Response received time. 17:39:14 16-02-2023
data.orderNumber
String
Present only on successful
Order placement to OMS
1234567890111
[
  {
    status: "success",
    data: {
      requestTime: "17:39:14 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
  {
    status: "success",
    data: {
      requestTime: "17:39:14 16-02-2023",
      orderNumber: "1234567890111",
    },
  },
];

Failure response details

API 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_TRADINGSYMBOL
error.field
String
Field in the request that
triggered the error
tradingSymbol
error.message
String
Detailed message describing
the error
TradingSymbol parameter
is invalid
[
  {
    status: fFailed",
    code: "401",
    name: "INVALID_TRADINGSYMBOL",
    error: {
      field: "TradingSymbol",
      message: "TradingSymbol parameter is invalid",
    },
  },
  {
    status: "failed",
    code: "401",
    name: "INVALID_TRADINGSYMBOL",
    error: {
      field: "TradingSymbol",
      message: "TradingSymbol parameter is invalid",
    },
  },
];