Esempio n. 1
0
        public void OnEvent(string exchangeName, BrokerEvent what, string details)
        {
            _globalLogger.Log(LogPriority.Info, $"OnEvent : {what.ToString()} : {details}", exchangeName);

            if (what == BrokerEvent.ConnectorStarted && _marketList.Where(r => r.Value.Name == exchangeName).Count() == 0)
            {
                foreach (var symbol in _symbolList.Where(item => item.Exchange == exchangeName))
                {
                    try
                    {
                        dataGridView.Invoke(new Action(() =>
                        {
                            symbol.Symbol = $"{symbol.First.ToUpper()}/{symbol.Second.ToUpper()}";

                            _marketList.Add(symbol.Id(), new MarketBookResponse()
                            {
                                Type      = GetType(exchangeName),
                                Name      = exchangeName,
                                Coin      = symbol,
                                isUpdated = false,
                                Book      = new MarketBook()
                            });
                            dataGridView.RowCount = _marketList.Count;
                        }));

                        var  client = _mc.clientList.First(z => z.Name == exchangeName);
                        Task t      = client.Subscribe(symbol, SubscriptionModel.TopBook);
                        t.Wait();
                    }
                    catch (Exception ex)
                    {
                        _globalLogger.Log(LogPriority.Error, $"OnEvent : {ex.Message}");
                    }
                }
            }
        }
Esempio n. 2
0
 public void OnEvent(string exchangeName, BrokerEvent what, string details)
 {
     _logger.Log(LogPriority.Debug, $"Broker({exchangeName}) Event | {what.ToString()} - {details}");
 }