コード例 #1
0
        public void LastPrice(LastPriceViewModel Data, string Pair)
        {
            try
            {
                SignalRComm <LastPriceViewModel> CommonData = new SignalRComm <LastPriceViewModel>();
                CommonData.EventType    = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel);
                CommonData.Method       = Enum.GetName(typeof(enMethodName), enMethodName.Price);
                CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveLastPrice);
                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.Price;
                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;
            }
        }
コード例 #2
0
        public void OnVolumeChange(VolumeDataRespose volumeData, MarketCapData capData)
        {
            try
            {
                HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "Call OnVolumeChangeMethod : volumeData : " + JsonConvert.SerializeObject(volumeData) + " : Market Data : " + JsonConvert.SerializeObject(capData));
                if (volumeData != null && capData != null)
                {
                    LastPriceViewModel lastPriceData = new LastPriceViewModel();
                    lastPriceData.LastPrice = capData.LastPrice;
                    lastPriceData.UpDownBit = volumeData.UpDownBit;

                    string Base = volumeData.PairName.Split("_")[1];
                    PairData(volumeData, Base);
                    HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Pair Data Call Base :" + Base + "  DATA :" + JsonConvert.SerializeObject(volumeData));
                    MarketData(capData, volumeData.PairName);
                    HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Market Data Call Pair :" + volumeData.PairName + "  DATA :" + JsonConvert.SerializeObject(capData));
                    LastPrice(lastPriceData, volumeData.PairName);
                    HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Last price Call Pair :" + volumeData.PairName + "  DATA :" + JsonConvert.SerializeObject(lastPriceData));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
                //throw ex;
            }
        }
コード例 #3
0
        public async Task <IActionResult> LastPrice(string Data, String Pair)
        {
            string ReciveMethod = "";

            try
            {
                LastPriceViewModel temp = JsonConvert.DeserializeObject <LastPriceViewModel>(Data);
                SignalRComm <LastPriceViewModel> CommonData = new SignalRComm <LastPriceViewModel>();
                CommonData.EventType    = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel);
                CommonData.Method       = Enum.GetName(typeof(enMethodName), enMethodName.Price);
                CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveLastPrice);
                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.Price;
                SendData.Parameter = CommonData.Parameter;
                SendData.DataObj   = JsonConvert.SerializeObject(CommonData);

                await _mediator.Send(SendData);

                ReciveMethod = CommonData.ReturnMethod;
                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());
            }
        }