Exemplo n.º 1
0
 public void newOrder(Order o, bool allclients)
 {
     for (int i = 0; i < client.Count; i++) // send tick to each client that has subscribed to tick's stock
     {
         if ((client[i] != null) && (allclients || (stocks[i].Contains(o.symbol))))
         {
             TLSend(OrderImpl.Serialize(o), MessageTypes.ORDERNOTIFY, i);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Sends the order.
        /// </summary>
        /// <param name="o">The oorder</param>
        /// <returns>Zero if succeeded, Broker error code otherwise.</returns>
        public int SendOrder(Order o)
        {
            if (o == null)
            {
                return((int)MessageTypes.EMPTY_ORDER);
            }
            if (!o.isValid)
            {
                return((int)MessageTypes.EMPTY_ORDER);
            }
            string m = OrderImpl.Serialize(o);

            return((int)TLSend(MessageTypes.SENDORDER, m));
        }
Exemplo n.º 3
0
 public void newOrder(Order o, bool allclients)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new tlneworderdelegate(newOrder), new object[] { o, allclients });
     }
     else
     {
         for (int i = 0; i < client.Count; i++)
         {
             if ((client[i] != null) && (client[i] != "") && (stocks[i].Contains(o.symbol) || allclients))
             {
                 WMUtil.SendMsg(OrderImpl.Serialize(o), MessageTypes.ORDERNOTIFY, Handle, client[i]);
             }
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Sends the order.
        /// </summary>
        /// <param name="o">The oorder</param>
        /// <returns>Zero if succeeded</returns>
        public int SendOrder(Order o)
        {
            if (o == null)
            {
                return((int)MessageTypes.EMPTY_ORDER);
            }
            if (!o.isValid)
            {
                return((int)MessageTypes.EMPTY_ORDER);
            }
            string m = OrderImpl.Serialize(o);

            try
            {
                TLSend(MessageTypes.SENDORDER, m);
                return(0);
            }
            catch (SocketException ex)
            {
                debug("Exception sending order: " + o.ToString() + " " + ex.SocketErrorCode + ex.Message + ex.StackTrace);
                return((int)MessageTypes.UNKNOWN_ERROR);
            }
        }