Forums › Trading System Mentor Course Community › Running Your Trading Business › BatchTrader – TWS problem!
- This topic is empty.
-
AuthorPosts
-
October 14, 2016 at 9:16 pm #101562AnonymousInactive
Had an issue yesterday with BatchTrader issuing bogus trades over the asx. Luckily I picked it up and cancelled the sell orders just in time.
Sent an email to Levente and he has told me its a problem with TWS order numbers that are issued. Somehow the order numbers were mixed up and hence bogus trades were made.
Had a more serious issue overnight with the us markets with Batchtrader shorting 295K of bogus trades. hit with a margin call… :sick: :sick: :sick:
October 14, 2016 at 11:52 pm #105528ScottMcNabParticipantAre you using the new version of Batchtrader for both asx and US Darryl ? It may be worth using the older version for US markets while you are asleep and keep using newer version on ASX so can continue to check it until confident all has been resolved.
October 15, 2016 at 12:02 am #105530AnonymousInactiveScott McNab wrote:Are you using the new version of Batchtrader for both asx and US Darryl ? It may be worth using the older version for US markets while you are asleep and keep using newer version on ASX so can continue to check it until confident all has been resolved.hi scott. i dont think older versions will fix my problem but its a good idea and probably worth doing in the short term. it seems that my setup of TWS is creating a confusion over order ID’s. hence sometimes the order ID’s that batchtrader has allocated are still valid order IDs for different orders. how the hell it ended shorting 295K (USD) worth is real mind f#$%k and i was a little shocked to say the least as i stared at the screen in disbelief… only to be rudely snapped back to reality by the buzz of a new email on my phone informing of a margin call.
i will reset my setup of TWS and go back to standard installation and in the mean time Levente has identified the problem and working on a fix.
October 15, 2016 at 1:01 am #105531JulianCohenParticipantThis is all with MOC systems? So far I haven’t had a problem with mine (tempting fate I know)
October 15, 2016 at 1:22 am #105534Nick RadgeKeymasterI’ve not had an issue either.
Some guy once said to me that the more complex you make things, the more can go wrong…
October 15, 2016 at 1:43 am #105535AnonymousInactiveJulian Cohen wrote:This is all with MOC systems? So far I haven’t had a problem with mine (tempting fate I know)yep both moc systems.
October 15, 2016 at 1:49 am #105536AnonymousInactiveNick Radge wrote:I’ve not had an issue either.Some guy once said to me that the more complex you make things, the more can go wrong…
… sometimes you have to learn these lessons the hard way :side:
October 15, 2016 at 2:00 am #105537AnonymousInactiveany idea how long before IB start liquidating positions if margin is not covered?
October 15, 2016 at 3:56 pm #105538SaidBitarMembermaybe this will help in giving idea how the API and TWS communicate and work.
1- TWS will send to the API the first available order ID
2- API will start assigning the Order IDs to the orders that you import from csv file (the order Ids are incremental ++)
3- after the orders are send from the API to TWS, TWS will start sending messages to the API with the status of each order
4- each status message has the order ID in it.
5- (what i am expecting Levente is doing) when he receive the feedback message of filled he is creating another order with the same parameters (STK code , amount, ..) but sell instead of Buy and sending it to TWS.
for some reason instead of creating sell order for the stock that you were filled on it made sell orders for all the orders in the csv file that you initially imported.October 15, 2016 at 10:53 pm #105539Nick RadgeKeymasterQuote:any idea how long before IB start liquidating positions if margin is not covered?Should be in the closing minutes.
October 16, 2016 at 2:26 pm #105543AnonymousInactivereply from levente regarding the problem:
Quote:My investigation concluded that the misbehavior in TWS was caused by the fact that both BatchTrader instances were configure by the same client ID. This is why executions created by one instance flowed into the second one.This was also a quite unfortunate scenario, because normally if one instance is running and you try to start up a second instance with the same client ID, TWS will complain saying that another client with the same client ID is already connected. However, in your case you used BatchTrader instance 1 for ASX, then stopped it, then started the second instance for the US trading. Since the two instances were running at different times, TWS was not able to detect that the same client ID is in use.
October 16, 2016 at 2:34 pm #105540AnonymousInactivehi said. yes your right
but
the order number mix up is very interesting. it does not issue sell order for everything in the csv file. it depends weather the order ID has been used before somewhere. it gives very strange behaviour based on old values stored in the previous used order ID.
in the asx i had a batchtrader issue a sell order for ~$60 when the actual price was around ~$2. this was not a problem in the asx because the order was never filled and subsequently cancelled. but in the us its very dangerous due to MOC orders being issued instead of sell limit.anyway… levente seems to have fixed the problem and issued a new version. lets see how we can break this one
October 16, 2016 at 9:40 pm #105545JulianCohenParticipantDarryl Vink wrote:hi said. yes your right
but
the order number mix up is very interesting. it does not issue sell order for everything in the csv file. it depends weather the order ID has been used before somewhere. it gives very strange behaviour based on old values stored in the previous used order ID.
in the asx i had a batchtrader issue a sell order for ~$60 when the actual price was around ~$2. this was not a problem in the asx because the order was never filled and subsequently cancelled. but in the us its very dangerous due to MOC orders being issued instead of sell limit.anyway… levente seems to have fixed the problem and issued a new version. lets see how we can break this one
I use my Batchtrader in much the same way. I have instance 1 and 2 (1 is for placing normal orders and closing if too many are activated and 2 is MOC). I run them both on the ASX under the one IB account number. Then I close them down, and reopen them to run them both on the US markets a few hours later.
Is that effectively what you are doing Darryl?
October 17, 2016 at 6:39 am #105546AnonymousInactiveJulian Cohen wrote:Darryl Vink wrote:hi said. yes your right
but
the order number mix up is very interesting. it does not issue sell order for everything in the csv file. it depends weather the order ID has been used before somewhere. it gives very strange behaviour based on old values stored in the previous used order ID.
in the asx i had a batchtrader issue a sell order for ~$60 when the actual price was around ~$2. this was not a problem in the asx because the order was never filled and subsequently cancelled. but in the us its very dangerous due to MOC orders being issued instead of sell limit.anyway… levente seems to have fixed the problem and issued a new version. lets see how we can break this one
I use my Batchtrader in much the same way. I have instance 1 and 2 (1 is for placing normal orders and closing if too many are activated and 2 is MOC). I run them both on the ASX under the one IB account number. Then I close them down, and reopen them to run them both on the US markets a few hours later.
Is that effectively what you are doing Darryl?
its not what i was doing when the problem developed. i was using the same id number for both asx and us. big mistake :dry: i did initially use different id numbers with the original versions of batchtrader but somewhere in the process of upgrades i became complacent.
it is what i have put in place now though. just need to make sure that batchtrader uses a different id number for trading us and asx. also i will make sure the different instances are not running at the same time
October 17, 2016 at 6:53 am #105547JulianCohenParticipantDarryl Vink wrote:Julian Cohen wrote:Darryl Vink wrote:hi said. yes your right
but
the order number mix up is very interesting. it does not issue sell order for everything in the csv file. it depends weather the order ID has been used before somewhere. it gives very strange behaviour based on old values stored in the previous used order ID.
in the asx i had a batchtrader issue a sell order for ~$60 when the actual price was around ~$2. this was not a problem in the asx because the order was never filled and subsequently cancelled. but in the us its very dangerous due to MOC orders being issued instead of sell limit.anyway… levente seems to have fixed the problem and issued a new version. lets see how we can break this one
I use my Batchtrader in much the same way. I have instance 1 and 2 (1 is for placing normal orders and closing if too many are activated and 2 is MOC). I run them both on the ASX under the one IB account number. Then I close them down, and reopen them to run them both on the US markets a few hours later.
Is that effectively what you are doing Darryl?
its not what i was doing when the problem developed. i was using the same id number for both asx and us. big mistake :dry: i did initially use different id numbers with the original versions of batchtrader but somewhere in the process of upgrades i became complacent.
it is what i have put in place now though. just need to make sure that batchtrader uses a different id number for trading us and asx. also i will make sure the different instances are not running at the same time
When you say ID number do you mean the Order reference number? The one you can change in the settings file to differentiate between two Batchtraders running at the same time with different systems?
-
AuthorPosts
- You must be logged in to reply to this topic.