/** * Envia a mensagem FIX de SecurityListRequest, solicitando a lista de * todos os instrumentos do sinal de difusão BM&F. * */ private void solicitaListaInstrumentos() { SecurityListRequest mensagemFIX = new SecurityListRequest(); mensagemFIX.setField( new SecurityReqID(sessao.getSenderCompID())); mensagemFIX.setField( new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES)); mensagemFIX.setField( new SecurityListRequestType(SecurityListRequestType.ALL_SECURITIES)); mensagemFIX.getHeader().setField( new SenderCompID(sessao.getSenderCompID())); mensagemFIX.getHeader().setField( new TargetCompID(sessao.getTargetCompID())); try { logger.Info("Requisita lista de todos os instrumentos"); Session.sendToTarget(mensagemFIX, sessao); } catch (SessionNotFound e) { logger.Error("Sessao invalida: " + e.Message); } }
public void onLogon(SessionID sessionID) { if (onSessionLogon != null) { onSessionLogon(sessionID); } if (FixMessage.FixVersion == FixVersion.Fix44 && needUserRequestMessage) { // послать UserRequest var userName = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Username", ""); var password = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Password", ""); QuickFix44.UserRequest msg; try { msg = new QuickFix44.UserRequest(new UserRequestID("1"), new UserRequestType(1), new Username(userName)); msg.setField(new SendingTime(DateTime.Now.ToUniversalTime(), FixMessageMaker.Instance.ShowMillisecond)); // !! появляется дважды msg.setField(new Password(password)); msg.getHeader().setField(new SenderCompID(sessionID.getSenderCompID())); msg.getHeader().setField(new TargetCompID(sessionID.getTargetCompID())); } catch (Exception ex) { Logger.Error("Ошибка сборки сообщения UserRequest", ex); throw; } SendMessage(msg); } }
public void onLogon(SessionID sessionID) { _senderCompID = sessionID.getSenderCompID(); _targetCompID = sessionID.getTargetCompID(); _FixSessionStatusChangedDelegate(Beltone.Services.Fix.Entities.FixSessionStatus.Connected); SystemLogger.WriteOnConsoleAsync(true, "Logged In: session id " + sessionID.ToString(), ConsoleColor.Green, ConsoleColor.Yellow, false); }
public override void onMessage(QuickFix44.Logon message, SessionID sessionID) { Logger.InfoFormat("Logon command (Sender = {0}, Target = {1}, Encrypt = {2}," + " Password = {3}, Heartbeat int = {4})", sessionID.getSenderCompID(), sessionID.getTargetCompID(), message.getEncryptMethod(), message.getPassword(), message.getHeartBtInt()); }
public override void onMessage(QuickFix44.Logout message, SessionID sessionID) { Logger.InfoFormat("Logout command (Sender = {0}, Target = {1}, Text = {2}," + " Encoded text = {3})", sessionID.getSenderCompID(), sessionID.getTargetCompID(), message.getText(), message.getEncodedText()); }
public void onLogout(SessionID sessionId) { #region Documentation // notifies you when an FIX session is no longer online. This could happen during a normal logout exchange or // because of a forced termination or a loss of network connection. #endregion _bLoggedOn = false; string msg = string.Format("OnLogout: Session({0} <-> {1})", sessionId.getSenderCompID(), sessionId.getTargetCompID()); GatLogger.Instance.AddMessage(msg, LogMode.LogAndScreen); }
public void onLogon(SessionID sessionId) { #region Documentation // notifies you when a valid logon has been established with a counter party. This is called when a connection // has been established and the FIX logon process has completed with both parties exchanging valid logon // messages. #endregion _bLoggedOn = true; string msg = string.Format("OnLogon: Session({0} <-> {1})", sessionId.getSenderCompID(), sessionId.getTargetCompID()); GatLogger.Instance.AddMessage(msg, LogMode.LogAndScreen); }
// APPLICATION INTERFACE FUNCTIONS #region APPLICATION INTERFACE FUNCTIONS public void onCreate(SessionID sessionId) { #region Documentation // gets called when quickfix creates a new session. A session comes into and remains in existence for the life // of the application. Sessions exist whether or not a counter party is connected to it. As soon as a session // is created, you can begin sending messages to it. If no one is logged on, the messages will be sent at the // time a connection is established with the counterparty. #endregion _bCreated = true; string msg = string.Format("OnCreate: Session({0} <-> {1})", sessionId.getSenderCompID(), sessionId.getTargetCompID()); GatLogger.Instance.AddMessage(msg, LogMode.LogAndScreen); }
public static Message MakeQuoteRequest(string ticker, SessionID sessionInfo) { var senderId = sessionInfo.getSenderCompID(); if (string.IsNullOrEmpty(senderId)) { Logger.ErrorFormat("MakeMessage: код отправителя для [{0}] не найден", sessionInfo); return(null); } var msg = FixMessage.FixVersion == FixVersion.Fix42 ? (Message) new QuickFix42.MarketDataRequest( new MDReqID(string.Format("{0}-{1:dd-HH-mm}", ticker, DateTime.Now)), new SubscriptionRequestType((char)1), // subscribe new MarketDepth(marketDepth)) : FixMessage.FixVersion == FixVersion.Fix43 ? (Message) new QuickFix43.MarketDataRequest( new MDReqID(string.Format("{0}-{1:dd-HH-mm}", ticker, DateTime.Now)), new SubscriptionRequestType((char)1), // subscribe new MarketDepth(marketDepth)) : new QuickFix44.MarketDataRequest( new MDReqID(string.Format("{0}-{1:dd-HH-mm}", ticker, DateTime.Now)), // 262=EURAUD-02-17-07 new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES), // subscribe new MarketDepth(marketDepth)); msg.setField(new MDUpdateType( quoteSubscriptionIncrementalUpdateType ? MDUpdateType.INCREMENTAL_REFRESH : MDUpdateType.FULL_REFRESH)); if (!AddBidAskQueryClause(msg, ticker)) { return(null); } msg.getHeader().setField(new SenderCompID(senderId)); msg.getHeader().setField(new TargetCompID(sessionInfo.getTargetCompID())); return(msg); }
public void onCreate(SessionID __p1) { debug("session created" + __p1.getSenderCompID() + " " + __p1.getTargetCompID()); }
public override void onMessage(QuickFix44.ExecutionReport message, SessionID sessionID) { Logger.InfoFormat("Execution report (Sender = {0}, Target = {1})", sessionID.getSenderCompID(), sessionID.getTargetCompID()); }
public void toAdmin(Message message, SessionID sessionID) { if (message is QuickFix44.Logon && needCredsInLogon) { var logonMsg = (QuickFix44.Logon)message; var userName = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Username", ""); var password = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Password", ""); logonMsg.setField(new Password(password)); logonMsg.setField(new Username(userName)); } var subId = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "SessionQualifier", "FX"); var targetSubID = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "TargetSubID", ""); try { if (!string.IsNullOrEmpty(subId) && message is QuickFix43.Logon && needSenderSubId) { message.getHeader().setField(new SenderSubID(subId)); } message.getHeader().setField(new SendingTime(DateTime.Now.ToUniversalTime(), FixMessageMaker.Instance.ShowMillisecond)); if (!string.IsNullOrEmpty(targetSubID) && needTargetSubId) { message.getHeader().setField(new TargetSubID(targetSubID)); } } catch (Exception ex) { Logger.ErrorFormat("Ошибка установки данных заголовка админ. сообщения, сессия {0}", sessionID); Logger.Error("Исключение", ex); return; } #region Fix43 if (message is QuickFix43.Logon) { try { var logon = (QuickFix43.Logon)message; logon.setField(new ResetSeqNumFlag(true)); var userName = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Username", ""); var password = SessionSettingsParser.Instance.GetSessionParam( sessionID.getTargetCompID(), sessionID.getSenderCompID(), "Password", ""); if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) { Logger.ErrorFormat("Не найдены настройки сессии {0}", sessionID); } else { logon.set(new Username(userName)); logon.set(new Password(password)); } } catch (Exception ex) { Logger.ErrorFormat("Ошибка установки параметров авторизации, сессия {0}", sessionID); Logger.Error("Исключение", ex); } } #endregion #region Fix44 if (message is QuickFix44.Logon) {// ничего не делаю - пароль и логин указываются отдельно в последующем UserRequest (BE) } #endregion if (!ShouldFilterMessage(message)) { Logger.Info(string.Format("toAdmin({0}, {1})", message, sessionID)); } }