Beispiel #1
0
        MarketHistoryFileReport DoQueryTicksHistoryFile(DateTime to, string symbol, bool includeLevel2)
        {
            var info = this.dataFeed.Server.GetQuotesHistoryFiles(symbol, includeLevel2, to);

            var result = new MarketHistoryFileReport
            {
                Symbol        = symbol,
                AvailableFrom = info.FromAll,
                AvailableTo   = info.ToAll,
                From          = info.From ?? DateTime.MinValue,
                To            = info.To ?? DateTime.MinValue,
                LastTickId    = !string.IsNullOrEmpty(info.LastTickId) ? FeedTickId.Parse(info.LastTickId) : default(FeedTickId?)
            };

            var count = info.Files.Length;

            result.Files = new MarketHistoryFile[count];

            for (var index = 0; index < count; ++index)
            {
                var file = info.Files[index];
                using (var stream = new DataStream(this.dataFeed, file, this.Timeout))
                {
                    var part = new MarketHistoryFile
                    {
                        FileBytes = stream.ToArray()
                    };

                    result.Files[index] = part;
                }
            }

            return(result);
        }
Beispiel #2
0
        MarketBarHistoryFileReport DoQueryBarHistoryFile(DateTime to, string symbol, string periodicity, PriceType type)
        {
            DataHistoryInfo info;

            if (this.Timeout > 0)
            {
                info = this.dataFeed.Server.GetBarsHistoryFilesEx(symbol, to, type, periodicity, this.Timeout);
            }
            else
            {
                info = this.dataFeed.Server.GetBarsHistoryFiles(symbol, to, type, periodicity);
            }

            var result = new MarketBarHistoryFileReport
            {
                Symbol        = symbol,
                AvailableFrom = info.FromAll,
                AvailableTo   = info.ToAll,
                From          = info.From ?? DateTime.MinValue,
                To            = info.To ?? DateTime.MinValue,
                LastTickId    = !string.IsNullOrEmpty(info.LastTickId) ? FeedTickId.Parse(info.LastTickId) : default(FeedTickId?)
            };

            var count = info.Files.Length;

            result.Files = new MarketHistoryFile[count];

            for (var index = 0; index < count; ++index)
            {
                var file = info.Files[index];
                using (var stream = new DataStream(this.dataFeed, file, this.Timeout))
                {
                    var part = new MarketHistoryFile
                    {
                        FileBytes = stream.ToArray()
                    };

                    result.Files[index] = part;
                }
            }

            return(result);
        }