Ejemplo n.º 1
0
        public Ticket(Order working)
        {
            InitializeComponent();
            work = working;
            if (work.Security == SecurityType.FUT)
            {
                osize.Increment = 1;
                osize.Value = 1;
            }


            isize = work.UnSignedSize;
            Text = work.symbol;

            osize.Text = work.ToString();
            oprice.Text = work.Price.ToString();
            if (work.Side) { obuybut.Checked = true; osellbut.Checked = false; }
            else { osellbut.Checked = true; obuybut.Checked = false; }
            oprice.MouseWheel += new MouseEventHandler(order_MouseWheel);
            
            osize.MouseWheel += new MouseEventHandler(osize_MouseWheel);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sends the order to the broker for a specific account.
 /// </summary>
 /// <param name="o">The order to be sent.</param>
 /// <param name="a">the account to send with the order.</param>
 /// <returns>order id if order was accepted, zero otherwise</returns>
 public uint sendOrder(Order o,Account a)
 {
     if ((!o.isValid) || (!a.isValid))
     {
         if (GotWarning != null)
             GotWarning(!o.isValid ? "Invalid order: " + o.ToString() : "Invalid Account" + a.ToString());
         return 0;
     }
     AddOrder(o, a);
     if ((GotOrder != null) && a.Notify) 
         GotOrder(o);
     return o.id;
 }
Ejemplo n.º 3
0
 void t_neworder(Order sendOrder)
 {
     int res = tl.SendOrder(sendOrder);
     if (res != 0)
     {
         string err = Util.PrettyError(tl.BrokerName,res);
         status(err);
         show(sendOrder.ToString() + "( " + err + " )");
     }
 }
Ejemplo n.º 4
0
        public void EqualsTest()
        {
            // following equals guidelines listed here:
            // http://msdn.microsoft.com/en-us/library/ms173147(VS.80).aspx

            // x.Equals(x) returns true.
            Order x = new Order("XTST", -300);
            Assert.That(x.Equals(x), x.ToString());

            // x.Equals(y) returns the same value as y.Equals(x).
            Order y = new Order("YTST",200);
            bool v1 = x.Equals(y);
            bool v2 = y.Equals(x);
            Assert.That(v1 == v2, x.ToString() + y.ToString());

            // if (x.Equals(y) && y.Equals(z)) returns true, then x.Equals(z) returns true.
            y = new Order(x);
            Order z = new Order(x);
            Assert.That(x.Equals(y) && y.Equals(z) && x.Equals(z));

            // Successive invocations of x.Equals(y) return the same value as long as the objects referenced by x and y are not modified.
            v1 = x.Equals(y);
            v2 = x.Equals(y);
            Assert.That(v1 == v2);

            // x.Equals(null) returns false.
            Assert.That(!x.Equals(null));


        }