[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