コード例 #1
0
        public void IgnoreByDefault()
        {
            // ignore all symbols by default, unless custom defined
            ot.IgnoreDefault = true;
            // reset "book"
            profits.Clear();
            stops.Clear();
            // reset offsets
            ot.ClearCustom();
            // make sure offsets don't exist
            Assert.AreEqual(0, profits.Count);
            Assert.AreEqual(0, stops.Count);
            // send position update to generate offsets
            ot.Adjust(new PositionImpl(SYM, PRICE, SIZE));
            // make sure offsets don't exist
            Assert.AreEqual(0, profits.Count);
            Assert.AreEqual(0, stops.Count);
            // add a custom offset
            ot[SYMB] = SampleOffset();
            // send position update to generate offsets
            ot.Adjust(new PositionImpl(SYMB, PRICE, SIZE));
            // verify orders exist
            Assert.AreEqual(1, profits.Count);
            Assert.AreEqual(1, stops.Count);
            // get orders
            Order profit = profits[0];
            Order stop   = stops[0];

            // verify profit offset
            Assert.IsTrue(profit.isValid);
            Assert.AreEqual(PRICE + POFFSET, profit.price);
            Assert.AreEqual(SIZE, profit.UnsignedSize);
            // verify stop offset
            Assert.IsTrue(stop.isValid);
            Assert.AreEqual(PRICE - SOFFSET, stop.stopp);
            Assert.AreEqual(SIZE, stop.UnsignedSize);
        }
コード例 #2
0
 public override void GotFill(Trade f)
 {
     ot.Adjust(f);
     pt.Adjust(f);
 }