How to check in python if a sell order cannot be done?

Good morning. I’m trying to sell on short a certain number of stocks using the api.submit_order instruction, but I get an error of the alpaca API “… trade_api.rest.APIError: asset “BBIG” cannot be sold short” without the possibility to catch the error using try and except instructions.

Then I go to the web platform and I try to the sell the same stock, after the sell short process is complete, the order is not post in paper trading orders and also I don’t get any error message.

How can I know using python if a stock can be or can not be sell on short?

Best regards

German

1 Like

I found the solution getting the information from the stock

                    info_asset = api.get_asset(stock)
                    if info_asset.shortable==False:
                        logging.info("Stock "+stock+" it is not possible to sell on short")

Thanks

German

1 Like