Пример #1
0
        public void SendPrevQuotedOrder(string strSymbol, double dLots, char chSide, string strQuoteID)
        {
            try
            {
                if (m_SessionID == null)
                {
                    return;
                }

                string strCIOrdID = "KYO" + DateTime.UtcNow.ToString("yyyyMMddHHmmssffff");

                QuickFix.FIX44.NewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle(
                    new ClOrdID(strCIOrdID),
                    new Symbol(strSymbol),
                    new Side(chSide),
                    new TransactTime(DateTime.UtcNow),
                    new OrdType(OrdType.PREVIOUSLY_QUOTED));
                newOrderSingle.Set(new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION));
                newOrderSingle.Set(new OrderQty(Convert.ToDecimal(dLots * Math.Pow(10, 5))));
                newOrderSingle.Set(new TimeInForce(TimeInForce.IMMEDIATE_OR_CANCEL));
                newOrderSingle.Set(new QuoteID(strQuoteID));
                Session.SendToTarget(newOrderSingle, m_SessionID);
                Logger.Instance().Log($"REQUEST (SendPreviouslyQuotedOrder) => Symbol: {strSymbol}, Lots: {dLots}, Type: {new Side(chSide)}, QuoteID: {strQuoteID}");
            }
            catch (Exception ex)
            {
                Logger.Instance().LogToFile(ex.ToString());
            }
        }
Пример #2
0
        private QuickFix.FIX44.NewOrderSingle QueryNewOrderSingle44()
        {
            QuickFix.Fields.OrdType ordType = null;

            QuickFix.FIX44.NewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle(
                QueryClOrdID(),
                QuerySymbol(),
                QuerySide(),
                new TransactTime(DateTime.Now),
                ordType = QueryOrdType());

            newOrderSingle.Set(new HandlInst('1'));
            newOrderSingle.Set(QueryOrderQty());
            newOrderSingle.Set(QueryTimeInForce());
            if (ordType.getValue() == OrdType.LIMIT || ordType.getValue() == OrdType.STOP_LIMIT)
            {
                newOrderSingle.Set(QueryPrice());
            }
            if (ordType.getValue() == OrdType.STOP || ordType.getValue() == OrdType.STOP_LIMIT)
            {
                newOrderSingle.Set(QueryStopPx());
            }

            return(newOrderSingle);
        }
Пример #3
0
        private QuickFix.FIX44.NewOrderSingle QueryNewOrderSingle44()
        {
            QuickFix.FIX44.NewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle();
            newOrderSingle.ClOrdID = new ClOrdID(DateTime.Now.Millisecond.ToString());
            var noContraBrokersGroup = new QuickFix.FIX44.ExecutionReport.NoContraBrokersGroup();

            noContraBrokersGroup.Set(QueryPool());
            newOrderSingle.AddGroup(noContraBrokersGroup);
            newOrderSingle.Symbol  = QuerySymbol();
            newOrderSingle.Side    = QuerySide();
            newOrderSingle.OrdType = new OrdType(OrdType.MARKET);
            newOrderSingle.Set(QueryOrderQty());
            newOrderSingle.Set(new TimeInForce(TimeInForce.FILL_OR_KILL));
            return(newOrderSingle);
        }
Пример #4
0
 /// <summary>
 /// Create FIX request for new limit order
 /// </summary>
 /// <param name="vol"></param>
 /// <param name="price"></param>
 /// <param name="side"></param>
 /// <returns></returns>
 public static Message CreateNewOrderRequest(double vol, double price, char side, char type)
 {
     QuickFix.FIX44.NewOrderSingle newOrderSingleRequest = new QuickFix.FIX44.NewOrderSingle();
     newOrderSingleRequest.Set(new Account(AccountUtil.APIKey + "," + AccountUtil.SecretKey));
     newOrderSingleRequest.Set(new ClOrdID(GetFreeID));
     newOrderSingleRequest.Set(new OrderQty(new decimal(vol)));
     newOrderSingleRequest.Set(new OrdType(type));
     newOrderSingleRequest.Set(new Price(new decimal(price)));
     newOrderSingleRequest.Set(new Side(side));
     newOrderSingleRequest.Set(TradeSymbol);
     newOrderSingleRequest.Set(new TransactTime(DateTime.Now));
     return(newOrderSingleRequest);
 }
Пример #5
0
        public void SendLimitOrder(string strSymbol, double dLots, double dPrice, char chSide)
        {
            if (m_SessionID == null)
            {
                return;
            }

            string strCIOrdID = "KYO" + DateTime.UtcNow.ToString("yyyyMMddHHmmssffff");

            QuickFix.FIX44.NewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle(
                new ClOrdID(strCIOrdID),
                new Symbol(strSymbol),
                new Side(chSide),
                new TransactTime(DateTime.UtcNow),
                new OrdType(OrdType.LIMIT));
            newOrderSingle.Set(new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION));
            newOrderSingle.Set(new Price(Convert.ToDecimal(dPrice)));
            newOrderSingle.Set(new OrderQty(Convert.ToDecimal(dLots * Math.Pow(10, 5))));
            newOrderSingle.Set(new TimeInForce(TimeInForce.GOOD_TILL_CANCEL));
            Session.SendToTarget(newOrderSingle, m_SessionID);
            Logger.Instance().Log($"REQUEST (SendLimitOrder) => Symbol: {strSymbol}, Lots: {dLots}, Price: {dPrice}, Type: {new Side(chSide)}");
        }
