Exemple #1
0
        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);
            }
        }
 /**
  * This callback 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.
  */
 public void onLogon(QuickFix.SessionID session)
 {
     // send notification
     Console.WriteLine("Login begun for " + this.username);
     // set the time that the current session started
     sessionStart = DateTime.Now;
     // configure and send a UserRequest to complete login
     QuickFix44.UserRequest userRequest = new QuickFix44.UserRequest();
     // set the UserRequestType to the custom value for retail
     userRequest.setInt(QuickFix.UserRequestType.FIELD, REQUEST_LIST_OF_TRADING_SESSIONS);
     // set the RequestID
     userRequest.setString(QuickFix.UserRequestID.FIELD, nextID().ToString());
     // set the Username
     userRequest.setString(QuickFix.Username.FIELD, this.username);
     // set the Password
     userRequest.setString(QuickFix.Password.FIELD, this.password);
     // send notification
     Console.WriteLine("Sending UserRequest");
     // send the request to the API
     send(userRequest, session);
 }