public static void PlaceNewSingleOrder()
        {
            QuickFix44.NewOrderSingle order = new QuickFix44.NewOrderSingle();

            #region Order Details

            QuickFix.OrderQty   orderQty = new QuickFix.OrderQty(10); order.setField(orderQty);
            QuickFix.Symbol     symbol   = new QuickFix.Symbol("EGS48031C016"); order.setField(symbol);
            QuickFix.SecurityID secID    = new QuickFix.SecurityID("EGS48031C016"); order.setField(secID);
            QuickFix.Side       side     = new QuickFix.Side(Side.SELL); order.setField(side);
            QuickFix.OrdType    ordType  = new QuickFix.OrdType(OrdType.LIMIT); order.setField(ordType);
            QuickFix.Price      price    = new QuickFix.Price(10); order.setField(price);
            Currency            currency = new Currency("EGP"); order.setField(currency);
            Account             acc      = new Account("1003"); order.setField(acc);
            QuickFix.PartyID    custody  = new PartyID("5004"); order.setField(custody);
            TimeInForce         tif      = new TimeInForce(TimeInForce.DAY); order.setField(tif);
            IDSource            ids      = new IDSource("4"); order.setField(ids);
            TransactTime        tt       = new TransactTime(DateTime.Now); order.setField(tt);
            //SenderSubID ss = new SenderSubID("05095a"); order.setField(ss);
            #endregion Order Details

            #region Fix Order Message IDs

            QuickFix.ClOrdID clOrdID = new ClOrdID(Guid.NewGuid().ToString());
            order.setField(clOrdID);

            #endregion Fix Order Message IDs

            #region Exchange
            ExDestination    exd         = new ExDestination("CA"); order.setField(exd);
            TradingSessionID tradSession = new TradingSessionID("NOPL"); order.setField(tradSession);
            #endregion Exchange

            Session.sendToTarget(order, _app.SessionID);
        }
Ejemplo n.º 2
0
        //[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]
        public static void PlaceNewSingleOrder(string _clOrderID, string _clientID, string _securityCode, int _quantity, double _price, string _custodyCode,
                                               char _orderSide, char _orderType, string currencyCode, string exDestination, char _timeInForce, string groupID,
                                               char handleInst, DateTime expiration, bool hasAON, int minQty)
        {
            QuickFix44.NewOrderSingle order = new QuickFix44.NewOrderSingle();

            #region Order Details

            QuickFix.OrderQty   orderQty = new QuickFix.OrderQty(_quantity); order.setField(orderQty);
            QuickFix.Symbol     symbol   = new QuickFix.Symbol(_securityCode); order.setField(symbol);
            QuickFix.SecurityID secID    = new QuickFix.SecurityID(_securityCode); order.setField(secID);
            QuickFix.Side       side     = new QuickFix.Side(_orderSide); order.setField(side);
            QuickFix.OrdType    ordType  = new QuickFix.OrdType(_orderType); order.setField(ordType);
            QuickFix.Price      price    = new QuickFix.Price(_price); order.setField(price);
            Currency            currency = new Currency(currencyCode); order.setField(currency);
            Account             acc      = new Account(_clientID); order.setField(acc);
            //QuickFix.ClearingFirm custody = new ClearingFirm(_custodyCode);order.setField(custody);
            QuickFix.PartyID custody = new PartyID(_custodyCode); order.setField(custody);
            //QuickFix.PartyRole pr = new PartyRole(PartyRole.CUSTODIAN); order.setField(pr);
            //QuickFix.NoPartyIDs npid = new NoPartyIDs(1); order.setField(npid);
            //QuickFix.PartyIDSource pid = new PartyIDSource(PartyIDSource.PROPRIETARY); order.setField(pid);
            TimeInForce  tif = new TimeInForce(_timeInForce); order.setField(tif);
            IDSource     ids = new IDSource("4"); order.setField(ids);
            TransactTime tt  = new TransactTime(DateTime.Now); order.setField(tt);
            //SenderSubID ss = new SenderSubID("05095a"); order.setField(ss);
            if (_timeInForce == QuickFix.TimeInForce.GOOD_TILL_DATE)
            {
                ExpireDate ed = new ExpireDate(expiration.ToString("yyyyMMdd")); order.setField(ed);
                //ExpireTime et = new ExpireTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour + 4, 0, 0)); order.setField(et);
                ExpireTime et = new ExpireTime(expiration); order.setField(et);
            }
            if (hasAON)
            {
                order.setField(new ExecInst(ExecInst.ALL_OR_NONE.ToString()));
                order.setField(new MinQty(minQty));
            }
            #endregion Order Details

            #region Fix Order Message IDs

            QuickFix.ClOrdID clOrdID = new QuickFix.ClOrdID(string.Format("{0}{1}", _wcfMsgPrefix, _clOrderID));
            order.setField(clOrdID);

            #endregion Fix Order Message IDs

            #region Reporting

            //QuickFix.HandlInst handlInst = new QuickFix.HandlInst(QuickFix.HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION); order.setField(handlInst);
            QuickFix.HandlInst handlInst = new QuickFix.HandlInst(handleInst); order.setField(handlInst);

            #endregion Reporting

            #region Exchange

            ExDestination    exd         = new ExDestination(exDestination); order.setField(exd);
            TradingSessionID tradSession = new TradingSessionID(groupID); order.setField(tradSession);
            #endregion Exchange

            Session.sendToTarget(order, _sessionID);
        }
