public CryptoRtdServer() { _subMgr = new SubscriptionManager(); _socket = new GdaxWebSocketClient(new Uri("wss://ws-feed.gdax.com")); _binanceAdapter = new BinanceAdapter(_subMgr); }
// // Excel calls this when it wants to shut down RTD server. // void IRtdServer.ServerTerminate() { if (_timer != null) { _timer.Stop(); _timer = null; } if (_socket != null) { _socket.Disconnect(); _socket = null; } //_binanceViewModel = null; }
// // Excel calls this when it wants to shut down RTD server. // void IRtdServer.ServerTerminate() { if (_timer != null) { _timer.Stop(); _timer = null; } if (_socket != null) { _socket.Disconnect(); _socket = null; } if (_binanceAdapter != null) { _binanceAdapter.UnsubscribeAllStreams(); _binanceAdapter = null; } }
// // Excel calls this. It's an entry point. It passes us a callback // structure which we save for later. // int IRtdServer.ServerStart(IRtdUpdateEvent callback) { _callback = callback; // We will throttle out updates so that Excel can keep up. // It is also important to invoke the Excel callback notify // function from the COM thread. System.Windows.Threading' // DispatcherTimer will use COM thread's message pump. _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(33); // Make this fast _timer.Tick += TimerElapsed; _timer.Start(); // moved from constructor as this is a blocking call when network is down Task.Run(() => { _socket = new GdaxWebSocketClient(new Uri("wss://ws-feed.gdax.com")); _socket.Start(); _socket.MessageReceived += OnWebSocketMessageReceived; }); return(1); }