示例#1
0
 /// <summary>
 /// 通知登入結果事件
 /// </summary>
 private static void MrWangConnection_OnLogonReply(int Code, string Msg)
 {
     if (Code == 0)
     {
         //登入成功
         Console.WriteLine("登入成功。");
         Console.WriteLine("訂閱商品TXFD9。");
         //地4步 訂閱報價
         MrWangConnection.SubscribeQuote("TXFD9");
         //產生下單物件
         Order order = new Order();
         {
             order.Symbol      = "TXFD9";
             order.Side        = SideEnum.Buy;
             order.Price       = 10700;
             order.Qty         = 1;
             order.OrderType   = OrderTypeEnum.otLimit;
             order.TimeInForce = TimeInForceEnum.IOC;
         };
         MrWangConnection.SnedOrder(order);
     }
     else
     {
         //登入失敗
         Console.WriteLine($"Code:{Code} Msg:{Msg}");
     }
 }
示例#2
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private static void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXFD9。");
                MrWangConnection.SubscribeQuote("TXFD9", 1);

                //產生下單物件
                Order order = new Order()
                {
                    Symbol      = "TXFD9",
                    Side        = SideEnum.Buy,
                    Price       = 10820,
                    Qty         = 1,
                    OrderType   = OrderTypeEnum.otLimit,
                    TimeInForce = TimeInForceEnum.ROD,
                };

                //下單
                SendSTPLMT(order);
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }
示例#3
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private static void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXFD9。");
                MrWangConnection.SubscribeQuote("TXFD9", 20);

                CanceledOrder canceledOrder = new CanceledOrder()
                {
                    Symbol      = "TXFD9",
                    Side        = SideEnum.Buy,
                    Qty         = 1,
                    Price       = 10800,
                    OrderType   = OrderTypeEnum.otLimit,
                    TimeInForce = TimeInForceEnum.ROD,
                    TimeOut     = DateTime.Now.AddSeconds(10)
                };

                SendTimeCancelOrder(canceledOrder);
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }
示例#4
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private static void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXFD9。");
                MrWangConnection.SubscribeQuote("TXFD9", 20);

                //產生下單物件
                MoveStopOrder order = new MoveStopOrder()
                {
                    Symbol    = "TXFD9",
                    Side      = SideEnum.Sell,
                    StopPrice = 10810,
                    TickCount = 5,
                    Tick      = 1,
                    Qty       = 1,
                };

                //下單
                SendMOVSTP(order);
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }
示例#5
0
 /// <summary>
 /// 通知登入結果事件
 /// </summary>
 private static void MrWangConnection_OnLogonReply(int Code, string Msg)
 {
     if (Code == 0)
     {
         //登入成功
         Console.WriteLine("登入成功。");
         Console.WriteLine("訂閱商品TXFD9。");
         MrWangConnection.SubscribeQuote("TXFD9", 20);
     }
     else
     {
         //登入失敗
         Console.WriteLine($"Code:{Code} Msg:{Msg}");
     }
 }
示例#6
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXD9。");

                foreach (var product in dicProduct)
                {
                    MrWangConnection.SubscribeQuote(product.Key, 5);
                }
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }
示例#7
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private static void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXFD9。");
                MrWangConnection.SubscribeQuote("TXFD9", 20);

                Order SellOrder1 = new Order()
                {
                    Symbol      = "TXFD9",
                    Side        = SideEnum.Sell,
                    Qty         = 1,
                    Price       = 10817,
                    TimeInForce = TimeInForceEnum.IOC,
                    OrderType   = OrderTypeEnum.otMarket
                };

                Order SellOrder2 = new Order()
                {
                    Symbol      = "TXFD9",
                    Side        = SideEnum.Sell,
                    Qty         = 1,
                    Price       = 10830,
                    TimeInForce = TimeInForceEnum.IOC,
                    OrderType   = OrderTypeEnum.otMarket
                };


                Tuple <Order, Order> OCOOrder = new Tuple <Order, Order>(SellOrder1, SellOrder2);

                SendOCOOrder(OCOOrder);
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }
示例#8
0
        /// <summary>
        /// 通知登入結果事件
        /// </summary>
        private static void MrWangConnection_OnLogonReply(int Code, string Msg)
        {
            if (Code == 0)
            {
                //登入成功
                Console.WriteLine("登入成功。");
                Console.WriteLine("訂閱商品TXFD9。");
                MrWangConnection.SubscribeQuote("TXFD9", 20);

                QuoteOrder quoteOrder = new QuoteOrder()
                {
                    Symbol = "TXFD9",
                    Ask    = 10900,
                    AskQty = 1,
                    Bid    = 10700,
                    BidQty = 1
                };

                SendQuoteOrder(quoteOrder);

                quoteOrder = new QuoteOrder()
                {
                    Symbol = "TXFD9",
                    Ask    = 10850,
                    AskQty = 1,
                    Bid    = 10750,
                    BidQty = 2
                };

                SendQuoteOrder(quoteOrder);
            }
            else
            {
                //登入失敗
                Console.WriteLine($"Code:{Code} Msg:{Msg}");
            }
        }