internal void CallCancelHistoricalData(HistoricalDataRequest request) { this.CancelHistoricalData(request); }
protected void EmitHistoricalDataError(HistoricalDataRequest request, string message) { this.provider.EmitHistoricalDataError(request, message); }
internal void CallRequestHistoricalData(HistoricalDataRequest request) { this.RequestHistoricalData(request); }
protected void EmitNewHistoricalBar(HistoricalDataRequest request, DateTime datetime, double open, double high, double low, double close, long volume) { this.provider.EmitHistoricalBar(request, datetime, open, high, low, close, volume); }
protected void EmitHistoricalDataCancelled(HistoricalDataRequest request) { this.provider.EmitHistoricalDataCancelled(request); }
protected void EmitNewHistoricalQuote(HistoricalDataRequest request, DateTime datetime, double bid, int bidSize, double ask, int askSize) { this.provider.EmitHistoricalQuote(request, datetime, bid, bidSize, ask, askSize); }
protected void EmitNewHistoricalTrade(HistoricalDataRequest request, DateTime datetime, double price, int size) { this.provider.EmitHistoricalTrade(request, datetime, price, size); }
///<summary> /// Override to cancel a historical data request ///</summary> protected virtual void CancelHistoricalData(HistoricalDataRequest request) {}
///<summary> /// Override to request a historical data ///</summary> protected virtual void RequestHistoricalData(HistoricalDataRequest request) { }
protected override void RequestHistoricalData(HistoricalDataRequest request) { if (!this.isConnected) this.EmitHistoricalDataError(request, "Provider is not connected"); else if (request.DataType == DataType.Quote) { this.EmitHistoricalDataError(request, "Only Trade, Bar and Daily"); } else { TransaqSecurity transaqSecurity1 = (TransaqSecurity) null; string symbol = request.Instrument.GetSymbol(this.name); if (this.selectedSecurity == SecuritySelector.seccode) { foreach (int index in this.securityBySecId.Keys) { TransaqSecurity transaqSecurity2 = this.securityBySecId[index]; if (transaqSecurity2.SecCode == symbol) { transaqSecurity1 = transaqSecurity2; break; } } } else if (this.selectedSecurity == SecuritySelector.seccode_board) { foreach (string index in this.securityBySCB.Keys) { TransaqSecurity transaqSecurity2 = this.securityBySCB[index]; if (transaqSecurity2.SecCodeBoard == symbol) { transaqSecurity1 = transaqSecurity2; break; } } } if (transaqSecurity1 == null) { this.EmitHistoricalDataError(request, string.Format("Unknown instrument {0} for get historical {1}", (object) symbol, (object) request.DataType)); } else { long num1 = -1L; long key = 86400L; long num2 = -1L; if (request.DataType == DataType.Daily) { if (this.candleKindByPeriod.ContainsKey(key)) { num1 = (long) this.candleKindByPeriod[key].Id; num2 = (long) Math.Ceiling((Clock.Now - request.BeginDate).TotalSeconds / (double) key); } else { this.EmitHistoricalDataError(request, string.Format("BarSize {0} second is unavailable", (object) key)); return; } } else if (request.DataType == DataType.Bar) { if (this.candleKindByPeriod.ContainsKey(request.BarSize)) { num1 = (long) this.candleKindByPeriod[request.BarSize].Id; num2 = (long) Math.Ceiling((Clock.Now - request.BeginDate).TotalSeconds / (double) request.BarSize); } else { this.EmitHistoricalDataError(request, string.Format("BarSize {0} second is unavailable", (object) num1)); return; } } if (this.selectedSecurity == SecuritySelector.seccode) { string str = string.Empty; string cmd; if (request.DataType == DataType.Trade) { cmd = string.Concat(new object[4] { (object) (str + "<command id=\"subscribe_ticks\">"), (object) "<security secid=\"", (object) transaqSecurity1.SecId, (object) "\" tradeno=\"1\"/>" }) + "</command>"; this.tickEndTimeBySecId.Add(transaqSecurity1.SecId, Clock.Now); } else cmd = str + (object) "<command id=\"gethistorydata\" secid=\"" + (string) (object) transaqSecurity1.SecId + "\" period=\"" + (string) (object) num1 + "\" count=\"" + (string) (object) num2 + "\" reset=\"true\"/>"; if (this.SendCommandLine(cmd).Success) this.hdrBySecId.Add(transaqSecurity1.SecId, request); else this.EmitHistoricalDataError(request, "Error in request"); } else { if (this.selectedSecurity != SecuritySelector.seccode_board) return; string str = string.Empty; string cmd; if (request.DataType == DataType.Trade) { cmd = str + "<command id=\"subscribe_ticks\">" + "<security><board>" + transaqSecurity1.Board + "</board><seccode>" + transaqSecurity1.SecCode + "</seccode></security>" + "<tradeno>1</tradeno>" + "</command>"; this.tickEndTimeBySCB.Add(transaqSecurity1.SecCodeBoard, Clock.Now); } else cmd = string.Concat(new object[4] { (object) string.Concat(new object[4] { (object) (str + "<command id=\"gethistorydata\">" + "<security><board>" + transaqSecurity1.Board + "</board><seccode>" + transaqSecurity1.SecCode + "</seccode></security>"), (object) "<period>", (object) num1, (object) "</period>" }), (object) "<count>", (object) num2, (object) "</count>" }) + "<reset>true</reset>" + "</command>"; if (this.SendCommandLine(cmd).Success) this.hdrBySCB.Add(transaqSecurity1.SecCodeBoard, request); else this.EmitHistoricalDataError(request, "Error in request"); } } } }