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".
Determining if stock is shortable
Determining if stock is shortable
- Attachments
-
- Determine shortable.zip
- (486 Bytes) Downloaded 425 times
-
- Site Admin
- Posts: 244
- Joined: Mon Apr 24, 2017 3:24 pm
Re: Determining if stock is shortable
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
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
Re: Determining if stock is shortable
OK, thank you I will give that a try.