Announcement

Collapse
No announcement yet.

How to get existing positions from the Broker ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get existing positions from the Broker ?

    I am trying to see which function I should use to get my existing positions (for a particular symbol) from the Broker.

    Here's a snippet of my code:

    var symbol = getSymbol();
    debugPrintln("This is the symbol " + symbol);
    var position = new SBPosition(getSymbol());
    debugPrintln("This is the position variable " + position.Size);

    The position always returns as 0. Now I do not know the construction method for SBPosition (not given in any guide/help file).

    Could someone who has success is getting their existing position quantity from the broker please post that snippet of code ?

    Also if there is any code that directly links to interactive brokers to place 'buy' and 'sell' orders, please post that example ?
Working...
X