public void ExternalOrdersTest()
        {
            reset();
            // send some external cancels
            Random r      = new Random();
            var    ids    = new int[] { r.Next(), r.Next(), r.Next(), r.Next() };
            bool   errors = false;

            foreach (var id in ids)
            {
                try
                {
                    ot.GotCancel((long)id);
                }
                catch (Exception ex)
                {
                    rt.d("error running testoffsettracker.externalorderstest: " + ex.Message + ex.StackTrace);
                    errors = true;
                }
            }
            // verify nothing happened in response
            Assert.AreEqual(0, profits.Count, "profits were sent");
            Assert.AreEqual(0, stops.Count, "stops were sent");
            Assert.IsFalse(errors, "errors occured processing external cancels");
        }
        void ot_SendCancel(long number)
        {
            bool hit = false;

            for (int i = profits.Count - 1; i >= 0; i--)
            {
                if (profits[i].id == number)
                {
                    hit = true;
                    profits.RemoveAt(i);
                }
            }
            for (int i = stops.Count - 1; i >= 0; i--)
            {
                if (stops[i].id == number)
                {
                    hit = true;
                    stops.RemoveAt(i);
                }
            }

            if (hit)
            {
                ot.GotCancel(number);
            }
            else
            {
                debug("unable to cancel: " + number);
            }
        }
        void ot_SendCancel(uint number)
        {
            for (int i = profits.Count - 1; i >= 0; i--)
            {
                if (profits[i].id == number)
                {
                    profits.RemoveAt(i);
                }
            }
            for (int i = stops.Count - 1; i >= 0; i--)
            {
                if (stops[i].id == number)
                {
                    stops.RemoveAt(i);
                }
            }


            ot.GotCancel(number);
        }
Esempio n. 4
0
 public override void GotOrderCancel(long id)
 {
     // pass offset cancels back through
     ot.GotCancel(id);
 }