Exemple #1
0
        public void ChartData(GetGraphDetailInfo Data, string Pair)
        {
            try
            {
                SignalRComm <GetGraphDetailInfo> CommonData = new SignalRComm <GetGraphDetailInfo>();
                CommonData.EventType    = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel);
                CommonData.Method       = Enum.GetName(typeof(enMethodName), enMethodName.ChartData);
                CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveChartData);
                CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.Broadcast);
                CommonData.ParamType    = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.PairName);
                CommonData.Data         = Data;
                CommonData.Parameter    = Pair;

                SignalRData SendData = new SignalRData();
                SendData.Method    = enMethodName.ChartData;
                SendData.Parameter = CommonData.Parameter;
                SendData.DataObj   = JsonConvert.SerializeObject(CommonData);
                _mediator.Send(SendData);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
                //throw ex;
            }
        }
Exemple #2
0
 public async Task ChartDataEveryLastMin(DateTime DateTime)
 {
     try
     {
         List <GetGraphResponsePairWise> GraphResponsesList = new List <GetGraphResponsePairWise>();
         GraphResponsesList = _frontTrnRepository.GetGraphDataEveryLastMin(DateTime.ToString("yyyy-MM-dd HH:mm:00:000"));
         foreach (GetGraphResponsePairWise GraphData in GraphResponsesList)
         {
             GetGraphDetailInfo GraphDetailInfo = new GetGraphDetailInfo();
             GraphDetailInfo.Close = GraphData.CloseVal;
             GraphDetailInfo.High  = GraphData.High;
             GraphDetailInfo.Open  = GraphData.OpenVal;
             GraphDetailInfo.Low   = GraphData.Low;
             DateTime dt2 = new DateTime(1970, 1, 1);
             GraphDetailInfo.DataDate = Convert.ToInt64(GraphData.DataDate.Subtract(dt2).TotalMilliseconds);
             GraphDetailInfo.Volume   = GraphData.Volume;
             GraphDetailInfo.Close    = GraphData.CloseVal;
             ChartData(GraphDetailInfo, GraphData.PairName);
         }
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
         //throw ex;
     }
 }
        public async Task <IActionResult> ChartData(string Data, String Pair)
        {
            string ReciveMethod = "";

            try
            {
                GetGraphResponse model = new GetGraphResponse();
                //model.ChangePer = 20;
                //model.DataDate = 20180203073000;
                //model.High = 1199;
                //model.Low = 1177;
                //model.OpenVal = 1452;
                //model.TodayOpen = 1477;
                //model.Volume = 173;

                GetGraphDetailInfo temp = JsonConvert.DeserializeObject <GetGraphDetailInfo>(Data);

                SignalRComm <GetGraphDetailInfo> CommonData = new SignalRComm <GetGraphDetailInfo>();
                CommonData.EventType    = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel);
                CommonData.Method       = Enum.GetName(typeof(enMethodName), enMethodName.ChartData);
                CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveChartData);
                CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne);
                CommonData.ParamType    = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.PairName);
                CommonData.Data         = temp;
                CommonData.Parameter    = Pair;// "INR_BTC";

                SignalRData SendData = new SignalRData();
                SendData.Method    = enMethodName.ChartData;
                SendData.Parameter = CommonData.Parameter;
                SendData.DataObj   = JsonConvert.SerializeObject(CommonData);
                await _mediator.Send(SendData);

                ReciveMethod = "RecieveChartData";
                return(Ok(new { ReciveMethod = ReciveMethod }));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);

                return(Ok());
            }
        }