private void Add(iExchange.Common.OverridedQuotation quotation) { lock (this._Lock) { try { decimal price = (this.HighBid && this.LowBid ? decimal.Parse(quotation.Bid) : (!this.HighBid && !this.LowBid ? decimal.Parse(quotation.Ask) : (decimal.Parse(quotation.Ask) + decimal.Parse(quotation.Bid)) / 2)); if (!this._InstrumentChartQuotations.ContainsKey(quotation.InstrumentID)) { this._InstrumentChartQuotations.Add(quotation.InstrumentID, new Dictionary<Guid, Dictionary<ChartType, ChartQuotation>>()); } Dictionary<Guid, Dictionary<ChartType, ChartQuotation>> quotePolicyChartQuotations = this._InstrumentChartQuotations[quotation.InstrumentID]; if (!quotePolicyChartQuotations.ContainsKey(quotation.QuotePolicyID)) { Dictionary<ChartType, ChartQuotation> chartQuotations = new Dictionary<ChartType, ChartQuotation>(); foreach (ChartType chartType in ChartQuotationManager._AllChartTypes) { chartQuotations.Add(chartType, new ChartQuotation(chartType, this.Round(chartType, quotation.Timestamp), quotation.InstrumentID, quotation.QuotePolicyID, price, price, price, price, 0)); } quotePolicyChartQuotations.Add(quotation.QuotePolicyID, chartQuotations); } else { Dictionary<ChartType, ChartQuotation> chartQuotations = quotePolicyChartQuotations[quotation.QuotePolicyID]; List<ChartQuotation> newChartQuotations = new List<ChartQuotation>(); foreach (ChartType chartType in ChartQuotationManager._AllChartTypes) { DateTime chartTime = this.Round(chartType, quotation.Timestamp); if (chartQuotations.ContainsKey(chartType)) { ChartQuotation latestChartQuotation = chartQuotations[chartType]; if (chartTime == latestChartQuotation.DateTime) { if (latestChartQuotation.High < price) latestChartQuotation.High = price; if (latestChartQuotation.Low > price) latestChartQuotation.Low = price; latestChartQuotation.Close = price; } else if (chartTime > latestChartQuotation.DateTime) { this._PendingSaveChartQuotations.Add(latestChartQuotation.Key, latestChartQuotation); chartQuotations[chartType] = new ChartQuotation(chartType, this.Round(chartType, chartTime), quotation.InstrumentID, quotation.QuotePolicyID, price, price, price, price, 0); } else { Manager.Common.Logger.TraceEvent(TraceEventType.Error, "QuotationServer\r\nChartQuotationManager.Add error: Timestamp should great or equal than last timestamp. {0}", quotation); //throw new ArgumentOutOfRangeException("quotation.Timestamp", "Timestamp should great or equal than last timestamp"); } } else { chartQuotations.Add(chartType, new ChartQuotation(chartType, this.Round(chartType, chartTime), quotation.InstrumentID, quotation.QuotePolicyID, price, price, price, price, 0)); } } } } catch (Exception exception) { Manager.Common.Logger.TraceEvent(TraceEventType.Error, "QuotationServer\r\nChartQuotationManager.Add error: {0}", exception); } } }
public List<OpenInterestSummary> GetOpenInterestOrderSummary(Guid accountId,iExchange.Common.AccountType accountType, Guid instrumentId, string[] blotterCodeSelecteds) { try { Token token = new Token(Guid.Empty, UserType.System, AppType.DealingConsole); Guid[] instruments = new Guid[] { instrumentId }; token.UserID = new Guid("525BBBC6-0E94-4991-BAC1-0CF1D31BBC17"); return this._StateServer.GetOpenInterestOrderSummary(token, accountId, accountType, instruments, blotterCodeSelecteds); } catch (Exception ex) { Logger.TraceEvent(TraceEventType.Error, "ExchangeSystem.GetOpenInterestOrderSummary Error:\r\n" + ex.ToString()); return null; } }
public void AddCommand(iExchange.Common.Token token, iExchange.Common.Command command) { CommandManager.Default.Send(command); }
public bool FixOverridedQuotationHistory(Token token, string quotation, bool needApplyAutoAdjustPoints, out iExchange.Common.OriginQuotation[] originQs, out iExchange.Common.OverridedQuotation[] overridedQs, out bool needBroadcastQuotation, out XmlNode fixChartDatas) { return this._QuotationServer.FixOverridedQuotationHistory(token, quotation, needApplyAutoAdjustPoints, out originQs, out overridedQs, out needBroadcastQuotation, out fixChartDatas); }