Exemple #1
0
 public ExecutionReport(
     QuickFix.OrderID aOrderID,
     QuickFix.ExecID aExecID,
     QuickFix.ExecTransType aExecTransType,
     QuickFix.ExecType aExecType,
     QuickFix.OrdStatus aOrdStatus,
     QuickFix.Symbol aSymbol,
     QuickFix.Side aSide,
     QuickFix.OrderQty aOrderQty,
     QuickFix.LastShares aLastShares,
     QuickFix.LastPx aLastPx,
     QuickFix.LeavesQty aLeavesQty,
     QuickFix.CumQty aCumQty,
     QuickFix.AvgPx aAvgPx)
     : base(MsgType())
 {
     set(aOrderID);
     set(aExecID);
     set(aExecTransType);
     set(aExecType);
     set(aOrdStatus);
     set(aSymbol);
     set(aSide);
     set(aOrderQty);
     set(aLastShares);
     set(aLastPx);
     set(aLeavesQty);
     set(aCumQty);
     set(aAvgPx);
 }
Exemple #2
0
 public QuickFix.LeavesQty getLeavesQty()
 { QuickFix.LeavesQty value = new QuickFix.LeavesQty();
   getField(value); return value; }
Exemple #3
0
 public bool isSet(QuickFix.LeavesQty field)
 {
     return(isSetField(field));
 }
Exemple #4
0
 public QuickFix.LeavesQty getLeavesQty()
 {
     QuickFix.LeavesQty value = new QuickFix.LeavesQty();
     getField(value); return(value);
 }
Exemple #5
0
 public QuickFix.LeavesQty get(QuickFix.LeavesQty value)
 {
     getField(value); return(value);
 }
Exemple #6
0
 public void set(QuickFix.LeavesQty value)
 {
     setField(value);
 }
Exemple #7
0
        /// <summary>
        /// Process general purpose exec i.e. some type of order status change
        /// </summary>
        /// <param name="myOrder"></param>
        /// <param name="myExec"></param>
        private void processGeneralExecRep(ref KaiTrade.Interfaces.Order myOrder, QuickFix.Message myExec)
        {
            if (m_ORLog.IsInfoEnabled)
            {
                m_ORLog.Info("processGeneralExecRep:");
            }
            QuickFix.OrdStatus myOrdStatus = new QuickFix.OrdStatus();
            QuickFix.LeavesQty myLeavesQty = new QuickFix.LeavesQty();
            QuickFix.CumQty myCumQty = new QuickFix.CumQty();
            myExec.getField(myOrdStatus);
            myOrder.OrdStatus = myOrdStatus;

            switch (myOrdStatus.getValue())
            {
                case QuickFix.OrdStatus.CANCELED:
                    if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.cancel)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }

                    myLeavesQty = new QuickFix.LeavesQty(0.0);
                    myOrder.LeavesQty = myLeavesQty;
                    break;
                case QuickFix.OrdStatus.NEW:

                    if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    else if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.replace)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    else
                    {
                        m_Log.Error("HandleExecReport:OrderStatus new not expected");
                    }
                    myOrder.LeavesQty  = new QuickFix.LeavesQty(myOrder.OrderQty.getValue());
                    myOrder.CumQty = new QuickFix.CumQty(0.0);
                    break;
                case QuickFix.OrdStatus.REPLACED:
                    if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.replace)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    if (myExec.isSetField(myLeavesQty))
                    {
                        myExec.getField(myLeavesQty);
                        myOrder.LeavesQty = myLeavesQty;
                    }
                    if (myExec.isSetField(myCumQty))
                    {
                        myExec.getField(myCumQty);
                        myOrder.CumQty = myCumQty;
                    }

                    break;
                case QuickFix.OrdStatus.PENDING_REPLACE:
                    if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.replace)
                    {
                        m_ORLog.Error("Pending replace received but last command is not replace");
                    }

                    break;
                case QuickFix.OrdStatus.REJECTED:
                    if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.cancel)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    else if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    else if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.replace)
                    {
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    }
                    break;
                default:
                    break;
            }
        }
Exemple #8
0
        /// <summary>
        /// Process partial or fully filled
        /// </summary>
        /// <param name="myOrder"></param>
        /// <param name="myExec"></param>
        private void processFill(ref KaiTrade.Interfaces.Order myOrder, QuickFix.Message myExec)
        {
            K2ServiceInterface.ITransaction myTrn = null;
            try
            {
                // if the object supports transactions do the update as a trn
                myTrn = myOrder as K2ServiceInterface.ITransaction;
                if (myTrn != null)
                {
                    myTrn.StartUpdate();
                }
                // Get the currently executed quantity for chain of orders.
                QuickFix.CumQty myCumQty = new QuickFix.CumQty();
                myExec.getField(myCumQty);
                myOrder.CumQty = myCumQty;

                // Get quantity open for further execution (order qty - cum qty)
                QuickFix.LeavesQty myLeavesQty = new QuickFix.LeavesQty();
                myExec.getField(myLeavesQty);
                myOrder.LeavesQty = myLeavesQty;

                QuickFix.LastPx myLastPx = new QuickFix.LastPx();
                if (myExec.isSetField(myLastPx))
                {
                    myExec.getField(myLastPx);
                    myOrder.LastPx = myLastPx;
                }

                QuickFix.AvgPx myAvgPx = new QuickFix.AvgPx();
                if (myExec.isSetField(myAvgPx))
                {
                    myExec.getField(myAvgPx);
                    myOrder.AvgPx = myAvgPx;
                }

                QuickFix.LastQty myLastQty = new QuickFix.LastQty();
                if (myExec.isSetField(myLastQty))
                {
                    myExec.getField(myLastQty);
                    myOrder.LastQty = myLastQty;
                }

                QuickFix.OrdStatus myOrdStatus = new QuickFix.OrdStatus();
                myExec.getField(myOrdStatus);
                myOrder.OrdStatus = myOrdStatus;
                // always signal the end of the update
                if (myTrn != null)
                {
                    myTrn.EndUpdate();
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("processFill", myE);
                // always signal the end of the update
                if (myTrn != null)
                {
                    myTrn.EndUpdate();
                }
            }
        }