Пример #1
0
 /// <summary>
 /// This method calls the OnNotificationRecieved event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NotificationClient_OnReceive(object sender, Websocket.Events.MessageEventArg e)
 {
     if (isNotifiSubSuccess)
     {
         if (e.message.Contains("executions"))
         {
             var arg = new APIOrderExecNotificationRecievedArg();
             arg.time           = DateTime.Now;
             arg.OrderExecNotif = JsonToObject <ExecutionNotification>(e.message);
             OnOrderExecNotifRecieved(this, arg);
         }
         else if (!e.message.Contains("success"))
         {
             var arg = new APIOrderNotificationRecievedArg();
             arg.time       = DateTime.Now;
             arg.OrderNotif = JsonToObject <OrderNotification>(e.message);
             OnOrderNotifRecieved(this, arg);
         }
     }
     else
     {
         StreamResponse streamResponse = JsonToObject <StreamResponse>(e.message);
         if (streamResponse.success)
         {
             isNotifiSubSuccess = true;
         }
         else
         {
             ParseStreamErrorAndRaiseEvent(e.message);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// This method is called when websocket recieves a message and calls the OnStreamRecieved event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void quoteStreamClient_OnReceive(object sender, Websocket.Events.MessageEventArg e)
 {
     if (isQuoteStreamSuccess)
     {
         APIStreamQuoteRecievedArgs arg = new APIStreamQuoteRecievedArgs();
         arg.time = DateTime.Now;
         var message = e.message;
         arg.quotes = JsonToObject <Quotes>(message);
         OnQuoteStreamRecieved(this, arg);
     }
     else
     {
         StreamResponse streamResponse = JsonToObject <StreamResponse>(e.message);
         if (streamResponse.success)
         {
             isQuoteStreamSuccess = true;
         }
         else
         {
             ParseStreamErrorAndRaiseEvent(e.message);
         }
     }
 }
Пример #3
0
 private void quoteStreamClient_OnConnect(object sender, Websocket.Events.MessageEventArg e)
 {
     System.Diagnostics.Debug.WriteLine(e.message);
 }
Пример #4
0
 private void QuoteStreamClient_OnClose(object sender, Websocket.Events.MessageEventArg e)
 {
     isQuoteStreamSuccess = false;
     OnStreamDisconnect(this, e);
 }
Пример #5
0
 private void NotificationClient_OnClose(object sender, Websocket.Events.MessageEventArg e)
 {
     isNotifiSubSuccess = false;
     OnNotifDisconnect(this, e);
 }