public void Dispose() { subscribeToBackContractCandles(false); subscribeToFrontContractCandles(false); subscribeToSpreadContractCandles(false); subscribeToFrontContractPrice(false); subscribeToSpreadContractPrice(false); subscribeToSyncPoint(false); m_bbgLive_candles_BackContract = null; m_bbgLive_candles_FrontContract = null; m_bbgLive_candles_spread = null; m_syncPoint = null; if (m_dayBeginMonitor != null) { m_dayBeginMonitor.Dispose(); m_dayBeginMonitor = null; } foreach (var monitor in m_monitors) monitor.Value.Dispose(); m_monitors.Clear(); }
private void subscribeToBbgLive() { var gmtStartTime = TimeZoneHelper.ConvertDateTime(DateTime.Now.AddMinutes(-1d).StartOfMinute(), TimeZoneInfo.Local, TimeZoneInfo.Utc); // need to subscribe to 3 things, the priorContract, the newContract, and the spread m_spreadTickerFormation = AttributeHelper.GetSingleAttribute<BbgContractAttribute>(Set).SpreadTickerFormation; // 1) back contract { var ticker = BackContractBloombergTicker(); m_bbgLive_candles_BackContract = BbgTalk.Core.Instance.GetLiveSecurityBarData( gmtStartTime_: gmtStartTime, ticker_: ticker, barWidthInMinutes_: 1); m_bbgLive_Price_BackContract = BbgTalk.Core.Instance.GetLiveSecurity(securityId_: ticker, fields_: new[] { BBG_LIVE_FIELD }, intervalInSeconds_: 2d); subscribeToBackContractCandles(); } // 2) front contract { var ticker = FrontContractBloombergTicker(); m_bbgLive_candles_FrontContract = BbgTalk.Core.Instance.GetLiveSecurityBarData( gmtStartTime_: gmtStartTime, ticker_: ticker, barWidthInMinutes_: 1); m_bbgLive_Price_FrontContract = BbgTalk.Core.Instance.GetLiveSecurity(securityId_: ticker, fields_: new[] { BBG_LIVE_FIELD }, intervalInSeconds_: 2d); subscribeToFrontContractCandles(); subscribeToFrontContractPrice(); } // 3) spread { var ticker = SpreadContractBbgTicker(m_spreadTickerFormation); m_bbgLive_candles_spread = BbgTalk.Core.Instance.GetLiveSecurityBarData( gmtStartTime_: gmtStartTime, ticker_: ticker, barWidthInMinutes_: 1); m_bbgLive_Price_Spread = BbgTalk.Core.Instance.GetLiveSecurity(securityId_: ticker, fields_: new[] { BBG_LIVE_FIELD }, intervalInSeconds_: 2d); } subscribeToSpreadContractCandles(); subscribeToSpreadContractPrice(); }