Place order for option says "Transactions Fails" in Dhan API

dhan.place_order(
                transaction_type=dhan.BUY,
                exchange_segment=dhan.FNO,
                product_type=dhan.MARGIN,
                order_type=dhan.MARKET,
                validity='DAY', 
                security_id='13',
                quantity=quantity,
                price=0,
                drv_expiry_date='2024-03-14',
                drv_options_type='CALL',
                drv_strike_price=(utils.getATMForNifty(current_price) - gd.OPTION_ITM)
            )

Response for placed order:

{
    "data": "",
    "remarks": {
      "error_code": "RS-9005",
      "message": "Transactions Fails."
    },
    "status": "failure"
  }

Security ID 13 is of NIFTY, U Cant trade Spot. U have to retrieve the Instrument Security ID of the Leg which you wanna place order in.

Thanks!

dhan.place_order(
                transaction_type=dhan.BUY,
                exchange_segment=dhan.FNO,
                product_type=dhan.MARGIN,
                order_type=dhan.MARKET,
                validity='DAY', 
                security_id='43895',
                quantity=quantity,
                price=0
            )

This is correct?

Looks correct so far. Try it

Thanks. It’s working.

1 Like