What is the api to close an open BUY position with MARKET price?

Hi All,

Can anyone pleas help me provide the correct syntax to close a BUY order with market price. I have tried below code and its giving error.

                resp = dhan.place_order(
                    tag='order',
                    transaction_type=dhan.SELL,
                    exchange_segment=dhan.NSE,
                    product_type=dhan.INTRA,
                    order_type=dhan.MARKET,
                    validity='DAY',
                    security_id=secid,
                    quantity=25,
                    disclosed_quantity=0,
                    price=0,
                    trigger_price=0,
                    after_market_order=False,
                    amo_time='OPEN',
                    bo_profit_value=0,
                    bo_stop_loss_Value=0,
                    drv_expiry_date=None,
                    drv_options_type=None,
                    drv_strike_price=None
                )

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