Hi Frank. It would be trivial to add a couple of methods to Trader.java and TraderAsssitant.java to allow the limit/stop/trail orders to be submitted. However, it would be much more complicated to properly manage these orders in JBT. Since there is no guarantee of execution of limit/stop/trail orders, you'd need to be able to cancel these orders when the market moves in a particular direction. The ability to cancel these orders would also need to propagate to backtester and optimizer.
The limit/stop/trail orders are useful to manual traders who are not able to monitor multiple markets and open positions during the day. But JBT is an automated platform, which gets a constant price feed for all the instruments traded, and can react almost instantaneously to changing market conditions. For example, if you want to place a "buy limit at 100.25" order, you can write your strategy to wait until the market is "100.00 bid, 100.25 offer", and place a market order when it happens. No code changes are needed in the platform. This is not exactly the same as placing a limit order, but for the liquid securities with tight bid/ask spreads, the difference would probably be unnoticeable. In both cases, you are likely to be filled at 100.25. The same goes for the stop and trail orders: they can be easily substituted with the market orders placed at the right time. On Thu, Aug 14, 2014 at 1:19 AM, Frank <[email protected]> wrote: > Hi Eugene, > > I am thinking how to modify current code to add new order types like stop, > trailing stop which IB Java API supports. My understanding on the > modification is to change three files TraderAsssitant.java, > PositionManager.java and Strategy.java by adding new methods(similar to > placeMarketOrder but setup orderType = "TRAIL" for trailing stop) to > implement new order functionality. Do you think this is the correct way to > add new order type and is going to work? > > Another question, the current API version is 9.71, can I simply replace > the legacy api jar file in LIB fold with the newest version? > > Thanks in advance and appreciate your support. > > Frank > > > -- > You received this message because you are subscribed to the Google Groups > "JBookTrader" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/jbooktrader. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/jbooktrader. For more options, visit https://groups.google.com/d/optout.
