/// <summary> /// TradingSessionStatus message handler /// </summary> private void OnTradingSessionStatus(TradingSessionStatus message) { if (message.getRequestID() == _currentRequest) { // load instrument list into a dictionary var securities = message.getSecurities(); while (securities.hasMoreElements()) { var security = (TradingSecurity)securities.nextElement(); _fxcmInstruments[security.getSymbol()] = security; } // get account base currency _fxcmAccountCurrency = message.getParameter("BASE_CRNCY").getValue(); _mapRequestsToAutoResetEvents[_currentRequest].Set(); _mapRequestsToAutoResetEvents.Remove(_currentRequest); } }
/// <summary> /// TradingSessionStatus message handler /// </summary> private void OnTradingSessionStatus(TradingSessionStatus message) { if (message.getRequestID() == _currentRequest) { // load instrument list into a dictionary var securities = message.getSecurities(); while (securities.hasMoreElements()) { var security = (TradingSecurity)securities.nextElement(); _fxcmInstruments[security.getSymbol()] = security; } // create map from QuantConnect symbols to FXCM symbols foreach (var kvp in _fxcmInstruments) { var fxcmSymbol = kvp.Key; var tradingSecurity = kvp.Value; var symbol = ConvertSymbol(tradingSecurity); _mapInstrumentSymbols[symbol] = fxcmSymbol; } // get account base currency _fxcmAccountCurrency = message.getParameter("BASE_CRNCY").getValue(); _mapRequestsToAutoResetEvents[_currentRequest].Set(); _mapRequestsToAutoResetEvents.Remove(_currentRequest); // unsubscribe all instruments (only at first logon) if (_subscribedSymbols.Count == 0) { var request = new MarketDataRequest(); foreach (var fxcmSymbol in _fxcmInstruments.Keys) { request.addRelatedSymbol(_fxcmInstruments[fxcmSymbol]); } request.setSubscriptionRequestType(SubscriptionRequestTypeFactory.UNSUBSCRIBE); request.setMDEntryTypeSet(MarketDataRequest.MDENTRYTYPESET_ALL); _gateway.sendMessage(request); } } }
/// <summary> /// TradingSessionStatus message handler /// </summary> private void OnTradingSessionStatus(TradingSessionStatus message) { if (message.getRequestID() == _currentRequest) { // load instrument list into a dictionary var securities = message.getSecurities(); while (securities.hasMoreElements()) { var security = (TradingSecurity)securities.nextElement(); _fxcmInstruments[security.getSymbol()] = security; } // get account base currency _fxcmAccountCurrency = message.getParameter("BASE_CRNCY").getValue(); _mapRequestsToAutoResetEvents[_currentRequest].Set(); _mapRequestsToAutoResetEvents.Remove(_currentRequest); } }
/// <summary> /// TradingSessionStatus message handler /// </summary> private void OnTradingSessionStatus(TradingSessionStatus message) { if (message.getRequestID() == _currentRequest) { // load instrument list into a dictionary var securities = message.getSecurities(); while (securities.hasMoreElements()) { var security = (TradingSecurity)securities.nextElement(); _fxcmInstruments[security.getSymbol()] = security; } // create map from QuantConnect symbols to FXCM symbols foreach (var fxcmSymbol in _fxcmInstruments.Keys) { var symbol = ConvertFxcmSymbolToSymbol(fxcmSymbol); _mapInstrumentSymbols[symbol] = fxcmSymbol; } // get account base currency _fxcmAccountCurrency = message.getParameter("BASE_CRNCY").getValue(); _mapRequestsToAutoResetEvents[_currentRequest].Set(); _mapRequestsToAutoResetEvents.Remove(_currentRequest); // unsubscribe all instruments var request = new MarketDataRequest(); foreach (var fxcmSymbol in _fxcmInstruments.Keys) { request.addRelatedSymbol(_fxcmInstruments[fxcmSymbol]); } request.setSubscriptionRequestType(SubscriptionRequestTypeFactory.UNSUBSCRIBE); request.setMDEntryTypeSet(MarketDataRequest.MDENTRYTYPESET_ALL); _gateway.sendMessage(request); } }