Package com.activequant.tools.streaming

Examples of com.activequant.tools.streaming.BBOEvent


        if(valueMap.getB().containsKey("ASK"))ask = valueMap.getB().get("ASK");
        if(valueMap.getB().containsKey("BIDQUANTITY"))bidQ = valueMap.getB().get("BIDQUANTITY");
        if(valueMap.getB().containsKey("ASKQUANTITY"))askQ= valueMap.getB().get("ASKQUANTITY");
       
       
        return new BBOEvent(this.mdId, this.mdId, valueMap.getA(), bid, bidQ, ask, askQ);

    }
View Full Code Here


  @Override
  public MarketDataEvent next() {
    currentTime = currentTime + step;

    BBOEvent bbo = new BBOEvent(mdId, tradId, new TimeStamp(currentTime),
        Math.random(), Math.random(), Math.random(), Math.random());
    //
    return bbo;
  }
View Full Code Here

    public void processStreamEvent(StreamEvent streamEvent) {
        if (streamEvent instanceof TimeStreamEvent) {
            currentExchangeTime = ((TimeStreamEvent) streamEvent).getTimeStamp();
        }
        if (streamEvent instanceof BBOEvent) {
            BBOEvent nbbo = (BBOEvent) streamEvent;
            String instId = nbbo.getTradeableInstrumentId();
            // weed out non-tradeable market data.
            if (instId == null)
                return;

            LimitOrderBook lob = getOrderBook(instId);

            // clear out limit order book except our own orders.
            lob.weedOutForeignOrders();

            if (nbbo.getBid() != null) {

                LimitOrder bestBid = new LimitOrder();
                bestBid.setOrderSide(OrderSide.BUY);
                bestBid.setLimitPrice(nbbo.getBid());
                bestBid.setQuantity(nbbo.getBidQuantity());
                bestBid.setOpenQuantity(bestBid.getQuantity());
                lob.addOrder(bestBid);
            }

            if (nbbo.getAsk() != null) {
                LimitOrder bestAsk = new LimitOrder();
                bestAsk.setOrderSide(OrderSide.SELL);
                bestAsk.setLimitPrice(nbbo.getAsk());
                bestAsk.setQuantity(nbbo.getAskQuantity());
                bestAsk.setOpenQuantity(bestAsk.getQuantity());
                lob.addOrder(bestAsk);

            }
            // rerun a match.
View Full Code Here

TOP

Related Classes of com.activequant.tools.streaming.BBOEvent

Copyright © 2018 www.massapicom. 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.