Determining if stock is shortable

Discuss, post your questions about TWSLink here.

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
Post Reply
Casey
Posts: 10
Joined: Thu Sep 14, 2017 8:19 pm

Determining if stock is shortable

Post by Casey »

I am having trouble determining if a stock is shortable.

At the moment, AAPL has shares to short, ZYNE does not, ITUS does not AND is short sale restricted (per IB documentation, apparently there is no access to short sale restriction status via the API).

When I test the attached batch script, it returns the same values for all three tickers; "Shortable" and "Inventory" both return "1".
Attachments
Determine shortable.zip
(486 Bytes) Downloaded 425 times

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Determining if stock is shortable

Post by board_admin »

The shortable information is not in the return value of the market data request.
It is carried by a tick value when you get new market data.
According IB, the shortable info in request must not be a snapshot, so set last param of request to 0.

Market data (and shortable information) are catched by market data events or callback.
The main category or market data callback is 1. So the first parameter (integer) has value 1.

The callback param meanings are explained here:

file:///C:/Program%20Files%20(x86)/trade-commander/twslink2/Documentation/html/cb_1.html

(should be same location on your machine).

The callbacks are recorded on page 2 of TWSLinkBate and its columns show the callback parameter
values.

If your tick option is 236, you should wait for a generic tick which has the shortable information.
That means:
- param3 (integer) should have value 46. This means the tick is a shortable information
- param4 (integert) should have value 45. This means, the tick is a generic tick (so a response to 236)
- param5 (double) carries shortable information like described here:

https://interactivebrokers.github.io/tw ... &gsc.tab=0

Summary:
- set snapshot value to 0 (continous data)
- set exchange to NASDAQ
- catch the value for shortable in market data tick

find the changed script attached
Attachments
Determine shortable2.zip
(501 Bytes) Downloaded 436 times

Casey
Posts: 10
Joined: Thu Sep 14, 2017 8:19 pm

Re: Determining if stock is shortable

Post by Casey »

OK, thank you I will give that a try.

Post Reply