/// <summary>
        /// Submit FIX request to retreive all the days trades, SODs and manual Fills
        /// </summary>
        /// <param name="session"></param>
        /// <param name="reqtype"></param>
        public void ttRequestForPosition(int reqtype)
        {
            try
            {
                QuickFix42.Message rfp = new QuickFix42.Message(new QuickFix.MsgType("UAN"));

                rfp.setField(new TT.PosReqId(uniqueID()));
                rfp.setField(new TT.PosReqType(reqtype));

                QuickFix.Session.sendToTarget(rfp, orderSessionID);
            }
            catch (Exception ex)
            { Console.WriteLine(ex.ToString()); }
        }
        /// <summary>
        /// Submit a FIX message to subscribe to gateway status.  Status is displayed but no action is attached.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="SubscriptionRequestType"></param>
        public void ttGatewayStatusRequest(char SubscriptionRequestType)
        {
            try
            {
                //Gateway Status Request
                QuickFix42.Message gsr = new QuickFix42.Message(new QuickFix.MsgType("UAR"));

                gsr.setChar(QuickFix.SubscriptionRequestType.FIELD, SubscriptionRequestType);

                gsr.setField(new TT.GatewayStatusReqId(uniqueID()));

                QuickFix.Session.sendToTarget(gsr, orderSessionID);
            }
            catch (Exception ex)
            { Console.WriteLine(ex.ToString()); }
        }
Exemple #3
0
        public QuickFix42.OrderCancelReplaceRequest GenerateReplaceRequest(string clOrdId, int qty, double limitPx, double stopPx, int index)
        {
            string originalId = (string)LimitOrders[index];

            QuickFix42.Message msg = Msgs[originalId];


            //check for a recent ID
            string temp = LimitLib.GetRecentId(originalId);

            if (temp != null)
            {
                LimitLib.Add(originalId, clOrdId);  //associate new Id
                originalId = temp;                  //send with most recent from previous request
            }
            else
            {
                LimitLib.Add(originalId, clOrdId);
            }

            Side oldSide = new Side();

            msg.getField(oldSide);

            TransactTime uTime = new TransactTime();

            msg.getField(uTime);

            QuickFix42.OrderCancelReplaceRequest ocrr = new QuickFix42.OrderCancelReplaceRequest(
                new OrigClOrdID(originalId),
                new ClOrdID(clOrdId),
                new HandlInst('1'),
                new Symbol(msg.getField(Symbol.FIELD)),
                oldSide,
                uTime,
                new OrdType(OrdType.LIMIT));

            // Update prices and quantity
            ocrr.set(limitPx > 0 ? new Price(limitPx) : new Price(double.Parse(msg.getField(Price.FIELD))));

            if (stopPx > 0) // If the user specified a new stop price
            {
                ocrr.set(new StopPx(stopPx));
            }
            else
            { // Otherwise use the original stop price
                StopPx spx = new StopPx();
                if (msg.isSetField(spx))
                {
                    msg.getField(spx);
                    ocrr.set(spx);
                }
                else
                {
                    msg.setField(spx);
                }
            }

            ocrr.set(qty > 0 ? new OrderQty(qty) : new OrderQty(int.Parse(msg.getField(OrderQty.FIELD))));

            OrderID oid = new OrderID("x");

            ocrr.setField(oid);
            ocrr.setField(57, msg.getField(57));
            ocrr.setField(9102, msg.getField(9102));

            return(ocrr);
        }