Пример #6
0
        /**
         * new Order request
         * @throws IOException
         */
        public static Message createOrderBookRequest()
        {
            //this new Order request type (D)
            QuickFix.FIX44.NewOrderSingle newOrderSingleRequest = new QuickFix.FIX44.NewOrderSingle();
            //In there you should Set your partner and securitykey must contain a comma
            newOrderSingleRequest.Set(new Account(AccountUtil.apiKey+","+AccountUtil.sercretKey));
            //this is your unique id you can fill any string
            newOrderSingleRequest.Set(new ClOrdID("123"));
            //the amount you want to operate (buy or sell)
            newOrderSingleRequest.Set(new OrderQty(1));
            //There is operate type. "1" means marker price order,"2" means limit price order
            newOrderSingleRequest.Set(new OrdType('1'));

            newOrderSingleRequest.Set(new Price(10));
            //1 means buy;2 means sell
            newOrderSingleRequest.Set(new Side('1'));
            //type BTC/CNY or LTC/CNY other formart not supported
            newOrderSingleRequest.Set(new Symbol("LTC/CNY"));
            //time
            newOrderSingleRequest.Set(new TransactTime());
            return newOrderSingleRequest;
        }
Пример #7
0
        /**
         * new Order request
         * @throws IOException
         */
        public static Message createOrderBookRequest()
        {
            //this new Order request type (D)
            QuickFix.FIX44.NewOrderSingle newOrderSingleRequest = new QuickFix.FIX44.NewOrderSingle();
            //In there you should Set your partner and securitykey must contain a comma
            newOrderSingleRequest.Set(new Account(AccountUtil.apiKey + "," + AccountUtil.sercretKey));
            //this is your unique id you can fill any string
            newOrderSingleRequest.Set(new ClOrdID("123"));
            //the amount you want to operate (buy or sell)
            newOrderSingleRequest.Set(new OrderQty(1));
            //There is operate type. "1" means marker price order,"2" means limit price order
            newOrderSingleRequest.Set(new OrdType('1'));

            newOrderSingleRequest.Set(new Price(10));
            //1 means buy;2 means sell
            newOrderSingleRequest.Set(new Side('1'));
            //type BTC/CNY or LTC/CNY other formart not supported
            newOrderSingleRequest.Set(new Symbol("LTC/CNY"));
            //time
            newOrderSingleRequest.Set(new TransactTime());
            return(newOrderSingleRequest);
        }
Пример #8
0
        private QuickFix.FIX44.NewOrderSingle QueryNewOrderSingle44()
        {
            QuickFix.Fields.OrdType ordType = null;

            QuickFix.FIX44.NewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle(
                QueryClOrdID(),
                QuerySymbol(),
                QuerySide(),
                new TransactTime(DateTime.Now),
                ordType = QueryOrdType());

            newOrderSingle.Set(new HandlInst('1'));
            newOrderSingle.Set(QueryOrderQty());
            newOrderSingle.Set(QueryTimeInForce());
            if (ordType.getValue() == OrdType.LIMIT || ordType.getValue() == OrdType.STOP_LIMIT)
                newOrderSingle.Set(QueryPrice());
            if (ordType.getValue() == OrdType.STOP || ordType.getValue() == OrdType.STOP_LIMIT)
                newOrderSingle.Set(QueryStopPx());

            return newOrderSingle;
        }
Пример #9
0
        private void TransmitNewOrderSingle()
        {
            QuickFix.FIX44.NewOrderSingle msg = new QuickFix.FIX44.NewOrderSingle(
                new ClOrdID("woooot"),
                new Symbol("IBM"),
                new Side(Side.BUY),
                new TransactTime(DateTime.Now),
                new OrdType(OrdType.MARKET));

            msg.Set(new OrderQty(99));

            SendMessage(msg);
        }
Пример #10
0
 public static Message CreateOrderBookRequest(decimal price, char side, bool open)
 {
     QuickFix.FIX44.NewOrderSingle newOrderSingleRequest = new QuickFix.FIX44.NewOrderSingle();
     newOrderSingleRequest.Set(AccountUtil.Account);
     newOrderSingleRequest.Set(new ClOrdID("111"));
     newOrderSingleRequest.Set(new OrderQty(1));
     newOrderSingleRequest.Set(new OrdType('2'));
     newOrderSingleRequest.Set(new Price(price));
     newOrderSingleRequest.Set(new Side(side));
     newOrderSingleRequest.Set(new PositionEffect(open ? 'O' : 'C'));
     newOrderSingleRequest.Set(new Symbol("quarter"));
     newOrderSingleRequest.Set(new Currency("btc_usd"));
     newOrderSingleRequest.Set(new SecurityType(SecurityType.FUTURE));
     newOrderSingleRequest.Set(new MarginRatio(20));
     newOrderSingleRequest.Set(new TransactTime());
     return(newOrderSingleRequest);
 }