コード例 #1
0
ファイル: Handler.cs プロジェクト: kdupigny/GlobalAuditTrail
        public QuickFix42.NewOrderSingle sendKnightMarketOrder(string OrderID, string route, string symbol)
        {
            //int id = rand.Next(100000000, 200000000);
            //limitID = "t" + id.ToString();


            QuickFix42.NewOrderSingle msg2 = new QuickFix42.NewOrderSingle(new ClOrdID(OrderID), new HandlInst('1'), new Symbol(symbol), new Side(Side.BUY), new TransactTime(DateTime.UtcNow), new OrdType(OrdType.MARKET));
            //Additional required Fields
            msg2.set(new OrderQty(100));
            msg2.set(new Account("1234"));
            msg2.set(new TimeInForce(TimeInForce.DAY));

            //RMG Routing

            msg2.setField(57, route);

            if (route.Contains("ALGO"))
            {
                msg2.setField(9102, "T");
            }
            else
            {
                msg2.setField(9102, "X");
            }
            //msg2.setField(6210, "0");

            //Session.sendToTarget(msg2, oKnightSessionID);

            return(msg2);
        }
コード例 #2
0
        public QuickFix42.NewOrderSingle SendKnightMarketOrder(string orderId, string route, string symbol)
        {
            QuickFix42.NewOrderSingle msg2 = new QuickFix42.NewOrderSingle(new ClOrdID(orderId), new HandlInst('1'), new Symbol(symbol), new Side(Side.BUY), new TransactTime(DateTime.UtcNow), new OrdType(OrdType.MARKET));
            //Additional required Fields
            msg2.set(new OrderQty(100));
            msg2.set(new Account("1234"));
            msg2.set(new TimeInForce(TimeInForce.DAY));

            msg2.setField(57, route);
            msg2.setField(9102, route.Contains("ALGO") ? "T" : "X");

            return(msg2);
        }
コード例 #3
0
        public QuickFix42.NewOrderSingle SendKnightMarketOrder(string orderId)
        {
            QuickFix42.NewOrderSingle msg2 = new QuickFix42.NewOrderSingle(new ClOrdID(orderId), new HandlInst('1'), new Symbol("BAC"), new Side(Side.BUY), new TransactTime(DateTime.UtcNow), new OrdType(OrdType.MARKET));
            //Additional required Fields
            msg2.set(new OrderQty(100));
            msg2.set(new Account("1234"));
            msg2.set(new TimeInForce(TimeInForce.DAY));

            //RMG Routing
            msg2.setField(57, "ALGO1");
            msg2.setField(9102, "T");

            Handler.Add(msg2);
            return(msg2);
        }
コード例 #4
0
        public QuickFix42.NewOrderSingle SendMarketOrder(string clOrdId, string symbol, int qty, string side, string route, string clientid, string channel = "X")
        {
            Side       sd           = new Side(Side.BUY);
            LocateReqd lReqd        = new LocateReqd(true);
            bool       isLocateReqd = false;

            if (side.Equals("B") || side.Equals("b") || side.Equals("buy") || side.Equals("BUY"))
            {
                sd = new Side(Side.BUY);
            }
            else if (side.Equals("S") || side.Equals("s") || side.Equals("sell") || side.Equals("SELL"))
            {
                sd = new Side(Side.SELL);
            }
            else if (side.Equals("SS") || side.Equals("ss") || side.Equals("ssell") || side.Equals("SSELL") || side.Equals("SHORT") || side.Equals("short"))
            {
                sd           = new Side(Side.SELL_SHORT);
                isLocateReqd = true;
            }

            QuickFix42.NewOrderSingle msg = new QuickFix42.NewOrderSingle(new ClOrdID(clOrdId), new HandlInst('1'), new Symbol(symbol), sd, new TransactTime(DateTime.UtcNow), new OrdType(OrdType.MARKET));

            if (isLocateReqd)
            {
                msg.set(lReqd);
            }

            msg.set(new OrderQty(qty));
            msg.set(new Account("54321"));
            msg.set(new TimeInForce(TimeInForce.DAY));

            msg.setField(57, route);
            // msg.setField(50, route);
            msg.setField(9102, channel);

            if (route.Equals("JPMVWAP") || route.Equals("RAVAT") || route.Equals("TWAPJP") || route.Equals("MISMTW") || route.Equals("SGMISMTW"))
            {
                msg.setField(6203, DateTime.UtcNow.ToString());
                msg.setField(6205, DateTime.UtcNow.Add(new TimeSpan(0, 5, 0)).ToString());
            }

            Handler.Add(msg);
            return(msg);
        }
