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); }
public MarketHistoryItemsReport <HistoryBar> QueryBarHistory(DateTime to, int maxBars, string symbol, string periodicity, FxPriceType priceType) { var type = FxPriceType.Bid == priceType ? PriceType.Bid : PriceType.Ask; var period = new BarPeriod(periodicity); var info = this.dataFeed.Server.GetHistoryBars(symbol, to, -maxBars, type, period); var result = new MarketHistoryItemsReport <HistoryBar> { Items = info.Bars.Select(StorageConvert.ToHistoryBar).ToList(), AvailableFrom = info.FromAll, AvailableTo = info.ToAll, From = info.From.Value, To = info.To.Value, LastTickId = !string.IsNullOrEmpty(info.LastTickId) ? FeedTickId.Parse(info.LastTickId) : default(FeedTickId?), Symbol = symbol }; return(result); }
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); }
public FeedTick ToFeedTick(Quote quote) { this.records.Clear(); this.FillRecords(FxPriceType.Bid, quote.Bids); this.FillRecords(FxPriceType.Ask, quote.Asks); if (!string.IsNullOrEmpty(quote.Id)) { var id = FeedTickId.Parse(quote.Id); this.index = id.Index; } else if (this.lastUsedTimeStamp < quote.CreatingTime) { this.index = 0; } this.lastUsedTimeStamp = quote.CreatingTime; var result = new FeedTick(quote.Symbol, quote.CreatingTime, this.index, this.records); ++this.index; return(result); }