Margin extract

Discussion in 'Interactive Brokers' started by weinkoeln, Aug 3, 2022.

  1. weinkoeln

    weinkoeln

    Hello everyone

    I am trying to extract the impact on my margin when closing a position to Excel. So far, I only found the possibility to extract the impact of an position increase via the Risk Navigator, whilst the information I am looking for seems only to be available when clicking on a position in the TWS (-->"Show Margin impact").

    Has anyone an idea how I could get these figures per position for the entire portfolio?

    Thank you.
     
  2. ValeryN

    ValeryN

    If you're using IB API, they have a parameter on submitOrder that only calculates margin. Not sure how to link that to excel. IB also offers public FTP server with margin requirements for every ticker, which can be used to calculated that value.
     
  3. That parameter is called WhatIf, which is a boolean. If you set it to true, then only the margin impact, estimated commission and some others is calculated, but the order is not actually submitted.
     
  4. ET180

    ET180

    Interesting, I was just looking into this today for the first time.

    https://interactivebrokers.github.io/tws-api/margin.html

    This part isn't very well documented. I eventually just realized that for me, the cheapest way to "buy back" margin is to buy far OTM SPX calls for 0.05 each.