void PairBarsEnumeration() { var startTime = DateTime.Parse("3/3/2016 13:30:00", CultureInfo.InvariantCulture); var endTime = DateTime.Parse("3/3/2016 14:00:00", CultureInfo.InvariantCulture); var bars = new PairBars(this.Feed, "EURUSD", BarPeriod.S1, startTime, endTime, 1024); var bidsVolume = 0D; var asksVolume = 0D; foreach (var element in bars) { if (element.Bid != null) { bidsVolume += element.Bid.Volume; } if (element.Ask != null) { asksVolume += element.Ask.Volume; } } Console.WriteLine("PairBarsEnumeration(): bids volume = {0}, asks volume = {1}", bidsVolume, asksVolume); }
void GetQuotes(DataFeed feed, string symbol) { this.CheckCancel(); this.Log("Getting quotes for {0}", symbol); var bars = new PairBars(feed, symbol, BarPeriod.S1, timeStamp, -1); foreach (var element in bars) { if ((null != element.Bid) && (null != element.Ask)) { var entry = new FullSymbolEntry(symbol) { Bid = element.Bid.Close, Ask = element.Ask.Close, }; this.quotes.Add(entry); this.Log("Quotes for symbol {0} have been got: {1}/{2}", symbol, entry.Bid, entry.Ask); } else { this.Log("Quotes for symbol {0} are not available", symbol); } break; } }
public PairBar[] GetPairBars(string symbol, BarPeriod period, DateTime startTime, int barsNumber) { try { var bids = this.GetBars(symbol, PriceType.Bid, period, startTime, barsNumber); var asks = this.GetBars(symbol, PriceType.Ask, period, startTime, barsNumber); var bars = new PairBars(bids, asks, barsNumber >= 0); var result = bars.ToArray(); return(result); } catch (StorageHistoryNotFoundException ex) { throw new HistoryNotFoundException("GetPairBars", ex); } }
void PairBarsEnumeration() { var startTime = DateTime.Parse("2/1/2012 13:30:00", CultureInfo.InvariantCulture); var endTime = DateTime.Parse("2/1/2012 14:00:00", CultureInfo.InvariantCulture); var bars = new PairBars(this.Feed, "EURUSD", BarPeriod.S1, startTime, endTime, 1024); var bidsVolume = 0D; var asksVolume = 0D; foreach (var element in bars) { if (element.Bid != null) bidsVolume += element.Bid.Volume; if (element.Ask != null) asksVolume += element.Ask.Volume; } Console.WriteLine("PairBarsEnumeration(): bids volume = {0}, asks volume = {1}", bidsVolume, asksVolume); }
public PairBar[] GetPairBars(string symbol, BarPeriod period, DateTime startTime, int barsNumber) { try { var bids = this.GetBars(symbol, PriceType.Bid, period, startTime, barsNumber); var asks = this.GetBars(symbol, PriceType.Ask, period, startTime, barsNumber); var bars = new PairBars(bids, asks); var result = bars.ToArray(); return result; } catch (StorageHistoryNotFoundException ex) { throw new HistoryNotFoundException("GetPairBars", ex); } }