Minimizing the initial margin impact from many simultaneous orders

Discussion in 'Interactive Brokers' started by nijshar28, Jun 8, 2020.

  1. Actually that does not make any sense, it is probably due to the value of some other positions (that don't drive the P&L) moving against me.

    I wish there was a way to look up maintenance margin for individual positions, so it would be easier to track what is going on.
     
    #11     Jun 8, 2020
  2. This is possible via the API (and with TWS) by using the "what-if" flag. By using this you can see how much margin would be required to open a certain position. Vice versa can this also show how much margin becomes available when you close an open position.
    http://interactivebrokers.github.io/tws-api/margin.html
    https://www.interactivebrokers.com/...book/thetradingwindow/checkmarginposition.htm
     
    #12     Jun 8, 2020
    nijshar28 likes this.
  3. #13     Jun 9, 2020
  4. So this is interesting. I tried pre-submitting the orders with the whatif flag and all of them are returned as compliant. I.e. the projected INITIAL MARGIN after the order is filled is less than the projected Equity with loan value. But when I try to submit the orders all at once, I still get a bunch of warnings, like this:

    "
    Error 201, reqId 76135: Order rejected - reason:YOUR ORDER IS NOT ACCEPTED. IN ORDER TO OBTAIN THE DESIRED POSITION YOUR EQUITY WITH LOAN VALUE [992116.72 USD] MUST EXCEED THE INITIAL MARGIN [991563.68 USD] PLUS VALUATION UNCERTAINTY [680.59 USD]
    Canceled order:
    "

    The INITIAL MARGIN requirement stated in the warning message is higher than what the individual WhatIf order pre submissions state. To be clear, the highest projected initial margin I get from an individual order is 984995.27.

    I wonder if IB is compounding the impact of multiple orders upon submission and if that compounded impact exceeds the margin. That still does not make sense as when I broke up the orders into closing and opening batches yesterday, it ran fine without any margin warnings. So it must be treating opening and closing orders differently somehow.

    EDIT: I checked the compounded effect on margin based on projected what-if impact from individual orders and the net impact should still keep the margin below the ELV.
     
    Last edited: Jun 9, 2020
    #14     Jun 9, 2020
  5. Interesting. I have not seen this error message before. The part about "valuation uncertainty" is new to me. Maybe this appears when you submit a what-if order when the market is closed? Or when the trade is in a different currency and there is no current exchange rate available? I don't know why there is uncertainty in your particular case. Certainly something you would need to look into.

    I fear that I was incomplete about how to use the "what-if" in the API. What you get to see is the margin in use before the order submission. And the margin in use after the order would have been executed. The difference is the margin requirement for this order line (i.e. for this particular stock and for the quantity that you want to trade). Calculating this for all order lines which you intend to submit you can get an impression whether you will be going over your available limit.
     
    #15     Jun 9, 2020
    nijshar28 likes this.
  6. Thank you. I think I understand how it is intended to work. But for whatever reason, it doesn't.

    The what-if feature does make it easier to figure out which orders will increase, and which orders will decrease the margin. So I will reserve to splitting the orders into margin decreasing and margin increasing batches for now. Though it is not ideal.

    As far as the liquidation uncertainty, I always see that has some small value (usually like a $100). I think it could be due to the fact that I trade some very illiquid names, so maybe it is unsure what the current market price is? It doesn't bother me much, as it is a very small fraction of the total account value.
     
    Last edited: Jun 9, 2020
    #16     Jun 9, 2020
  7. Another thought that I had is that since I am using MKT orders, maybe the prices move against me, between the time I run the whatif check and actually execute the order (which causes the margin requirements to be violated). I will look into this more, and maybe try placing cashqty orders, where the number of shares is adjusted automatically based on the current price.
     
    #17     Jun 9, 2020