private void LoadTFEXInfomation() { try { string text = ApplicationInfo.WebServiceTFEX.TFEXInformation(); if (!string.IsNullOrEmpty(text)) { using (DataSet dataSet = new DataSet()) { MyDataHelper.StringToDataSet(text, dataSet); if (dataSet.Tables.Contains("Info") && dataSet.Tables["Info"].Rows.Count > 0) { ApplicationInfo.SeriesInfo.ResetData(); foreach (DataRow dataRow in dataSet.Tables["Info"].Rows) { SeriesList.SeriesInformation seriesInformation = new SeriesList.SeriesInformation(); seriesInformation.Symbol = dataRow["sSeries"].ToString(); int num; int.TryParse(dataRow["lOrderBookId"].ToString(), out num); seriesInformation.OrderBookId = num; int.TryParse(dataRow["lUndOrderBookId"].ToString(), out num); seriesInformation.UnderOrderBookId = num; decimal num2; decimal.TryParse(dataRow["nmrCeiling"].ToString(), out num2); seriesInformation.Ceiling = num2; decimal.TryParse(dataRow["nmrFloor"].ToString(), out num2); seriesInformation.Floor = num2; decimal.TryParse(dataRow["nmrFixPrice"].ToString(), out num2); seriesInformation.FixPrice = num2; decimal.TryParse(dataRow["nmrPrevFixPrice"].ToString(), out num2); seriesInformation.PrevFixPrice = num2; int.TryParse(dataRow["iMarketNo"].ToString(), out num); seriesInformation.MarketCode = num; int.TryParse(dataRow["iSymbolTypeNo"].ToString(), out num); seriesInformation.Group = num; decimal.TryParse(dataRow["nmrContractSize"].ToString(), out num2); seriesInformation.ContractSize = num2; seriesInformation.ExpireDate = dataRow["sExpDate"].ToString(); int.TryParse(dataRow["iOpenBalance"].ToString(), out num); seriesInformation.OpenInt = num; decimal.TryParse(dataRow["nmrStrike"].ToString(), out num2); seriesInformation.StrikPrice = num2; decimal.TryParse(dataRow["nmrPrice"].ToString(), out num2); seriesInformation.LastSalePrice = num2; decimal.TryParse(dataRow["tickSize"].ToString(), out num2); seriesInformation.TickSize = num2; seriesInformation.SeriesType = dataRow["seriesType"].ToString(); int numOfDec = 0; int.TryParse(dataRow["iDecPrice"].ToString(), out numOfDec); seriesInformation.NumOfDec = numOfDec; seriesInformation.MarketId = dataRow["sMarketId"].ToString().Trim(); ApplicationInfo.SeriesInfo.AddItem(seriesInformation); } } if (dataSet.Tables.Contains("MarketInfo") && dataSet.Tables["MarketInfo"].Rows.Count > 0) { foreach (DataRow dataRow in dataSet.Tables["MarketInfo"].Rows) { long num3; long.TryParse(dataRow["TotVolume"].ToString(), out num3); long num4; long.TryParse(dataRow["TotDeal"].ToString(), out num4); long num5; long.TryParse(dataRow["oi"].ToString(), out num5); if (dataRow["iSymbolTypeNo"].ToString() == "1") { ApplicationInfo.IndexInfoTfex.OptionsVol += num3; ApplicationInfo.IndexInfoTfex.OptionsOI += num5; ApplicationInfo.IndexInfoTfex.TfexTotalDeal += num4; } else if (dataRow["iSymbolTypeNo"].ToString() == "2") { ApplicationInfo.IndexInfoTfex.OptionsVol += num3; ApplicationInfo.IndexInfoTfex.OptionsOI += num5; ApplicationInfo.IndexInfoTfex.TfexTotalDeal += num4; } else { ApplicationInfo.IndexInfoTfex.FutureVol = num3; ApplicationInfo.IndexInfoTfex.FutureOI = num5; ApplicationInfo.IndexInfoTfex.TfexTotalDeal += num4; } } ApplicationInfo.IndexInfoTfex.TfexTotalVol = ApplicationInfo.IndexInfoTfex.FutureVol + ApplicationInfo.IndexInfoTfex.OptionsVol; ApplicationInfo.IndexInfoTfex.TfexTotalOI = ApplicationInfo.IndexInfoTfex.FutureOI + ApplicationInfo.IndexInfoTfex.OptionsOI; } if (dataSet.Tables.Contains("UnderlyingInfo") && dataSet.Tables["UnderlyingInfo"].Rows.Count > 0) { ApplicationInfo.UnderlyingInfo.ResetData(); foreach (DataRow dataRow in dataSet.Tables["UnderlyingInfo"].Rows) { UnderlyingInfo.UnderlyingList underlyingList = new UnderlyingInfo.UnderlyingList(); int num; int.TryParse(dataRow["lOrderBookId"].ToString(), out num); underlyingList.OrderBookId = num; underlyingList.Symbol = dataRow["sSymbol"].ToString().Trim(); ApplicationInfo.UnderlyingInfo.AddItem(underlyingList); } } if (ApplicationInfo.BrokerId == 4 && ApplicationInfo.IsSupportTfex) { BBOTFEXCurrency bBOTFEXCurrency = new BBOTFEXCurrency(); bBOTFEXCurrency.CurrencyName = "USD"; bBOTFEXCurrency.BidPrice = 0m; bBOTFEXCurrency.AskPrice = 0m; bBOTFEXCurrency.LastTime = "00:00:00"; bBOTFEXCurrency.LastDate = "01 January 2000"; ApplicationInfo.IndexInfoTfex.BBOCurrency.Add(bBOTFEXCurrency.CurrencyName, bBOTFEXCurrency); bBOTFEXCurrency = new BBOTFEXCurrency(); bBOTFEXCurrency.CurrencyName = "THB"; bBOTFEXCurrency.BidPrice = 0m; bBOTFEXCurrency.AskPrice = 0m; bBOTFEXCurrency.LastTime = "00:00:00"; bBOTFEXCurrency.LastDate = "01 January 2000"; ApplicationInfo.IndexInfoTfex.BBOCurrency.Add(bBOTFEXCurrency.CurrencyName, bBOTFEXCurrency); } dataSet.Clear(); } } } catch (Exception ex) { throw ex; } }
private void bgwGold_DoWork(object sender, DoWorkEventArgs e) { try { if (this._goldUpdateLastTime.AddSeconds(60.0) <= DateTime.Now) { string goldSpot = ApplicationInfo.WebServiceTFEX.GetGoldSpot(); string[] array = goldSpot.Split(new char[] { ';' }); decimal num = 0m; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i]; string[] array3 = text.Split(new char[] { '=' }); if (array3.Length > 1) { if (array3[0].ToString() == "BidUSD") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["USD"]; decimal.TryParse(array3[1].ToString(), out num); this._goldSpotValue.BidPrice = num; } else if (array3[0].ToString() == "OfferUSD") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["USD"]; decimal.TryParse(array3[1].ToString(), out num); this._goldSpotValue.AskPrice = num; } else if (array3[0].ToString() == "BidTHB") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["THB"]; decimal.TryParse(array3[1].ToString(), out num); this._goldSpotValue.BidPrice = num; } else if (array3[0].ToString() == "OfferTHB") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["THB"]; decimal.TryParse(array3[1].ToString(), out num); this._goldSpotValue.AskPrice = num; } else if (array3[0].ToString() == "Date") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["THB"]; this._goldSpotValue.LastDate = this.GetDateString(array3[1].ToString()); this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["USD"]; this._goldSpotValue.LastDate = this.GetDateString(array3[1].ToString()); } else if (array3[0].ToString() == "Time") { this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["THB"]; this._goldSpotValue.LastTime = array3[1].ToString(); this._goldSpotValue = ApplicationInfo.IndexInfoTfex.BBOCurrency["USD"]; this._goldSpotValue.LastTime = array3[1].ToString(); } } } this._goldUpdateLastTime = DateTime.Now; } } catch (Exception ex) { this.ShowError("GetGoldSpot", ex); } }