rterp / SumZeroTrading

A Java API for Developing Automated Trading Applications for the Equity, Futures, and Currency Markets
http://rterp.github.io/SumZeroTrading/
Other
145 stars 47 forks source link

IB RealTime Bar Builder stops working after an order is placed #44

Closed rterp closed 7 years ago

rterp commented 7 years ago

After an order is placed for a ticker the real-time bar builder will return the same OHLC data from the time the order is placed. It appears the Level1QuoteListener stops receiving events for that Ticker after an order for that Ticker is executed.

rterp commented 7 years ago

Ok, this issue has been fixed. The problem is that the Ticker object contains a NumberFormat, and was using this object in its equals() and hashcode() methods. When an order is placed, the order is serialized to a file for persistence. Apparently the process of serializing the NumberFormat changes its hashcode, thus changing the hashcode of the Ticker. I've removed the NumberFormat from the calculation of the Ticker object and it seems to be working now.