// // 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.FromSeconds(0.5); _timer.Tick += TimerElapsed; _timer.Start(); _socket.Open(); _socket.Opened += (s, e) => { dynamic j = new JObject(); j.type = "subscribe"; j.channels = new JArray("heartbeat"); j.product_ids = new JArray("BTC-USD"); _socket.Send(j.ToString()); }; _socket.MessageReceived += OnWebSocketMessageReceived; return(1); }
public static void Main(string[] args) { var me = new Program(); IRtdUpdateEvent me2 = me; //me2.HeartbeatInterval = 15; // is this seconds or milliseconds? me.Run(); }
public static void Main(string[] args) { var me = new Program(); IRtdUpdateEvent me2 = me; me2.HeartbeatInterval = 100; me.Run(); }
// 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(50); // this needs to be very frequent _timer.Tick += TimerElapsed; _timer.Start(); return(1); }
// // 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); }
// Excel calls this. It's an entry point. It passes us a callback // structure which we save for later. int IRtdServer.ServerStart(IRtdUpdateEvent callback) { _isExcelNotifiedOfUpdates = false; _callback = callback; _subMgr = new SubscriptionManager(() => { if (!_isExcelNotifiedOfUpdates) { lock (_notifyLock) // do this before calling updateNotify _isExcelNotifiedOfUpdates = true; // so next update will reset this to FALSE even if excel has NOT called RefreshData if (_callback != null) { _callback.UpdateNotify(); } } }); _startTime = DateTime.Now.ToLocalTime(); return(1); }
// // 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(); _socket.Start(); _socket.MessageReceived += OnWebSocketMessageReceived; //_binanceViewModel.Init(); return(1); }
// 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; _subMgr = new SubscriptionManager(() => { try { if (_callback != null) { if (!_isExcelNotifiedOfUpdates) { lock (_notifyLock) { _callback.UpdateNotify(); _isExcelNotifiedOfUpdates = true; } } } } catch (Exception ex) // HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER { Console.WriteLine(ex.Message); } }); return(1); }
// 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; _subMgr = new SubscriptionManager(() => { try { if (_callback != null) { if (!_isExcelNotifiedOfUpdates) { lock (_notifyLock) { _callback.UpdateNotify(); _isExcelNotifiedOfUpdates = true; } } } } catch (Exception ex) // HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER { Console.WriteLine(ex.Message); } }); // 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. DispatcherTimer dispatcherTimer = new DispatcherTimer(); _timer = dispatcherTimer; _timer.Interval = TimeSpan.FromMilliseconds(95); // this needs to be very frequent _timer.Tick += TimerElapsed; _timer.Start(); return(1); }
// Excel calls this when it wants to shut down RTD server. void IRtdServer.ServerTerminate() { _callback = null; }
// Excel calls this when it wants to shut down RTD server. void IRtdServer.ServerTerminate() { //_subMgr.UnsubscribeAll(); _callback = null; }