コード例 #1
0
        public void OtherSignalTest()
        {
            TickWrapper wrapper    = new TickWrapper();
            TickBinary  tickBinary = new TickBinary();

            tickReader.ReadQueue.Dequeue(ref tickBinary);
            wrapper.SetTick(ref tickBinary);
            data.InitializeTick(wrapper);
            StrategyInner inner = new StrategyInner();

            inner.Name            = "Inner";
            inner.IntervalDefault = IntervalsInternal.Day1;
            ModelDriverFactory factory = new ModelDriverFactory();

            factory.GetInstance(inner).EngineInitialize(data);
            StrategyInner other = new StrategyInner();

            other.Name            = "Other";
            other.IntervalDefault = IntervalsInternal.Day1;
            factory.GetInstance(other).EngineInitialize(data);
            inner.Chain.InsertAfter(other.Chain);
            log.Debug(inner.Chain.ToChainString());
            other.setSignal(1);
            StrategySupportInterface strategy = inner.Chain.Next.Next.Next.Next.Next.Model as StrategySupportInterface;

            Assert.AreEqual(1, strategy.Position.Signal, "Signal");
            other.setSignal(-1);
            strategy = inner.Chain.Next.Next.Next.Next.Next.Model as StrategySupportInterface;
            Assert.AreEqual(-1, strategy.Position.Signal, "Signal");
            other.setSignal(0);
            strategy = inner.Chain.Next.Model as StrategySupportInterface;
            Assert.AreEqual(0, strategy.Position.Signal, "Signal");
        }
コード例 #2
0
        public void Constructor()
        {
            TickWrapper wrapper    = new TickWrapper();
            TickBinary  tickBinary = new TickBinary();

            tickReader.ReadQueue.Dequeue(ref tickBinary);
            wrapper.SetTick(ref tickBinary);
            data.InitializeTick(wrapper);
            strategy = new StrategyCommon();
            strategy.IntervalDefault = IntervalsInternal.Day1;
            ModelDriverFactory factory = new ModelDriverFactory();

            factory.GetInstance(strategy).EngineInitialize(data);
            Assert.IsNotNull(strategy.Minutes, "Minutes");
            Assert.AreEqual(1, strategy.Minutes.Count, "Checking count");
            tickReader.ReadQueue.Dequeue(ref tickBinary);
            wrapper.SetTick(ref tickBinary);
            Assert.IsNotNull(strategy.Performance);
        }
コード例 #3
0
        public void SignalTest()
        {
            TickWrapper wrapper    = new TickWrapper();
            TickBinary  tickBinary = new TickBinary();

            tickReader.ReadQueue.Dequeue(ref tickBinary);
            wrapper.SetTick(ref tickBinary);
            data.InitializeTick(wrapper);
            StrategyInner inner = new StrategyInner();

            inner.IntervalDefault = IntervalsInternal.Day1;
            ModelDriverFactory factory = new ModelDriverFactory();

            factory.GetInstance(inner).EngineInitialize(data);
            inner.setSignal(1);
            Assert.AreEqual(1, inner.Position.Signal, "Signal");
            inner.setSignal(-1);
            Assert.AreEqual(-1, inner.Position.Signal, "Signal");
            inner.setSignal(0);
            Assert.AreEqual(0, inner.Position.Signal, "Signal");
        }