Liquidation of open positions dont work due to "insufficient qty"

Hello :smiley:

I want to liquidate all of my positions before the weekend. I use stop loss order:

    response = api.submit_order(
        symbol='TSLA',
        qty= 1,
        side='buy',
        type='market',
        time_in_force='gtc',
        order_class= 'bracket',
        take_profit= {
            'limit_price': round(recent_data['High'] * 1.02, 2)
        },
        stop_loss= {
            'stop_price': round(recent_data['Low'] * 0.98, 2)
        }
    )
    return response

Although there is an open position, the function “api.close_all_positions()” won’t liquidate but instead returns following object:

[Position({ ‘body’: { ‘available’: ‘0’,
‘code’: 40310000,
‘existing_qty’: ‘1’,
‘held_for_orders’: ‘1’,
‘message’: 'insufficient qty available for order (requested: ’
‘1, available: 0)’,
‘symbol’: ‘TSLA’},
‘status’: 403,
‘symbol’: ‘TSLA’})]

What does that mean? And how can I solve this issue?

I appreciate any kind of help.
Thank you in advance.
Sincerely IDv MdB Mühle

I’m definitely not an expert, but I think from what i’ve read on these forums previously, it has to do with blocking quantity from being traded that is held for another order?

You have “held_for_orders” = 1. Not sure why that is, but seems to be related.