private void objIndicesBowBroadCastProcessor_OnBroadCastRecievedNew(IdicesDetailsMain obj) { if (obj != null && ObjMinIndicesCollection.Count > 0) { foreach (var item in BroadcastMasterMemory.indicesDataDict) { int?index; index = ObjMinIndicesCollection.Where(i => i.IndexCode == item.Value.code).Select(x => ObjMinIndicesCollection.IndexOf(x)).FirstOrDefault(); if (index != null) { ObjMinIndicesCollection[(int)index].IndexValue = Convert.ToDouble(item.Value.value); ObjMinIndicesCollection[(int)index].perChange = Convert.ToString(item.Value.chngValue); if (item.Value.chngValue >= 0) { ObjMinIndicesCollection[(int)index].PrevLTP1 = "Blue"; setColor = "Blue"; } else if (item.Value.chngValue < 0) { ObjMinIndicesCollection[(int)index].PrevLTP1 = "OrangeRed"; setColor = "Red"; } else { ObjMinIndicesCollection[(int)index].PrevLTP1 = "Blue"; setColor = "Blue"; } } } } }
internal static void objIndicesBroadCastProcessor_OnBroadCastRecievedNew(IdicesDetailsMain objIndexMain) { try { if (SelectedExchange == Enumerations.Order.Exchanges.BSE.ToString()) { if (objIndexMain != null && ObjIndicesCollection.Count > 0) { IdicesDetailsMain item = objIndexMain; //foreach (var item in objIndexMain.listindMain) { int?index = null; if (ObjIndicesCollection.Any(x => x.IndexCode == item.IndexCode)) { index = ObjIndicesCollection.Where(i => i.IndexCode == item.IndexCode).Select(x => ObjIndicesCollection.IndexOf(x)).FirstOrDefault(); } if (index != null) { ObjIndicesCollection[(int)index].IndexValue = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].IndexValue / Math.Pow(10, 2); ObjIndicesCollection[(int)index].IndexHigh = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].IndexHigh / Math.Pow(10, 2); ObjIndicesCollection[(int)index].IndexLow = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].IndexLow / Math.Pow(10, 2); ObjIndicesCollection[(int)index].IndexOpen = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].IndexOpen / Math.Pow(10, 2); ObjIndicesCollection[(int)index].PreviousIndexClose = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].PreviousIndexClose / Math.Pow(10, 2); if (ObjIndicesCollection[(int)index].IndexValue != 0 && ObjIndicesCollection[(int)index].PreviousIndexClose != 0) { if (Math.Round(Convert.ToDouble((ObjIndicesCollection[(int)index].IndexValue - ObjIndicesCollection[(int)index].PreviousIndexClose) / ObjIndicesCollection[(int)index].PreviousIndexClose * 100), 2) > 0) { ObjIndicesCollection[(int)index].perChange = string.Format("{0}{1}", "+", Math.Round(Convert.ToDouble((ObjIndicesCollection[(int)index].IndexValue - ObjIndicesCollection[(int)index].PreviousIndexClose) / ObjIndicesCollection[(int)index].PreviousIndexClose * 100), 2).ToString("0.00")); //ColorFont = "Red"; } else { ObjIndicesCollection[(int)index].perChange = string.Format("{0}", Math.Round(Convert.ToDouble((ObjIndicesCollection[(int)index].IndexValue - ObjIndicesCollection[(int)index].PreviousIndexClose) / ObjIndicesCollection[(int)index].PreviousIndexClose * 100), 2).ToString("0.00")); } } //ObjIndicesCollection[(int)index].chngInValue = SharedMemories.BroadcastMasterMemory.objIndexDetailsConDict[item.IndexCode].IndexChangeValue; if (ObjIndicesCollection[(int)index].IndexValue != 0 && ObjIndicesCollection[(int)index].PreviousIndexClose != 0) { ObjIndicesCollection[(int)index].chngInValue = $"{ObjIndicesCollection[(int)index].IndexValue - ObjIndicesCollection[(int)index].PreviousIndexClose:0.00}"; } } } // NotifyStaticPropertyChanged(nameof(ObjIndicesCollection)); } } } catch (Exception ex) { ExceptionUtility.LogError(ex); } }
private void objIndicesBroadCastProcessor_OnBroadCastRecievedNew(IdicesDetailsMain obj) { if (selectedExchange == Common.Enumerations.Exchange.BSE.ToString()) { if (obj != null && ObjMinIndicesCollection.Count > 0) { IdicesDetailsMain item = obj; //foreach (var item in obj.listindMain) { //int? index; int count = ObjMinIndicesCollection.Count; for (int i = 0; i < count; i++) { if (ObjMinIndicesCollection[i].IndexCode == item.IndexCode) { ObjMinIndicesCollection[(int)i].IndexValue = item.IndexValue / Math.Pow(10, 2); ObjMinIndicesCollection[(int)i].PreviousIndexClose = item.PreviousIndexClose / Math.Pow(10, 2); if (ObjMinIndicesCollection[(int)i].IndexValue != 0 && ObjMinIndicesCollection[(int)i].PreviousIndexClose != 0) { if (Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)i].IndexValue - ObjMinIndicesCollection[(int)i].PreviousIndexClose) / ObjMinIndicesCollection[(int)i].PreviousIndexClose * 100), 2) > 0) { ObjMinIndicesCollection[(int)i].perChange = string.Format("{0}{1} {2}", "+", Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)i].IndexValue - ObjMinIndicesCollection[(int)i].PreviousIndexClose) / ObjMinIndicesCollection[(int)i].PreviousIndexClose * 100), 2).ToString("0.00"), "%"); } else { ObjMinIndicesCollection[(int)i].perChange = string.Format("{0} {1}", Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)i].IndexValue - ObjMinIndicesCollection[(int)i].PreviousIndexClose) / ObjMinIndicesCollection[(int)i].PreviousIndexClose * 100), 2).ToString("0.00"), "%"); } } TrendDiff = ObjMinIndicesCollection[(int)i].IndexValue - ObjMinIndicesCollection[(int)i].PreviousIndexClose; if (TrendDiff > 0) { ObjMinIndicesCollection[(int)i].PrevLTP1 = "Blue"; ObjMinIndicesCollection[(int)i].ChangeInValue = string.Format("{0}{1:0.00}", "+", TrendDiff); setColor = "Blue"; } else if (TrendDiff < 0) { ObjMinIndicesCollection[(int)i].PrevLTP1 = "OrangeRed"; ObjMinIndicesCollection[(int)i].ChangeInValue = string.Format("{0:0.00}", TrendDiff); setColor = "Red"; } else { ObjMinIndicesCollection[(int)i].PrevLTP1 = "Blue"; ObjMinIndicesCollection[(int)i].ChangeInValue = string.Format("{0:0.00}", TrendDiff); setColor = "Blue"; } } } //index = k; //index = ObjMinIndicesCollection.Where(i => i.IndexCode == item.IndexCode).Select(x => ObjMinIndicesCollection.IndexOf(x)).FirstOrDefault(); //if (index != null) //{ // //ObjMinIndicesCollection[(int)index].IndexId = item.IndexId; // ObjMinIndicesCollection[(int)index].IndexValue = item.IndexValue / Math.Pow(10, 2); // ObjMinIndicesCollection[(int)index].PreviousIndexClose = item.PreviousIndexClose / Math.Pow(10, 2); // if (ObjMinIndicesCollection[(int)index].IndexValue != 0 && ObjMinIndicesCollection[(int)index].PreviousIndexClose != 0) // if (Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)index].IndexValue - ObjMinIndicesCollection[(int)index].PreviousIndexClose) / ObjMinIndicesCollection[(int)index].PreviousIndexClose * 100), 2) > 0) // ObjMinIndicesCollection[(int)index].perChange = string.Format("{0}{1} {2}", "+", Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)index].IndexValue - ObjMinIndicesCollection[(int)index].PreviousIndexClose) / ObjMinIndicesCollection[(int)index].PreviousIndexClose * 100), 2).ToString("0.00"), "%"); // else // ObjMinIndicesCollection[(int)index].perChange = string.Format("{0} {1}", Math.Round(Convert.ToDouble((ObjMinIndicesCollection[(int)index].IndexValue - ObjMinIndicesCollection[(int)index].PreviousIndexClose) / ObjMinIndicesCollection[(int)index].PreviousIndexClose * 100), 2).ToString("0.00"), "%"); // //ObjMinIndicesCollection[(int)index].perChange = Math.Round((ObjMinIndicesCollection[(int)index].IndexValue - ObjMinIndicesCollection[(int)index].PreviousIndexClose) / ObjMinIndicesCollection[(int)index].PreviousIndexClose * 100, 2); //} } } } //var IndexCode = MasterSharedMemory.objMasterDicSyb.Where(x => x.Value.IndexID == selectedIndex).Select(z => z.Key).FirstOrDefault(); //if (BroadcastMaster.BroadcastMasterMemory.objIndicesDetailsConDict.ContainsKey(IndexCode)) //{ // ObjMinIndicesCollection[IndexCode].IndexId = BroadcastMaster.BroadcastMasterMemory.objIndicesDetailsConDict[IndexCode].IndexId; // ObjMinIndicesCollection[IndexCode].IndexValue = BroadcastMaster.BroadcastMasterMemory.objIndicesDetailsConDict[IndexCode].IndexValue; // ObjMinIndicesCollection[IndexCode].perChange = Math.Round((ObjMinIndicesCollection[IndexCode].IndexValue - ObjMinIndicesCollection[IndexCode].PreviousIndexClose) / ObjMinIndicesCollection[IndexCode].PreviousIndexClose * 100, 2); //} }