How to know required price before placing the orders

HI,

I am facing issue while placing the orders in options. those are getting rejected due to high volatality in some times. i want to check what is the required money for my trading strikes.

i want to check this price with my available price before placing the order. plz help

Forgot to tell you i am placing the orders through algo.

Copy

curl --location --request POST 'https://api.fyers.in/api/v2/span_margin' \ --header 'Authorization: UC0KMO****-102:eyJ0eX*****' \--header 'Content-Type: application/json' \ --data-raw '{
         "data": [{
           "symbol": "NSE:HDFC-EQ",
           "qty": 50,
           "side": 1,
           "type": 2,
           "productType": "INTRADAY",
           "limitPrice": 0.0,
           "stopLoss": 0.0
         }, {
           "symbol": "NSE:SBIN-EQ",
           "qty": 50,
           "side": -1,
           "type": 2,
           "productType": "INTRADAY",
           "limitPrice": 0.0,
           "stopLoss": 0.0
           }]

I am using above code but getting below error, please help ANYONE

{"s": "error", "code": 500, "message": "Invalid Request, please provide valid method"}

Hi @reddinaiiduu_ns ,

We are working on Margin calculator API which will provide required margin. I will update you soon.

Thanks. please update as early as possible. Because it is very crucial in option selling hedging.

curl --location --request POST 'https://api.fyers.in/api/v2/span_margin' \ --header 'Authorization: UC0KMO****-102:eyJ0eX*****' \--header 'Content-Type: application/json' \ --data-raw '{
         "data": [{
           "symbol": "NSE:HDFC-EQ",
           "qty": 50,
           "side": 1,
           "type": 2,
           "productType": "INTRADAY",
           "limitPrice": 0.0,
           "stopLoss": 0.0
         }, {
           "symbol": "NSE:SBIN-EQ",
           "qty": 50,
           "side": -1,
           "type": 2,
           "productType": "INTRADAY",
           "limitPrice": 0.0,
           "stopLoss": 0.0
           }]
}'

Hi @reddinaiiduu_ns ,

The issue is resolved. You can this code to get required margin.

Is this code tested?

Because it is not working for me.

Giving error like Array ( [s] => error [code] => -50 [message] => Invalid input )

What i want exactly.

When we place 1 sell order in bank nifty options required margin margin might be 1 lak +

when we place 1 buy order in the basket it might be reduced upto 30k depends on stikes.

I need the code for this final required margin.

please help me.

thanks