Example #1
0
  public static void main(String[] args) {
    Trader trader = new IBTrader("localhost:4000", 22);

    Configurable.configure("jtrade.trader.IBTrader#ACCOUNT_CODE", "DU66791");

    try {
      // Symbol s = SymbolFactory.getESFutureSymbol(new DateTime());
      Symbol s = SymbolFactory.getSymbol("AAPL-SMART-USD-STOCK");

      trader.connect();
      Thread.sleep(2000);

      try {
        trader.placeOrder(s, 1, "testref1");
      } catch (Exception e) {
        e.printStackTrace();
      }
      Thread.sleep(2000);

      try {
        trader.placeOrder(s, -1, "testref2");
      } catch (Exception e) {
        e.printStackTrace();
      }
      Thread.sleep(2000);

      trader.cancelOrder(s, null);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      trader.disconnect();
    }
  }
Example #2
0
 public Offer pickOffer(Offer[] aoffCurrentOffers) {
   // we look through the current offers, picking one that looks best now.
   info.recordOffers(aoffCurrentOffers);
   return trader.pickOffer();
 }
Example #3
0
 public void offer(Offer offTemp) {
   // trader modifies offTemp
   trader.setOffer(offTemp);
 }