[ts-gen] Blowup in Paper Account due to failed reception of OrderStatus 3/3/6 Filled

Ken Feng kfmfe04 at gmail.com
Thu Sep 24 08:26:52 EDT 2009

Here is a small update to what I found out so far in the MySQL tables.

1. OrderReport and OrderStatus were wrong in a consistent way - they  
both think the last fill was at 12:30:55 and this concurs with the  
shim log, suggesting that IB did not send some kind of Fill response  

2. OrderResult, which gets posted every five minutes, due to my  
crontab logging into shim to do a mark-to-market, gets the correct  
overall position, which is nice for a sanity-check, but doesn't the  
requisite fill information (eg avg_cost), due to the fact that this  
information is the aggregated position anyways, and not information on  
the granularity of a trade or an order.

Unfortunately, these kinds of results are hard/nearly impossible to  
reproduce, I think, until they crop up again.
I am looking for alternative solutions for Trade/Order Fill detection.

- Ken

On Sep 24, 2009, at 8:49 PM, Ken Feng wrote:

> Hi,
> For those of you who haven't read my previous posts, like usual, let  
> me start by saying that I am not blaming anyone;  I am just looking  
> for a technical/robust solution to my problems.  I am quite happy  
> with the performance and reliability of shim so far.
> Today, while paper trading, my shim --risk failed to detect  
> responses in OrderStatus through a 3/3/6 after 15:00.  This caused a  
> cascade of problems as my system continued to submit orders thinking  
> that nothing was filled, when indeed, there were fills, according to  
> TWS.
> At first I thought it was a problem with my Ruby code so I looked at  
> the OrderStatus table.  However, OrderStatus did not detect any  
> fills after 12:30:55, either.  My third check in the .log file for  
> 3/3/6 confirmed that "Filled" was received by the shim.  So I  
> conclude that the IB server did not send me a proper 3/3/6 Filled,  
> for whatever reason.  In other words, I can't seem to rely on 3/3/6  
> or the OrderStatus table to detect my fills.
> Up until today, I have had sporadic problems detecting fills via  
> 3/3/6 Filled.  Today was the first big problem as I was away for a  
> while.
> What I have found to be reliable so far, is a check is 3/6/2  
> CashBalance which I get "for free" when I log in via shim --data  
> every five minutes to get a mark-to-market.  Unfortunately, this  
> shows the breakdown of assets (eg xxx AUD yyy JPY, etc...) and not a  
> breakdown of positions (eg aaa AUDJPY).
> However, I have noticed that clicking on the "ACCOUNT" button on TWS  
> does show the correct positions in the FX Portfolio section (eg aaa  
> QUESTION:  Does anyone know the command to submit to the shim to get  
> the same information that is on this screen?
> I am thinking of ways to safeguard against problems before  
> submitting orders.
> I take this as a very good and worthwhile experience in paper  
> trading; it is much better and safer to delay the sending of orders  
> (err on the safe side) than to submit orders based on wrong fill  
> information.
> - Ken

More information about the ts-general mailing list