Exemple #1
0
        private void ProcessTableWeekly()
        {
            RecMktDay day = (RecMktDay)null;

            _result = new MsMktList();
            int    num1 = -1;
            double num2 = 0.0;

            if (_dlyList.Reset())
            {
                do
                {
                    RecMktDay get      = _dlyList.Get;
                    RecDay    dtd      = get.dtd;
                    DateTime  dateTime = DateTime.FromOADate((double)get.dtd.d);
                    if (day == null)
                    {
                        day       = new RecMktDay(dtd);
                        day.dtd.v = 0.0f;
                        day.dtd.i = 0.0f;
                        num1      = -1;
                        num2      = (double)get.dtd.d;
                    }

                    if (dateTime.DayOfWeek <= (DayOfWeek)num1 || (double)get.dtd.d - num2 > 6.0)
                    {
                        _result.Add(ref day);
                        day       = new RecMktDay(dtd);
                        day.dtd.v = 0.0f;
                        day.dtd.i = 0.0f;
                    }

                    if ((double)dtd.h > (double)day.dtd.h)
                    {
                        day.dtd.h = dtd.h;
                    }
                    if ((double)dtd.l < (double)day.dtd.l)
                    {
                        day.dtd.l = dtd.l;
                    }
                    day.dtd.c  = dtd.c;
                    day.dtd.d  = dtd.d;
                    day.dtd.v += dtd.v;
                    day.dtd.i  = dtd.i;
                    num1       = (int)dateTime.DayOfWeek;
                    num2       = (double)dtd.d;
                } while (_dlyList.Next());
            }

            if (day == null)
            {
                return;
            }
            _result.Add(ref day);
        }
Exemple #2
0
 public bool Reset()
 {
     return(_result.Reset());
 }
Exemple #3
0
        private void LoadDailyData(int?fjd, int?ljd)
        {
            _dlyList = new MsMktList();
            if (File.Exists(_datFilePath))
            {
                bool flag = false;
                if (!fjd.HasValue && !ljd.HasValue)
                {
                    flag = true;
                }
                else
                {
                    if (!fjd.HasValue)
                    {
                        fjd = new int?(-99999);
                    }
                    if (!ljd.HasValue)
                    {
                        ljd = new int?(99999);
                    }
                }

                _fs = new FileStream(_datFilePath, FileMode.Open, FileAccess.Read, FileShare.None);
                if (_fs.Length > 0L)
                {
                    _baseRec = new RecMsDay();
                    int num = (int)(_fs.Length / 28L) - 1;
                    ReadFromFileStream(_fs, ref _baseRec);
                    for (int index = 0; index < num; ++index)
                    {
                        RecMktDay day = new RecMktDay();
                        ReadFromFileStream(_fs, ref day.msd);
                        day.MakeDtd();
                        if (!flag)
                        {
                            int d1              = day.dtd.d;
                            int?nullable        = fjd;
                            int valueOrDefault1 = nullable.GetValueOrDefault();
                            if ((d1 >= valueOrDefault1 ? (nullable.HasValue ? 1 : 0) : 0) != 0)
                            {
                                int d2 = day.dtd.d;
                                nullable = ljd;
                                int valueOrDefault2 = nullable.GetValueOrDefault();
                                if ((d2 <= valueOrDefault2 ? (nullable.HasValue ? 1 : 0) : 0) == 0)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }

                        _dlyList.Add(ref day);
                    }
                }

                _fs.Close();
                _dlyList.Reset();
            }

            _loaded = true;
        }