コード例 #5
0
        public QuickFix42.NewOrderSingle SendKnightLimitOrder(string orderId, ref string limitId, double price)
        {
            limitId = orderId;

            QuickFix42.NewOrderSingle msg2 = new QuickFix42.NewOrderSingle(new ClOrdID(orderId), new HandlInst('1'), new Symbol("BAC"), new Side(Side.BUY), new TransactTime(DateTime.UtcNow), new OrdType(OrdType.LIMIT));
            //additional required fields
            msg2.set(new OrderQty(100));
            msg2.set(new Account("1234"));
            msg2.set(new TimeInForce(TimeInForce.DAY));
            Price p = new Price(price);

            msg2.set(p);

            //For RMG Routing
            msg2.setField(57, "ALGO1");
            msg2.setField(9102, "T");

            //Session.sendToTarget(msg2, oKnightSessionID);

            return(msg2);
        }
コード例 #6
0
        public QuickFix42.NewOrderSingle SendLimitOrder(string clOrdId, string symbol, int qty, string side, double price, string route = "NEFAN", string channel = "X")
        {
            Side       sd           = new Side(Side.BUY);
            LocateReqd lReqd        = new LocateReqd(true);
            bool       isLocateReqd = false;

            if (side.Equals("B") || side.Equals("b") || side.Equals("buy") || side.Equals("BUY"))
            {
                sd = new Side(Side.BUY);
            }
            else if (side.Equals("S") || side.Equals("s") || side.Equals("sell") || side.Equals("SELL"))
            {
                sd = new Side(Side.SELL);
            }
            else if (side.Equals("SS") || side.Equals("ss") || side.Equals("ssell") || side.Equals("SSELL") || side.Equals("SHORT") || side.Equals("short"))
            {
                sd           = new Side(Side.SELL_SHORT);
                isLocateReqd = true;
            }

            QuickFix42.NewOrderSingle msg2 = new QuickFix42.NewOrderSingle(new ClOrdID(clOrdId), new HandlInst('1'), new Symbol(symbol), sd, new TransactTime(DateTime.UtcNow), new OrdType(OrdType.LIMIT));
            //additional required fields
            if (isLocateReqd)
            {
                msg2.set(lReqd);
            }

            msg2.set(new OrderQty(qty));
            msg2.set(new Account("12345"));
            msg2.set(new TimeInForce(TimeInForce.DAY));

            msg2.set(new Price(price));

            //For RMG Routing
            msg2.setField(57, route);
            msg2.setField(9102, channel);

            Handler.Add(msg2);
            return(msg2);
        }
コード例 #7
0
        public override void Send(FIXNewOrderSingle Order)
        {
            QuickFix42.NewOrderSingle order = new QuickFix42.NewOrderSingle(
                new QuickFix.ClOrdID(Order.ClOrdID),
                //new QuickFix.HandlInst(Order.HandlInst),
                new QuickFix.HandlInst(HandlInst.AUTOEXECPRIV), // GS FIX
                new QuickFix.Symbol(Order.Symbol.Substring(0, 6)),
                new QuickFix.Side(Order.Side),
                new QuickFix.TransactTime(Order.TransactTime),
                new QuickFix.OrdType(Order.OrdType));

            if ((Order.OrdType == FIXOrdType.Limit || Order.OrdType == FIXOrdType.StopLimit) && Order.ContainsField(EFIXField.Price))
            {
                order.set(new QuickFix.Price(Order.Price));
            }

            if ((Order.OrdType == FIXOrdType.Stop || Order.OrdType == FIXOrdType.StopLimit) && Order.ContainsField(EFIXField.StopPx))
            {
                order.set(new QuickFix.StopPx(Order.StopPx));
            }

            // 自己计算交易所
            if (Order.Symbol.StartsWith("60") || Order.Symbol.StartsWith("51"))
            {
                //order.set(new QuickFix.SecurityExchange("XSHG"));// 上海
                order.set(new QuickFix.SecurityExchange("SS"));// 上海
            }
            else if (Order.Symbol.StartsWith("00") || Order.Symbol.StartsWith("30") || Order.Symbol.StartsWith("15"))
            {
                //order.set(new QuickFix.SecurityExchange("XSHE"));// 深圳
                order.set(new QuickFix.SecurityExchange("SZ"));// 深圳
            }

            if (Order.Text.StartsWith(OpenPrefix))
            {
                order.setField(new QuickFix.CashMargin(CashMargin.MARGIN_OPEN));
            }
            else if (Order.Text.StartsWith(ClosePrefix))
            {
                order.setField(new QuickFix.CashMargin(CashMargin.MARGIN_CLOSE));
            }

            //order.set(new QuickFix.SecurityType(Order.SecurityType));
            order.set(new QuickFix.OrderQty(Order.OrderQty));
            //order.set(new QuickFix.Account(Order.Account));
            //order.set(new QuickFix.Rule80A(Order.Rule80A));
            //order.set(new QuickFix.CustomerOrFirm(Order.CustomerOrFirm));

            //if (Order.ContainsField(EFIXField.ClearingAccount))
            //    order.set(new QuickFix.ClearingAccount(Order.ClearingAccount));

            order.set(new QuickFix.Currency("CNY")); // GS FIX

            Session.sendToTarget(order, orderSessionID);
        }
