private void OnCryptoAgg(CryptoAggregate cryptoAgg) { string Text; if (IsJSONTextMode) { Text = JsonConvert.SerializeObject(cryptoAgg); } else { Text = $"Trade: Pair: {cryptoAgg.pair}, " + $"Open: {cryptoAgg.o}, Open Exchange: {cryptoAgg.ox}, " + $"High: {cryptoAgg.h}, High Exchange: {cryptoAgg.hx}, " + $"Low: {cryptoAgg.l}, Low Exchange: {cryptoAgg.lx}, " + $"Close: {cryptoAgg.cl}, Close Exchange: {cryptoAgg.cx}, " + $"Volume: {cryptoAgg.v}, " + $"Tick Start: {PGBase.UnixTimestampMillisToESTDateTime( cryptoAgg.s )} EST" + $"Tick End: {PGBase.UnixTimestampMillisToESTDateTime( cryptoAgg.e )} EST"; } AppendText(Text); }
internal void OnCryptoAgg(CryptoAggregate cryptoAgg) { }
// =====>>>>>>>>>> JSONText Message Received public override void OnWebSocketJSONText(string JSONText) { try { string ObjJSONText; List <object> PGBaseList = JsonConvert.DeserializeObject <List <object> >(JSONText); foreach (var PGBase in PGBaseList) { ObjJSONText = PGBase.ToString(); PolygonBase pGBase = JsonConvert.DeserializeObject <PolygonBase>(ObjJSONText); switch (pGBase.ev) { case "XQ": CryptoQuote quote = JsonConvert.DeserializeObject <CryptoQuote>(ObjJSONText); if (quote != null) { OnCryptoQuoteEvent?.Invoke(quote); } break; case "XT": CryptoTrade trade = JsonConvert.DeserializeObject <CryptoTrade>(ObjJSONText); if (trade != null) { OnCryptoTradeEvent?.Invoke(trade); } break; case "XA": CryptoAggregate cryptoAgg = JsonConvert.DeserializeObject <CryptoAggregate>(ObjJSONText); if (cryptoAgg != null) { OnCryptoAggEvent?.Invoke(cryptoAgg); } break; case "XS": CryptoSIP CryptoSIPRef = JsonConvert.DeserializeObject <CryptoSIP>(ObjJSONText); if (CryptoSIPRef != null) { OnCryptoSIPEvent?.Invoke(CryptoSIPRef); } break; case "XL2": CryptoLevel2 cryptoLevel2 = JsonConvert.DeserializeObject <CryptoLevel2>(ObjJSONText); if (cryptoLevel2 != null) { OnCryptoLevel2Event?.Invoke(cryptoLevel2); } break; case "status": Status StatusIn = JsonConvert.DeserializeObject <Status>(ObjJSONText); HandleStatusMessage(StatusIn); break; default: break; } } } catch (System.Exception ex) { HandleJSONTextException("websocket_MessageReceived", JSONText, ex); } }