Package com.activequant.trading.virtual

Source Code of com.activequant.trading.virtual.TradingSystemSample

package com.activequant.trading.virtual;

import com.activequant.domainmodel.trade.order.LimitOrder;
import com.activequant.exceptions.IncompleteOrderInstructions;
import com.activequant.exceptions.UnsupportedOrderType;
import com.activequant.tools.streaming.StreamEvent;
import com.activequant.trading.IOrderTracker;

public class TradingSystemSample {

  private IExchange exchange;
  public TradingSystemSample(IExchange exchange){
    this.exchange = exchange;
  }
 
  public void handle(StreamEvent streamEvent){
    if(Math.random()<0.05)
    {
      try {
        IOrderTracker orderTracker = exchange.prepareOrder(new LimitOrder());
        orderTracker.submit();
      } catch (UnsupportedOrderType e) {
        e.printStackTrace();
      } catch (IncompleteOrderInstructions e) {
        e.printStackTrace();
      }
    }
  }
 
}
TOP

Related Classes of com.activequant.trading.virtual.TradingSystemSample

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.