Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
how to open two sides market orders?
I would like to make two differents trade for the same futures.
I would like to open a buy and a sell position at the same time. For now, I open a buy position and when I want to open a other sell position the buy position get closed. I would like to have them open together and to be able to close one without closing the other. I tried to log in two different client id but this is not working. this is my code: from ib_insync import * |
If you think about it for a bit, opening two contradictory orders for the same value, but with different exit conditions is going to cancel the main body of the trade and any active net positions will only take effect once the exits occur and lift one side or the other. So, just trade the exits and save yourself the unnecessary trades and commissions? And yes I'm familiar with the practice of placing locking trades to hold a short term cancel whilst maintaining a longer running trade for a consistent traded record, but IB is looking at it from the perspective of net position, not individual trades. Best wishes, M On Mon, 2 Nov 2020 at 09:59, wickersheim gregory <gwick.web@...> wrote: I would like to make two differents trade for the same futures. -- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |
So, what if I got multiple algo running in parallels for the same security, let say for the forex EUR.USD One algo will open a buy position expecting to sell it after, but then the other algo open an sell position and then close the position that the first algo opened? |
Sadly although that's probably the way you are used to handling your trades, as far as I know IB are just interested in the net position. You have to do your own trade logic to separate what the individual algo's consider to be "their" position. Honestly I found position tracking in IB to be unnecessarily awkward. But perhaps someone on here has got some nice advice for us. I used order references and execution tracking to obtain a "view" though your mileage on this may vary, depending on how tortured your positions are and how patchy the execution reports, logic tying it to the account reported position and any other weirdnesses that crop up are. To keep it fast for development I used distinct accounts for each test - otherwise the "working out what happened" headache was just not worth the effort. Best wishes, M On Mon, 2 Nov 2020 at 10:32, wickersheim gregory <gwick.web@...> wrote:
-- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |
to navigate to use esc to dismiss