コード例 #8
0
ファイル: TTMessages.cs プロジェクト: jmptrader/TT-FIX-SAMPLE
        /// <summary>
        /// send a new order
        /// </summary>
        /// <param name="instrument">string array containing either
        /// {SecurityExchange, Symbol,SecurityType,MaturityMonthYear} or
        /// {SecurityExchange, Symbol,SecurityID}</param>
        /// <param name="gateway"></param>
        /// <param name="account"></param>
        /// <param name="orderType"></param>
        /// <param name="tradePrice"></param>
        /// <param name="qty"></param>
        /// <param name="bs"></param>
        public void ttNewOrderSingle(string[] instrument, string gateway,
                                     string account, char orderType, double tradePrice, double qty, char bs)
        {
            //string[] instrument must contain:
            //{SecurityExchange, Symbol,SecurityType,MaturityMonthYear} or
            //{SecurityExchange, Symbol,SecurityID}

            try
            {
                QuickFix42.NewOrderSingle nos = new QuickFix42.NewOrderSingle();

                nos.set(new QuickFix.ClOrdID(uniqueID()));

                #region DefineInstrument
                nos.set(new QuickFix.SecurityExchange(instrument[0]));
                nos.set(new QuickFix.Symbol(instrument[1]));

                if (instrument.GetLength(0) == 4)
                {
                    nos.set(new QuickFix.SecurityType(instrument[2]));
                    nos.set(new QuickFix.MaturityMonthYear(instrument[3]));
                }
                else if (instrument.GetLength(0) == 3)
                {
                    nos.set(new QuickFix.SecurityID(instrument[2]));
                }
                else
                {
                    throw new System.Exception("Incorrect parameters for insturment definition");
                }
                #endregion

                nos.set(new QuickFix.OrderQty(qty));
                nos.set(new QuickFix.Side(bs));
                nos.set(new QuickFix.Account(account));

                nos.set(new QuickFix.OrdType(orderType));
                if (orderType == QuickFix.OrdType.LIMIT)
                {
                    nos.set(new QuickFix.Price(tradePrice));
                }

                //Use this code if FA is setup to accept tag 47 and 204 instead of custom tag 18205
                //nos.set(new QuickFix.Rule80A(QuickFix.Rule80A.AGENCY_SINGLE_ORDER));
                //nos.set(new QuickFix.CustomerOrFirm(QuickFix.CustomerOrFirm.CUSTOMER));
                nos.setString(TT.TTAccountType.FIELD, TT.TTAccountType.A1);

                //To add a TT custom tag to a QuickFix Message you must use setField or similar
                //the set method of the QuickFix42 message only allows setting standard FIX 4.2 fields
                //required for environments with multiple gateways with same products
                if (gateway != null)
                {
                    nos.setString(TT.ExchangeGateway.FIELD, gateway);
                }

                nos.setString(TT.FFT2.FIELD, "FFT2");
                nos.setString(TT.FFT3.FIELD, "FFT3");

                QuickFix.Session.sendToTarget(nos, orderSessionID);
            }
            catch (Exception ex)
            { Console.WriteLine(ex.ToString()); }
        }
