public static void ReplaceOrder(OrderID orderID, ClOrdID clOrdID, decimal price, OrdType ordType, TimeInForce timeInForce, Symbol symbol,
                                        OrderQty orderQty, Side side, ExpireTime expireTime, Account account, decimal?slippage)
        {
            QuickFix44.OrderCancelReplaceRequest message = new QuickFix44.OrderCancelReplaceRequest(
                new OrigClOrdID(clOrdID.getValue()),
                clOrdID,
                side,
                new TransactTime(DateTime.UtcNow),
                ordType);

            message.set(orderID);
            message.set(new Price((double)price));
            message.set(timeInForce);
            message.set(symbol);
            message.set(orderQty);

            if (expireTime != null)
            {
                message.set(expireTime);
            }
            if (account != null)
            {
                message.set(account);
            }
            if (slippage.HasValue)
            {
                message.setDouble(7011, (double)slippage.Value);
            }

            Credential dukascopyCredential = CredentialFactory.GetCredential(Counterpart.Dukascopy);

            Session.sendToTarget(message, dukascopyCredential.TradingSenderCompID, dukascopyCredential.TradingTargetCompID);
        }
Ejemplo n.º 2
0
        //public static void ResetSequence()
        //{
        //    QuickFix44.SequenceReset resetSeq = new QuickFix44.SequenceReset();
        //    Session.sendToTarget(resetSeq, Application.m_sessionID);
        //}

        //public static void ResetSequence(int seqNo)
        //{
        //    QuickFix44.SequenceReset resetSeq = new QuickFix44.SequenceReset(new NewSeqNo(seqNo));
        //    Session.sendToTarget(resetSeq, Application.m_sessionID);
        //}

        //[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]
        public static void ModifyCancelOrder(string account, string securityCode, string clOrderID, string OrigClOrdID, int quantity, double price, char timeInForce, char orderType, char orderSide, bool hasAON, int minQty)
        {
            QuickFix44.OrderCancelReplaceRequest modify = new QuickFix44.OrderCancelReplaceRequest();
            modify.setField(new Account(account));
            modify.setField(new QuickFix.ClOrdID(string.Format("{0}{1}", _wcfMsgPrefix, clOrderID)));
            modify.setField(new OrigClOrdID(string.Format("{0}{1}", _wcfMsgPrefix, OrigClOrdID)));
            modify.setField(new Symbol(securityCode));
            modify.setField(new OrderQty((int)quantity));
            modify.setField(new Price((double)price));
            modify.setField(new TimeInForce((char)timeInForce));
            modify.setField(new QuickFix.Side(orderSide));
            modify.setField(new QuickFix.OrdType(orderType));
            modify.setField(new TransactTime(DateTime.Now));
            modify.setField(new QuickFix.HandlInst(QuickFix.HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION));
            if (hasAON)
            {
                modify.setField(new ExecInst(ExecInst.ALL_OR_NONE.ToString()));
                modify.setField(new MinQty(minQty));
            }
            Session.sendToTarget(modify, _sessionID);
        }