Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: Inconsistent behaviour of WHATIF orders
If you're on portfolio margin then the behavior is completely consistent. Not every trade increases margin if it's considered to be risk reducing by IB's PM model.
Now, if you're seeing a disparity between the response from your API app and TWS "Check Margin" window, you have a separate problem. |
Re: Inconsistent behaviour of WHATIF orders
On Mon, Apr 26, 2021 at 05:31 PM, Despair wrote:
I started with just one contract - result zero. Then I started increasing the position size. Two contracts - still zero.Could it be possible that you already have some positions, for example short calls, and selling 1-2 puts would not increase the margin requirement.? but when you are selling 3-4, it brings more risk on the other direction and therefore the margin increases.? |
Re: How to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions
thanks for the reply.? Actually I am no where near trading with API yet.? I am still too new for this.? ?What I am trying to do now is still "read-only".? In particular, now I want to know the maintenance margin for each symbol in my portfolio.? Is there any way to "read" out this information other than submitting an what-if order that close all positions of a symbol?
|
Re: How to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions
I don't know if the API will be able to calculate what you're looking for.? It doesn't seem like a good sign if you are unsure about your margin/buying power while trying to open multiple stk/opt positions at once... Do all of these positions need to be opened simultaneously?? If done sequentially IB will tell you exactly what your margin requirements are for each trade.? I wonder if you might consider rethinking your strategy... On Mon, Sep 6, 2021 at 7:14 AM <groups@...> wrote: yes exactly.? For example closing the short call on a covered call position is actually increasing margin.? ?I can see the information with what-if window in TWS or from margin report, but so far I am not sure how to get the programatically. |
Re: Why is this order invalid and rejected?
Thanks for the reply.
Actually I don't even need it to be guaranteed.? Smart routed or not also doesn't matter to me.? Would it be possible? What I really want to do is to check the margin difference if I close all these positions but so far I haven't found a way to do so programatically. |
Re: How to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions
yes exactly.? For example closing the short call on a covered call position is actually increasing margin.? ?I can see the information with what-if window in TWS or from margin report, but so far I am not sure how to get the programatically.
|
Re: Why is this order invalid and rejected?
On Mon, Sep 6, 2021 at 06:10 AM, <groups@...> wrote:
Hmm, I didn't know that we need equal number of contracts in each leg.? Is this a limitation for combo with >=3 legs?Ultimately, that's a "custom" combo order.? Not all exchanges allow them, so TWS isn't going to allow it on a smart route.? I'm not sure if they'll allow it on a directed route either, there's so little flow of those orders, they prove more annoying than they're worth. Now if you're always going to execute them MKT, you can send them to me and I'll gladly rip you off executing them.?? |
Re: How to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions
I'm fighting with the same issue. I'd desperately need to get the margin for a basket of several orders. Simply running WHAT_IF on each leg and then adding altogether doesn't give the correct result since the margin of one position is depending also on the other positions you hold.
|
openOrder:orderState vs orderStatus:status
Hi,
Just wondering if anyone could explain why the API provides both openOrder and orderStatus as callbacks from reqOpenOrder?? It seems they have overlapping information (both report status), and I can't see an apparent reason why the respective information needs to be reported in two separate callbacks. Specifically, I just want the status of my orders, and I'd like to know if there's any difference in using the status from openOrder vs orderStatus? (Will OpenOrder:status always equal orderStatus:status?) I'm fairly new to the API so apologies if this is a na?ve question.... |
Re: Why is this order invalid and rejected?
Probably because you don’t have equal number of contracts in each leg? On Sun, Sep 5, 2021 at 12:50 <groups@...> wrote:
|
How to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions
Hello friends,? I am quite excited to find the group here.? I am quite new to TWS API and so far I like it a lot.?
One task I am giving myself is to get the maintenance margin of one symbol, containing multiple STK and/or OPT positions.? I know this information is available on margin report, but I don't know a way to get it with the TWS api, nor with flex query api. This information is also "calculable" in the what-if navigator in TWS, by unchecking the position, refreshing the margin and calculating the difference.? With the api, so far what I did is to use a combo order to close all positions of a symbol with whatIf marked to be true, then I can get the maintenance margin change in order state.? This is ok for most of my positions but not all.? For example I have a few HKG:0700 stocks, one short put and one short call.? The combo order to close all three positions cannot be submitted since it seems like that both guaranteed and non-guaranteed are not supported in this case.? ?I hope there are some other ways that I haven't found.?? |
Locked
Re: How to increase chance of filling and order
Please folks keep this civil! Luke, Nick was merely trying to ensure that you have a basic understanding of how markets operate. If you do already have this understanding (and there is no way he could know this), then your question comes across as slightly na?ve: the API is not magic – IB merely submits your orders to the market and the normal rules and dynamics of the market inevitably hold. I'm going to lock this thread now, because I think it's rather off-topic and your question has been fairly comprehensively answered. Richard King TWSAPI Group Owner and Moderator |
Locked
Re: How to increase chance of filling and order
@Nick I understand everything you said. That was not my question, my question was what i can do to improve fills and if there is anything in TWS api that can help with that. If this is how you decide to contribute to the topic, dont contribute at all. |
Locked
Re: How to increase chance of filling and order
Nick
Sure, but I don't think that changes the mechanics of the fills. It certainly does change what a strategy needs to be aware of in order to be profitable.
toggle quoted message
Show quoted text
On 9/4/2021 9:32 AM, Goose4all wrote:
so, its certainly important to factor in some "algorithmic behavior" on |
Locked
Re: How to increase chance of filling and order
thats a rather simplistic view.. there is a ton of algos watching the
toggle quoted message
Show quoted text
order book and take a trade (or not).. for example if you want to buy more than 1 option and go in at market, they usually even pull and offer higher. but you could as well bid at the mid price and most often get a fill there.. so, its certainly important to factor in some "algorithmic behavior" on "our side" to not get ripped off. On 9/4/21 9:29 AM, Nick wrote:
You need to at least attempt to understand some amount of market |
Locked
Re: How to increase chance of filling and order
Nick
You need to at least attempt to understand some amount of market mechanics. There is no mystery or unfairness in what you are seeing.
toggle quoted message
Show quoted text
There is a line of people willing buy at a specific price (bids) and a line of people willing to sell at a specific price (asks). When the prices come together a trade happens. When you enter an order you go to the back of the line. When trades happen at your level they are filled to the people at the front of the line. There can be thousands of shares ahead of you in line. Your order won't fill until all the shares in front of you have been filled. You can't be looking at prices near the last trade and expect to enter an order and have it fill right away. There's already a line of people in front of you - they could have been there for hours already. Either you want to enter a trade right now (a market order) and accept whatever you need to pay to move to the front of the line or you set a specific price (a limit order) and get your place in line and accept that prices may never get to your place in line. On 9/4/2021 9:13 AM, Luke wrote:
I guess part of the confusion comes from the fact that i can see trades happening at the price i want to trade, but my orders never trigger there. Its like if there are some other traders, who have priority, they get to trade at the best price, while others dont. |
Locked
Re: How to increase chance of filling and order
@Bradley
You mean these?? I have started looking into these, thats the only thing i was able to find i did not look into yet. I wonder if that can help with improving fills on orders. |