コード例 #9
0
ファイル: QuickFIX42Application.cs プロジェクト: heber/FreeOQ
		public virtual void Send(FIXNewOrderSingle Order)
		{
			QuickFix.FIX42.NewOrderSingle newOrderSingle = new QuickFix42.NewOrderSingle(new ClOrdID(Order.ClOrdID), new HandlInst(Order.HandlInst), new Symbol(Order.Symbol), new QuickFix.Side(Order.Side), new TransactTime(Order.TransactTime), new QuickFix.OrdType(Order.OrdType));
			if (Order.ContainsField(1))
				newOrderSingle.set(new Account(Order.Account));
			if (Order.ContainsField(18))
				newOrderSingle.set(new ExecInst(Order.ExecInst));
			if (Order.ContainsField(110))
				newOrderSingle.set(new MinQty(Order.MinQty));
			if (Order.ContainsField(111))
				newOrderSingle.set(new MaxFloor(Order.MaxFloor));
			if (Order.ContainsField(100))
				newOrderSingle.set(new ExDestination(Order.ExDestination));
			if (Order.ContainsField(81))
				newOrderSingle.set(new ProcessCode(Order.ProcessCode));
			if (Order.ContainsField(65))
				newOrderSingle.set(new SymbolSfx(Order.SymbolSfx));
			if (Order.ContainsField(48))
				newOrderSingle.set(new SecurityID(Order.SecurityID));
			if (Order.ContainsField(22))
				newOrderSingle.set(new IDSource(Order.SecurityIDSource));
			if (Order.ContainsField(167))
				newOrderSingle.set(new QuickFix.SecurityType(Order.SecurityType));
			if (Order.ContainsField(200))
				newOrderSingle.set(new MaturityMonthYear(Order.MaturityMonthYear));
			if (Order.ContainsField(202))
				newOrderSingle.set(new StrikePrice(Order.StrikePrice));
			if (Order.ContainsField(206))
				newOrderSingle.set(new OptAttribute(Order.OptAttribute));
			if (Order.ContainsField(231))
				newOrderSingle.set(new ContractMultiplier(Order.ContractMultiplier));
			if (Order.ContainsField(223))
				newOrderSingle.set(new CouponRate(Order.CouponRate));
			if (Order.ContainsField(207))
				newOrderSingle.set(new SecurityExchange(Order.SecurityExchange));
			if (Order.ContainsField(106))
				newOrderSingle.set(new Issuer(Order.Issuer));
			if (Order.ContainsField(348))
				newOrderSingle.set(new EncodedIssuerLen(Order.EncodedIssuerLen));
			if (Order.ContainsField(349))
				newOrderSingle.set(new EncodedIssuer(Order.EncodedIssuer));
			if (Order.ContainsField(107))
				newOrderSingle.set(new SecurityDesc(Order.SecurityDesc));
			if (Order.ContainsField(350))
				newOrderSingle.set(new EncodedSecurityDescLen(Order.EncodedSecurityDescLen));
			if (Order.ContainsField(351))
				newOrderSingle.set(new EncodedSecurityDesc(Order.EncodedSecurityDesc));
			if (Order.ContainsField(140))
				newOrderSingle.set(new PrevClosePx(Order.PrevClosePx));
			if (Order.ContainsField(38))
				newOrderSingle.set(new OrderQty(Order.OrderQty));
			if (Order.ContainsField(152))
				newOrderSingle.set(new CashOrderQty(Order.CashOrderQty));
			if (Order.ContainsField(44))
				newOrderSingle.set(new Price(Order.Price));
			if (Order.ContainsField(99))
				newOrderSingle.set(new StopPx(Order.StopPx));
			if (Order.ContainsField(15))
				newOrderSingle.set(new QuickFix.Currency(Order.Currency));
			if (Order.ContainsField(376))
				newOrderSingle.set(new ComplianceID(Order.ComplianceID));
			if (Order.ContainsField(117))
				newOrderSingle.set(new QuoteID(Order.QuoteID));
			if (Order.ContainsField(59))
				newOrderSingle.set(new QuickFix.TimeInForce(Order.TimeInForce));
			if (Order.ContainsField(168))
				newOrderSingle.set(new EffectiveTime(Order.EffectiveTime));
			if (Order.ContainsField(126))
				newOrderSingle.set(new ExpireTime(Order.ExpireTime));
			if (Order.ContainsField(427))
				newOrderSingle.set(new GTBookingInst(Order.GTBookingInst));
			if (Order.ContainsField(12))
				newOrderSingle.set(new Commission(Order.Commission));
			if (Order.ContainsField(13))
				newOrderSingle.set(new QuickFix.CommType(Order.CommType));
			if (Order.ContainsField(120))
				newOrderSingle.set(new SettlCurrency(Order.SettlCurrency));
			if (Order.ContainsField(58))
				newOrderSingle.set(new Text(Order.Text));
			if (Order.ContainsField(354))
				newOrderSingle.set(new EncodedTextLen(Order.EncodedTextLen));
			if (Order.ContainsField(355))
				newOrderSingle.set(new EncodedText(Order.EncodedText));
			if (Order.ContainsField(192))
				newOrderSingle.set(new OrderQty2(Order.OrderQty2));
			if (Order.ContainsField(203))
				newOrderSingle.set(new CoveredOrUncovered(Order.CoveredOrUncovered));
			if (Order.ContainsField(210))
				newOrderSingle.set(new MaxShow(Order.MaxShow));
			if (Order.ContainsField(388))
				newOrderSingle.set(new DiscretionInst(Order.DiscretionInst));
			try
			{
				Session.sendToTarget((QuickFix.Message)newOrderSingle, this.fSessionID);
			}
			catch (Exception ex)
			{
				Console.WriteLine(BeAEwTZGlZaeOmY5cm.J00weU3cM6(1252) + ex.Message);
			}
		}
