public void SellerBook(GetBuySellBook Data, string Pair) { try { SignalRComm <GetBuySellBook> CommonData = new SignalRComm <GetBuySellBook>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.SellerBook); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveSellerBook); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.Broadcast); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.PairName); CommonData.Data = Data; CommonData.Parameter = Pair; //SignalRDataSellerBook SendData = new SignalRDataSellerBook(); SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.SellerBook; 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; } }
public void ActivityNotification(string Msg, string Token) { try { SignalRComm <String> CommonData = new SignalRComm <String>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.ActivityNotification); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveNotification); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = Msg; CommonData.Parameter = null; //SignalRDataNotify SendData = new SignalRDataNotify(); SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.ActivityNotification; SendData.Parameter = Token; SendData.DataObj = JsonConvert.SerializeObject(CommonData); //SendData.WalletName = Wallet; HelperForLog.WriteLogIntoFile("ActivityNotification", ControllerName, " MSG :" + Msg); _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; } }
public void MarketTicker(VolumeDataRespose Data, string Base) { try { SignalRComm <VolumeDataRespose> CommonData = new SignalRComm <VolumeDataRespose>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.MarketTicker); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveMarketTicker); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.Broadcast); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.Base); CommonData.Data = Data; CommonData.Parameter = Base; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.MarketTicker; 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; } }
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()); } }
public void SellerSideWalletBal(WalletMasterResponse Data, string Wallet, string Token) { try { SignalRComm <WalletMasterResponse> CommonData = new SignalRComm <WalletMasterResponse>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.SellerSideWallet); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveSellerSideWalletBal); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = Data; CommonData.Parameter = null; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.SellerSideWallet; SendData.Parameter = Token; SendData.DataObj = JsonConvert.SerializeObject(CommonData); SendData.WalletName = Wallet; _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; } }
public async Task <IActionResult> ActivityNotification(string Data) { string ReciveMethod = ""; try { var accessToken = await HttpContext.GetTokenAsync("access_token"); SignalRComm <String> CommonData = new SignalRComm <String>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.ActivityNotification); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveNotification); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = Data; CommonData.Parameter = null; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.ActivityNotification; SendData.Parameter = accessToken; 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()); } }
public async Task <IActionResult> Announcement() { try { using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { string Content = await reader.ReadToEndAsync(); SignalRComm <string> CommonData = new SignalRComm <string>(); CommonData.Data = Content; CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.BroadCast); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.Announcement); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.BroadcastMessage); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.Broadcast); SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.Announcement; SendData.DataObj = JsonConvert.SerializeObject(CommonData); await _mediator.Send(SendData); return(Ok()); } } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); return(BadRequest()); } }
public async Task <IActionResult> TradeHistory(string Data) { string ReciveMethod = ""; try { var accessToken = await HttpContext.GetTokenAsync("access_token"); GetTradeHistoryInfo model = new GetTradeHistoryInfo(); model.TrnNo = 90; model.Type = "SELL"; model.Price = 1400; model.Amount = 1000; model.Total = 140000; model.DateTime = DateTime.UtcNow; model.Status = 1; model.StatusText = "Success"; model.PairName = "INR_BTC"; model.ChargeRs = 10; model.IsCancel = 0; GetTradeHistoryInfo temp = JsonConvert.DeserializeObject <GetTradeHistoryInfo>(Data); SignalRComm <GetTradeHistoryInfo> CommonData = new SignalRComm <GetTradeHistoryInfo>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.TradeHistory); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveTradeHistory); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = temp; CommonData.Parameter = null; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.TradeHistory; SendData.Parameter = accessToken;// 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()); } }
public async Task <IActionResult> PairData(string Data) { string ReciveMethod = ""; try { VolumeDataRespose model = new VolumeDataRespose(); model.ChangePer = 20; model.Currentrate = 1; model.High24Hr = 1814; model.High52Week = 1744; model.HighWeek = 1800; model.Low24Hr = 1812; model.Low52Week = 1725; model.LowWeek = 1700; model.PairId = 10021001; model.PairName = "INR_BTC"; model.UpDownBit = 0; model.Volume24 = 1406; VolumeDataRespose temp = JsonConvert.DeserializeObject <VolumeDataRespose>(Data); string a = temp.PairName.Split("_")[1]; SignalRComm <VolumeDataRespose> CommonData = new SignalRComm <VolumeDataRespose>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.PairData); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecievePairData); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.Base); CommonData.Data = temp; CommonData.Parameter = a; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.PairData; 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()); } }
public async Task <IActionResult> OpenOrder(string Data) { string ReciveMethod = ""; try { var accessToken = await HttpContext.GetTokenAsync("access_token"); ActiveOrderInfo model = new ActiveOrderInfo(); model.Id = 96; model.TrnDate = DateTime.UtcNow; model.Type = "BUY"; model.Order_Currency = "BTC"; model.Delivery_Currency = "LTC"; model.Amount = 100; model.Price = 1400; model.IsCancelled = 1; model.PairName = "INR_BTC"; model.PairId = 10021001; ActiveOrderInfo temp = JsonConvert.DeserializeObject <ActiveOrderInfo>(Data); SignalRComm <ActiveOrderInfo> CommonData = new SignalRComm <ActiveOrderInfo>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.OpenOrder); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveOpenOrder); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = temp; CommonData.Parameter = null; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.OpenOrder; SendData.Parameter = accessToken;// 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()); } }
public async Task <IActionResult> SellerSideWalletBal(string Data) { string ReciveMethod = ""; try { var accessToken = await HttpContext.GetTokenAsync("access_token"); WalletMasterResponse model = new WalletMasterResponse(); model.WalletName = "LTC Default"; model.AccWalletID = "1053841474000201"; model.Balance = 201200; model.CoinName = "LTC"; model.IsDefaultWallet = 1; model.PublicAddress = ""; WalletMasterResponse temp = JsonConvert.DeserializeObject <WalletMasterResponse>(Data); SignalRComm <WalletMasterResponse> CommonData = new SignalRComm <WalletMasterResponse>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.SellerSideWallet); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveSellerSideWalletBal); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = temp; CommonData.Parameter = null; SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.SellerSideWallet; SendData.Parameter = accessToken;// CommonData.Parameter; SendData.DataObj = JsonConvert.SerializeObject(CommonData); SendData.WalletName = temp.CoinName; 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()); } }
private void DoWork(object state) { //_logger.LogInformation("Timed Background Service is working."); SignalRComm <string> CommonData = new SignalRComm <string>(); CommonData.Data = Helpers.GetUTCTime(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.BroadCast); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.Time); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.SetTime); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.Broadcast); SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.Time; SendData.DataObj = JsonConvert.SerializeObject(CommonData); _mediator.Send(SendData).Wait(); //return Task.CompletedTask; }
public async Task ServiceEndpointsNotSet() { var rootHubContextMock = new Mock <ServiceHubContext>().As <IInternalServiceHubContext>(); var childHubContextMock = new Mock <ServiceHubContext>().As <IInternalServiceHubContext>(); rootHubContextMock.Setup(c => c.WithEndpoints(It.IsAny <ServiceEndpoint[]>())).Returns(childHubContextMock.Object); rootHubContextMock.Setup(c => c.Clients.All.SendCoreAsync(It.IsAny <string>(), It.IsAny <object[]>(), It.IsAny <CancellationToken>())).Returns(Task.CompletedTask); var serviceManagerStore = Mock.Of <IServiceManagerStore>(s => s.GetOrAddByConnectionStringKey(It.IsAny <string>()).GetAsync(It.IsAny <string>()) == new ValueTask <IServiceHubContext>(rootHubContextMock.Object)); var azureSignalRClient = new AzureSignalRClient(serviceManagerStore, "key", "hub"); var data = new SignalRData { Target = "target", Arguments = new object[] { "arg1" } }; await azureSignalRClient.SendToAll(data); rootHubContextMock.Verify(c => c.Clients.All.SendCoreAsync(data.Target, data.Arguments, default), Times.Once); childHubContextMock.Verify(c => c.Clients.All.SendCoreAsync(It.IsAny <string>(), It.IsAny <object[]>(), It.IsAny <CancellationToken>()), Times.Never); }
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()); } }
public async Task <IActionResult> MarketData(string Data, String Pair) { string ReciveMethod = ""; try { MarketCapData model = new MarketCapData(); model.Change24 = 1; model.ChangePer = 3; model.High24 = 1153; model.Low24 = 1125; model.LastPrice = 1137; model.Volume24 = 253; MarketCapData temp = JsonConvert.DeserializeObject <MarketCapData>(Data); SignalRComm <MarketCapData> CommonData = new SignalRComm <MarketCapData>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.MarketData); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveMarketData); 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.MarketData; SendData.Parameter = CommonData.Parameter; SendData.DataObj = JsonConvert.SerializeObject(CommonData); await _mediator.Send(SendData); ReciveMethod = "RecieveMarketData"; 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()); } }