[Resolved] Issue when trying to place FnO order

Getting the following error when trying to place Option Buy order

Error processing message: dhanhq.place_order() missing 1 required positional argument: ‘self’

for,

        dhanhq.place_order(
            transaction_type=dhanhq.BUY,
            exchange_segment=dhanhq.BSE_FNO,
            product_type=dhanhq.INTRA,
            order_type=dhanhq.MARKET,
            validity='DAY',
            security_id='<security_id>',
            quantity=1,
            disclosed_quantity=0,
            price=0,
        )

am i missing a param called self? if so what is the desired value for it?

you must have made an object from dhanhq. The place_order function should be called on that, and not on dhanhq.

1 Like

Thanks @R.E.M, i missed creating that object. that issue resolved now.

Also @Dhan , @Hardik , im still getting the following error when trying to place a FnO order
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘RS-9005’, ‘message’: ’ todo mandatory fields '}, ‘data’: ‘’}

dhan.place_order(
transaction_type=dhanhq.BUY,
exchange_segment=<exchange_segment>,
product_type=dhanhq.INTRA,
order_type=dhanhq.MARKET,
validity=‘DAY’,
security_id=<sec_id>,
quantity=1,
disclosed_quantity=0,
price=0,
after_market_order=False,
amo_time=“OPEN”,
)

i hope i have covered all mandatory fields, not sure which field im missing out

Hello @TraderX

Can you confirm if you are passing correct quantity? On Order Placement API, we will have to pass quantity as multiple of lots. For e.g. BankNifty will require Quantity as 15 or multiples of 15.

1 Like

Hey, Thanks @Hardik , i was under impression that quantity is in terms of lot for FnO, so was giving as 1 (1lot).

Issue resolved now

1 Like

Hardik
I have sent multiple email about the above error.
I have tried setting the quantity=15 its not working
also tried modifying exchange_segment to dhan.FNO vs dhan.NSE_FNO still not working
and get the same error message above. Sent multiple mails and desperately waiting for a response. Please help.
Sai

Hello @saisaigraph

The team will be reaching out to you to set up a call with us. Will try to get this resolved there, as it is difficult to debug without actual execution code.

how to get security if for nifty
whenever i try to place order for finty it place a buy order fir ABB stock

Hello @devesh

Welcome to Dhan Community!

Nifty itself is not tradeable. You can either buy Nifty Futures or Options or you can even buy ETFs via API. Security ID of any instrument can be fetched from the Security ID List itself.