コード例 #10
0
        public override void Send(FIXNewOrderSingle Order)
        {
            QuickFix42.NewOrderSingle order = new QuickFix42.NewOrderSingle(
                new QuickFix.ClOrdID(Order.ClOrdID),
                //new QuickFix.HandlInst(Order.HandlInst),
                new QuickFix.HandlInst(HandlInst.AUTOEXECPRIV), // GS FIX
                new QuickFix.Symbol(Order.Symbol.Substring(0,6)),
                new QuickFix.Side(Order.Side),
                new QuickFix.TransactTime(Order.TransactTime),
                new QuickFix.OrdType(Order.OrdType));

            if ((Order.OrdType == FIXOrdType.Limit || Order.OrdType == FIXOrdType.StopLimit) && Order.ContainsField(EFIXField.Price))
                order.set(new QuickFix.Price(Order.Price));

            if ((Order.OrdType == FIXOrdType.Stop || Order.OrdType == FIXOrdType.StopLimit) && Order.ContainsField(EFIXField.StopPx))
                order.set(new QuickFix.StopPx(Order.StopPx));

            // 自己计算交易所
            if (Order.Symbol.StartsWith("60") || Order.Symbol.StartsWith("51"))
            {
                //order.set(new QuickFix.SecurityExchange("XSHG"));// 上海
                order.set(new QuickFix.SecurityExchange("SS"));// 上海
            }
            else if (Order.Symbol.StartsWith("00") || Order.Symbol.StartsWith("30") || Order.Symbol.StartsWith("15"))
            {
                //order.set(new QuickFix.SecurityExchange("XSHE"));// 深圳
                order.set(new QuickFix.SecurityExchange("SZ"));// 深圳
            }

            if (Order.Text.StartsWith(OpenPrefix))
            {
                order.setField(new QuickFix.CashMargin(CashMargin.MARGIN_OPEN));
            }
            else if (Order.Text.StartsWith(ClosePrefix))
            {
                order.setField(new QuickFix.CashMargin(CashMargin.MARGIN_CLOSE));
            }

            //order.set(new QuickFix.SecurityType(Order.SecurityType));
            order.set(new QuickFix.OrderQty(Order.OrderQty));
            //order.set(new QuickFix.Account(Order.Account));
            //order.set(new QuickFix.Rule80A(Order.Rule80A));
            //order.set(new QuickFix.CustomerOrFirm(Order.CustomerOrFirm));

            //if (Order.ContainsField(EFIXField.ClearingAccount))
            //    order.set(new QuickFix.ClearingAccount(Order.ClearingAccount));

            order.set(new QuickFix.Currency("CNY")); // GS FIX

            Session.sendToTarget(order, orderSessionID);
        }