Philadelphia PA
Posts: 1 since Aug 2015
Thanks Given: 0
Thanks Received: 0
|
Hi,
I'm trying to write a code that when a short sale is open for a sufficiently long time and is profitable that the program automatically "rebalances" the position, taking advantage of the increase in equity caused by the short sale profit.
I am currently doing this buy entering a buy to cover order for the entire position, then re-shorting the new larger number of shares. This is fine except for when shares are not available where it closes the position and is unable to re-short.
1) Is there a way to check the short inventory through easylanguage? (Using IB)
2) I've tried to only short the "profit' equity (i.e. if I had 100 shares short, the position profit gave me enough new equity for 10 shares, so I would short an additional 10 shares) but using functions under the GetPosition___ family don't seem to work.
Any ideas would be very appreciated!
Thanks
|