Пример #1
0
 public TradeQue(TradeQue arg0) : this(ContextModulePINVOKE.new_TradeQue__SWIG_3(TradeQue.getCPtr(arg0)), true)
 {
     if (ContextModulePINVOKE.SWIGPendingException.Pending)
     {
         throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #2
0
 public void swap(TradeQue x)
 {
     ContextModulePINVOKE.TradeQue_swap(swigCPtr, TradeQue.getCPtr(x));
     if (ContextModulePINVOKE.SWIGPendingException.Pending)
     {
         throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #3
0
 public void setslice(int i, int j, TradeQue v)
 {
     ContextModulePINVOKE.TradeQue_setslice(swigCPtr, i, j, TradeQue.getCPtr(v));
     if (ContextModulePINVOKE.SWIGPendingException.Pending)
     {
         throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #4
0
    public TradeQue getTradeQue(long clOrderId)
    {
        IntPtr   cPtr = ContextModulePINVOKE.TradeBook_getTradeQue(swigCPtr, clOrderId);
        TradeQue ret  = (cPtr == IntPtr.Zero) ? null : new TradeQue(cPtr, false);

        if (ContextModulePINVOKE.SWIGPendingException.Pending)
        {
            throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #5
0
 internal static HandleRef getCPtr(TradeQue obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Пример #6
0
    public TradeQue getslice(int i, int j)
    {
        TradeQue ret = new TradeQue(ContextModulePINVOKE.TradeQue_getslice(swigCPtr, i, j), true);

        return(ret);
    }
Пример #7
0
        public override void onExecutionReport(ExecutionReport report)
        {
            logInfo("onExecutionReport:-------------------->");
            //		report.dump();
            try{
                logInfo("Status:" + report.getOrderStatus().ToString());
                logInfo("Instrument Name: " + report.getInstrumentName());


                printOrder(
                    Portfolio.getInstance().getOrderBook().getOrder(
                        report.getClOrderId()
                        )
                    );
            }
            catch (Exception e)
            {
                logInfo(e.Message);
            }
            logInfo("Status:" + report.getOrderStatus().ToString());
            logInfo("Instrument Name: " + report.getInstrumentName());


            if (report.getInstrumentName() == (sd.firstLegSymbol))
            {
                logInfo("Here1");
                if (report.getOrderStatus() == (OrderStatus.OrderStatus_CONFIRMED))
                {
                    logInfo("Here2");
                    sd.firstLegOrder.setClOrdId(report.getClOrderId());
                    sd.firstLegOrder.setOrigClOrdId(report.getOriginalClOrderId());
                    sd.firstLegOrder.setOrderStatus(OrderStatus.OrderStatus_CONFIRMED);
                    sd.isOrderPending = false;
                }
                else if (report.getOrderStatus() == (OrderStatus.OrderStatus_REPLACED))
                {
                    sd.firstLegOrder.setClOrdId(report.getClOrderId());
                    sd.firstLegOrder.setOrigClOrdId(report.getOriginalClOrderId());
                    sd.firstLegOrder.setOrderStatus(OrderStatus.OrderStatus_CONFIRMED);
                    sd.isOrderPending = false;
                }
                else if (report.getOrderStatus() == (OrderStatus.OrderStatus_FILLED))
                {
                    try
                    {
                        TradeQue trades
                            = Portfolio.getInstance().getTradeBook().getTradeQue(report.getClOrderId());
                        logInfo("**************** Dumping Trades ***************** .\n");
                        long size = trades.size();
                        logInfo("size = ", size);
                        for (int i = 0; i < size; ++i)
                        {
                            printTrade(trades.getitem(i));
                        }
                    }
                    catch (Exception e)
                    {
                        logInfo(e.Message.ToString());
                    }
                    //				Side side;
                    //				if(report.getOrderMode().)
                    //
                    //
                    placeSecondLegMarket();
                    sd.isOrderPending = true;
                    //				Position pos =Portfolio.getInstance().getNetPositions().getPosition(
                    //						Context.getInstance().getInstrument(report.getInstrumentName()),
                    //						report.getOrderMode());
                    //				printPosition(pos);
                    printPortfolio(report.getInstrumentName(), report.getOrderMode());

                    //				List trades = new ArrayList<Trade>();
                    //				trades =ArrayList<Trade>Portfolio.getInstance().getTradeBook().getTrades(
                    //						report.getClOrderId()
                    //						);
                    //				printTrade((Trade)trades.get(trades.size()-1));
                }
            }
            else if (report.getInstrumentName() == (sd.secondLegSymbol))
            {
                if (report.getOrderStatus() == (OrderStatus.OrderStatus_CONFIRMED))
                {
                    sd.secondLegOrder.setClOrdId(report.getClOrderId());
                    sd.secondLegOrder.setOrigClOrdId(report.getOriginalClOrderId());
                    sd.isOrderPending = false;
                }
                else if (report.getOrderStatus() == (OrderStatus.OrderStatus_FILLED))
                {
                    logInfo("Strategy completed successfully.\n");
                    printPortfolio();
                    logInfo("Calling Logout.\n");
                    Context.getInstance().logout();
                }
            }
        }
Пример #8
0
 public TradeQue(TradeQue arg0)
     : this(ContextModulePINVOKE.new_TradeQue__SWIG_3(TradeQue.getCPtr(arg0)), true)
 {
     if (ContextModulePINVOKE.SWIGPendingException.Pending) throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
 }
Пример #9
0
 internal static HandleRef getCPtr(TradeQue obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Пример #10
0
 public void swap(TradeQue x)
 {
     ContextModulePINVOKE.TradeQue_swap(swigCPtr, TradeQue.getCPtr(x));
     if (ContextModulePINVOKE.SWIGPendingException.Pending) throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
 }
Пример #11
0
 public void setslice(int i, int j, TradeQue v)
 {
     ContextModulePINVOKE.TradeQue_setslice(swigCPtr, i, j, TradeQue.getCPtr(v));
     if (ContextModulePINVOKE.SWIGPendingException.Pending) throw ContextModulePINVOKE.SWIGPendingException.Retrieve();
 }
Пример #12
0
 public TradeQue getslice(int i, int j)
 {
     TradeQue ret = new TradeQue(ContextModulePINVOKE.TradeQue_getslice(swigCPtr, i, j), true);
     return ret;
 }