Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
IB Live Trading Shorting Availability / Fees

I'm just looking through API documentation, and I didn't come across the API calls for IB to check the number of shares available to short and the present shorting fee for shorting the stock.

https://www.interactivebrokers.com/en/?f=%2Fen%2Ftrading%2FViewShortableStocks.php%3Fcntry%3Dusa%26a

Is the sort of information I want to be able to query through the API.
To query the shorting fee rate itself you need to be logged into IB.

Apologies if this is covered in the API docs and I missed it.

4 responses

Unfortunately, it's not something that we have good support for at this time. Depending on what tools and brokerage info you have, you might be able to get shorting availability into a CSV and then import it using Fetcher each morning. But there is no easy, pre-built API.

It's definitely something we want to add in the future.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks for your answer Dan. Look forward to that feature.

Another question for you - what happens to a running algorithm if a stock that is being shorted presently gets recalled (as in the broker no longer has any inventory available).

The actual recall process is entirely done by your broker, according to your agreement with them. Quantopian will learn about it when your position changes - presumably some short position will close, or get smaller. When that happens, Quantopian automatically synchronizes your algorithm's portfolio to match the broker-reported portfolio.

There isn't a special handler for this kind of situation - we do a synchronization every minute, and this is one of the many cases that is handled by that.

Thanks Dan that's good to know.
I wasn't sure if there'd be an exception or the algo would stop.