Ejemplo n.º 3
0
        //private void CreateOrder(QuickFix.Side side)
        //{
        //    if (textBox1.Text != string.Empty && textBox2.Text != string.Empty && textBox3.Text != string.Empty)
        //    {
        //        ClOrdID clordid =new ClOrdID ( DateTime.Now.ToString("yyMMddHHmmss"));//Ψһ��Ͷ����ָ����
        //        QuickFix.HandlInst inst = new QuickFix.HandlInst('1'); //1	=	Automated execution order, private, no Broker intervention
        //        //2	=	Automated execution order, public, Broker intervention OK
        //        //3	=	Manual order, best execution
        //        QuickFix.Account account  =new Account ("0103137186"); //2009  11 25 add  �˺�
        //        QuickFix.Symbol symbol = new QuickFix.Symbol(textBox1.Text);
        //        QuickFix.TransactTime time = new QuickFix.TransactTime();
        //        QuickFix.OrdType ordtype = new QuickFix.OrdType('2');//2	=	Limit
        //        QuickFix42.NewOrderSingle message = new QuickFix42.NewOrderSingle(clordid, inst, symbol, side, time, ordtype);
        //        message.setString(44, textBox3.Text);
        //        message.setString(38,textBox2.Text);
        //        message.setString(207, "SSE");   //207   sh �Ϻ�
        //        message.setString(1, "0002077141");//1  Account �˺�
        //        _quickFixWrapper.Send(message);
        //    }
        //    else
        //    {
        //        MessageBox.Show("ָ���������");
        //    }
        //}
        private void CreateOrder()
        {
            if (textBox1.Text != string.Empty && textBox2.Text != string.Empty && comboBox2.SelectedIndex != -1)
            {
                string id = GetNextID();
                ClOrdID clordid = new ClOrdID(id);//Ψһ��Ͷ����ָ����
                //1	=	Automated execution order, private, no Broker intervention
                //2	=	Automated execution order, public, Broker intervention OK
                //3	=	Manual order, best execution
                QuickFix.HandlInst inst = new QuickFix.HandlInst();
                if (comboBox6.SelectedIndex == -1)
                {
                    inst.setValue('1');
                }
                else
                {
                    switch (comboBox6.SelectedItem.ToString())
                    {
                        case "ֱͨ˽��":
                            inst.setValue('1');
                            break;
                        case "ֱͨ����":
                            inst.setValue('2');
                            break;
                        case "����̨":
                            inst.setValue('3');
                            break;
                    }
                }

                QuickFix.Side side = new QuickFix.Side();
                switch (comboBox2.SelectedItem.ToString())
                {
                    case "����":
                        side.setValue('1');
                        break;
                    case "���":
                        side.setValue('2');
                        break;
                    case "���":
                        side.setValue('5');
                        break;
                    case "�깺":
                        side.setValue('D');
                        break;
                    case "���":
                        side.setValue('E');
                        break;
                }
                //QuickFix.Account account = new Account("0103137186"); //2009  11 25 add  �˺�
                QuickFix.OrdType ordtype = new QuickFix.OrdType();
                if (comboBox3.SelectedIndex == -1)
                {
                    ordtype.setValue('1');
                }
                else
                {
                    switch (comboBox3.SelectedItem.ToString())
                    {
                        case "�м�":
                            ordtype.setValue('1');
                            break;
                        case "�޼�":
                            ordtype.setValue('2');
                            break;
                    }
                }

                QuickFix.Symbol symbol = new QuickFix.Symbol(textBox1.Text);
                QuickFix.TransactTime time = new QuickFix.TransactTime();
                QuickFix42.NewOrderSingle message = new QuickFix42.NewOrderSingle(clordid, inst, symbol, side, time, ordtype);
                if (ordtype.getValue () == QuickFix.OrdType.LIMIT)
                {
                    message.setString(44, textBox3.Text);//Limit Price
                }
                message.setString(38, textBox2.Text);//Quantity
                if (textBox1.Text.StartsWith("60"))
                {
                    message.setString(207, "SSE");   //207   sh �Ϻ�
                }
                else if (textBox1.Text.StartsWith("00"))
                {
                    message.setString(207, "SZSE");   //207   sz ����
                }
                //message.setString(1, "0002077141");//1  Account �˺�
                if (!ordersAll.ContainsKey(id))
                {
                    OrderInfo info = new OrderInfo(message);
                    ordersAll.Add(id, info);
                }
                _quickFixWrapper.Send(message);
            }
            else
            {
                MessageBox.Show("ָ���������");
            }
        }