示例#1
0
        //35 = D
        public override void onMessage(QuickFix42.NewOrderSingle message, SessionID sessionID)
        {
            Console.WriteLine("Receive message " + message.getHeader().getField(35) + ", session: " + sessionID.toString());
            try
            {
                ClOrdID      clordid = message.getClOrdID();
                string       clord   = clordid.getValue();
                Side         side    = message.getSide();
                char         s       = side.getValue();
                OrdType      ordtype = message.getOrdType();
                char         ord     = ordtype.getValue();
                TransactTime time    = message.getTransactTime();
                DateTime     dt      = time.getValue();

                QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport(new OrderID("neworderid"), new ExecID("Hehe")
                                                                                            , new ExecTransType(ExecTransType.CORRECT), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.DONE_FOR_DAY),
                                                                                            new Symbol("VND"), new Side(Side.BUY), new LeavesQty(1), new CumQty(2), new AvgPx(100));

                bool x = Session.sendToTarget(executionReport, sessionID);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
示例#2
0
        public void DateTimeFieldTest()
        {
            fieldmap.SetField(new DateTimeField(Tags.TransactTime, new DateTime(2009, 12, 10)));
            TransactTime tt = new TransactTime();

            fieldmap.GetField(tt);
            Assert.That(new DateTime(2009, 12, 10), Is.EqualTo(tt.Obj));
            fieldmap.SetField(new TransactTime(new DateTime(2010, 12, 10)));
            fieldmap.GetField(tt);
            Assert.That(new DateTime(2010, 12, 10), Is.EqualTo(tt.getValue()));
        }