Пример #1
0
        private NettoRecord MoveToNettos(DateTime closeTime)
        {
            if (cur == null)
            {
                return(null);
            }
            if (cur.time == closeTime)
            {
                return(cur);
            }
            if (cur.time > closeTime)
            {
                return(null);
            }

            if (next != null)
            {
                if (next.time > closeTime)
                {
                    return(cur);
                }
                if (next.time == closeTime)
                {
                    cur  = next;
                    next = NettoRecord.ReadNext(nettoReader);
                    return(cur);
                }

                while (true)
                {
                    cur  = next;
                    next = NettoRecord.ReadNext(nettoReader);
                    if (next == null)
                    {
                        cur = null;
                        return(null);
                    }
                    if (next.time > closeTime)
                    {
                        return(cur);
                    }
                    if (next.time == closeTime)
                    {
                        cur  = next;
                        next = NettoRecord.ReadNext(nettoReader);
                        return(cur);
                    }
                }
            }

            return(null);
        }
Пример #2
0
        public override void Initialize(BacktestServerProxy.RobotContext grobotContext,
                                        Contract.Util.BL.CurrentProtectedContext protectedContextx)
        {
            base.Initialize(grobotContext, protectedContextx);
            if (Graphics.Count == 0)
            {
                Logger.DebugFormat("CounterNettoRobot: настройки графиков не заданы");
                return;
            }

            packers = Graphics.ToDictionary(g => g.a, g => new CandlePacker(g.b));

            if (!File.Exists(NettoFilePath))
            {
                Logger.DebugFormat("CounterNettoRobot: файл не найден");
                return;
            }
            nettoReader = new StreamReader(NettoFilePath, Encoding.ASCII);
            NettoRecord.ReadHeader(nettoReader);
            cur  = NettoRecord.ReadNext(nettoReader);
            next = NettoRecord.ReadNext(nettoReader);
        }