/// <summary>
        /// genera un mensaje especifico para Dukascopy
        /// </summary>
        /// <param name="clOrdID"></param>
        /// <param name="price"></param>
        /// <param name="ordType"></param>
        /// <param name="timeInForce"></param>
        /// <param name="symbol"></param>
        /// <param name="orderQty"></param>
        /// <param name="side"></param>
        /// <param name="expireTime"></param>
        /// <param name="account"></param>
        /// <param name="slippage"></param>
        public static void SubmitOrder(ClOrdID clOrdID, decimal?price, OrdType ordType, TimeInForce timeInForce, Symbol symbol, OrderQty orderQty, Side side, ExpireTime expireTime, Account account, decimal?slippage)
        {
            QuickFix44.NewOrderSingle message = new QuickFix44.NewOrderSingle(
                clOrdID,
                side,
                new TransactTime(DateTime.UtcNow),
                ordType);

            if (price.HasValue)
            {
                message.set(new Price((double)price.Value));
            }
            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);
        }
Beispiel #2
0
 public void exampleTrading(AccountsWindow accounts, RatesWindow rates, char direction)
 {
     exampleRunning = true;
     if (instruments == null)
     {
         instruments = rates.symbols();
     }
     foreach (QuickFix.Symbol instrument in rates.symbols())
     {
         // place a market order on each available account
         foreach (QuickFix.Account account in accounts.accounts())
         {
             // create a NewOrderSingle Market
             QuickFix44.NewOrderSingle order = new QuickFix44.NewOrderSingle(
                 new QuickFix.ClOrdID(sessionID + "-" + DateTime.Now.Ticks + "-" + nextID().ToString()),
                 new QuickFix.Side(direction),
                 new QuickFix.TransactTime(),
                 new QuickFix.OrdType(QuickFix.OrdType.MARKET)
                 );
             order.set(account);
             order.set(instrument);
             // get the minimum quantity from the RatesWindow
             order.set(new QuickFix.OrderQty(rates.minQty(instrument)));
             order.set(new QuickFix.TimeInForce(QuickFix.TimeInForce.GOOD_TILL_CANCEL));
             order.set(new QuickFix.SecondaryClOrdID("fix_example_test"));
             // sent the order to the API
             send(order, sessionID);
             // write note to the log
             Console.WriteLine(
                 "An order for {0:N0} {1} on {2} placed on {3}",
                 order.getOrderQty().getValue(),
                 ((order.getSide().getValue() == 2) ? "Sell" : "Buy"),
                 order.getSymbol().getValue(),
                 order.getAccount().getValue()
                 );
         }
     }
 }