Esempio n. 1
0
        public void OnSessionLogout(IVfxFixAppSession session, FixMessage msg)
        {
            FixField fixSCID = msg.Header.GetField(49);
            FixField fixTCID = msg.Header.GetField(56);

            Console.WriteLine(string.Format("FIX CLIENT: {0} - LOGOUT.", fixSCID.Content));
        }
Esempio n. 2
0
        public void OnSessionLogout(IVfxFixAppSession session, FixMessage msg)
        {
            FixField fixSCID = msg.Header.GetField(49);
            FixField fixTCID = msg.Header.GetField(56);

            Console.WriteLine(string.Format("FIX SERVER: {0} - LOGOUT.", fixSCID.Content));
        }
Esempio n. 3
0
 /// <summary>
 /// The OnSessionRxAppMessage callback is invoked by a session
 /// when it receives an application layer message from the peer
 /// session it's interacting with.
 /// </summary>
 /// <param name="session">
 /// The IVfxFixSession implementation that is issuing the
 /// callback to the handler.
 /// </param>
 /// <param name="msg">
 /// The application message that the session has received
 /// from its corresponding peer session.
 /// </param>
 public void OnSessionRxAppMessage(IVfxFixSession session, FixMessage msg)
 {
     if (_mapAppSessions.ContainsKey(session.InstanceId))
     {
         IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId];
         _application.OnSessionRxAppMessage(appSession, msg);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// The OnSessionStarted callback method is invoked by an
 /// instance of a session when it is activated.
 /// </summary>
 /// <param name="session">
 /// The FIX session that the event relates to.
 /// </param>
 public void OnSessionOpened(IVfxFixSession session)
 {
     if (_mapAppSessions.ContainsKey(session.InstanceId))
     {
         IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId];
         _application.OnSessionOpened(appSession);
     }
 }
Esempio n. 5
0
        public void OnSessionLogon(IVfxFixAppSession session, FixMessage msg)
        {
            FixField fixSCID = msg.Header.GetField(49);
            FixField fixTCID = msg.Header.GetField(56);

            Console.WriteLine(string.Format("FIX CLIENT: {0} - LOGON", fixSCID.Content));
            System.Threading.ThreadPool.QueueUserWorkItem(HandleWork_SendMessages, session);
        }
Esempio n. 6
0
        public void OnSessionLogon(IVfxFixAppSession session, FixMessage msg)
        {
            FixField fixSCID = msg.Header.GetField(49);
            FixField fixTCID = msg.Header.GetField(56);

            Console.WriteLine(string.Format("FIX CLIENT: {0} - LOGON", fixSCID.Content));
            System.Threading.ThreadPool.QueueUserWorkItem(HandleWork_SendMessages, session);
        }
Esempio n. 7
0
 /// <summary>
 /// The OnSessionLogon callback method is invoked by an
 /// instance of a session when it completes a logon with
 /// the peer system it's communicating with.
 /// </summary>
 /// <param name="session">
 /// The IVfxFixSession implementation that is issuing
 /// the callback to the handler.
 /// </param>
 /// <param name="msg">
 /// The FIX logon message (request or response) that was
 /// received from the peer session.
 /// </param>
 public void OnSessionLogon(IVfxFixSession session, FixMessage msg)
 {
     // REC: Forward the callback to the appropriate method
     // on the application's callback interface:
     if (_mapAppSessions.ContainsKey(session.InstanceId))
     {
         IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId];
         _application.OnSessionLogon(appSession, msg);
     }
 }
Esempio n. 8
0
        /// <summary>
        /// The OnSessionStopped callback method is invoked in response
        /// to an instance of a session being shutdown.
        /// </summary>
        /// <param name="session">
        /// The FIX session that the event relates to.
        /// </param>
        public void OnSessionClosed(IVfxFixSession session)
        {
            // REC: Determine which application session corresponds to
            // the FIX session that the event is coming from and route
            // the appropriate notification to it.
            if (_mapAppSessions.ContainsKey(session.InstanceId))
            {
                IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId];
                _application.OnSessionClosed(appSession);
            }


            // REC: If there is currently an IPC session in place
            // that corresponds to the FIX session, it needs to be
            // disconnected at this point:
            if (_mapFixToIpc.ContainsKey(session.InstanceId))
            {
                _endpoint.Shutdown(_mapFixToIpc[session.InstanceId]);
            }
            else
            {
                // REC: Since the FIX session has been closed, it can
                // be removed from the active sessions map:
                if (_mapFixSessions.ContainsKey(session.InstanceId))
                {
                    _mapFixSessions.Remove(session.InstanceId);
                }
            }

            if (_serviceState == VfxFixServiceStates.Service_State_Closing)
            {
                if (_mapFixSessions.Count == 0)
                {
                    // REC: Adjust the service's state:
                    _serviceState = VfxFixServiceStates.Service_State_Closed;
                    // REC: Adjust the service's status:
                    _serviceStatus = VfxFixServiceStatus.Service_Status_Closed;
                    // REC: Dispatch the closed event:
                    EventHandler <VfxFixServiceEventArgs> tmpDispatch = EventDispatch;
                    if (tmpDispatch != null)
                    {
                        VfxFixServiceEventArgs args = new VfxFixServiceEventArgs(VfxFixServiceEventTypes.Event_Service_Stopped, _serviceStatus);
                        tmpDispatch(this, args);
                    }
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// The OnSessionTxAppMessage callback is invoked by a session
        /// when it is ready to dispatch an application message to the
        /// peer session it's interacting with.
        /// </summary>
        /// <param name="session">
        /// The IVfxFixSession implementation that is issuing the
        /// callback to the handler.
        /// </param>
        /// <param name="msg">
        /// The application message that the session wants to have sent
        /// to its corresponding peer session.
        /// </param>
        public void OnSessionTxAppMessage(IVfxFixSession session, FixMessage msg)
        {
            if (_mapAppSessions.ContainsKey(session.InstanceId))
            {
                IVfxFixAppSession appSession = _mapAppSessions[session.InstanceId];
                _application.OnSessionTxAppMessage(appSession, msg);

                // REC: Locate the IPC session identifier of the IPC session
                // that is associated with the service that is generating the
                // event and use that to send the message to the peer:
                if (_mapFixToIpc.ContainsKey(session.InstanceId))
                {
                    string ipcIdentifier = _mapFixToIpc[session.InstanceId];
                    _endpoint.Send(ipcIdentifier, new VfxMsgBlock(msg.ToString()));
                }
            }
        }
Esempio n. 10
0
        private void HandleWork_SendMessages(object state)
        {
            int orderId = 1;

            IVfxFixAppSession session = state as IVfxFixAppSession;

            for (int i = 0; i != 5; i++)
            {
                FixMessage msg = new FixMessage();

                msg.Header.SetField(new FixField(35, "8"));

                msg.Content.SetField(new FixField(37, orderId++.ToString()));
                msg.Content.SetField(new FixField(17, "5000"));
                msg.Content.SetField(new FixField(20, "0"));
                msg.Content.SetField(new FixField(150, "0"));
                msg.Content.SetField(new FixField(39, "0"));
                msg.Content.SetField(new FixField(55, "AAPL"));
                msg.Content.SetField(new FixField(54, "1"));
                msg.Content.SetField(new FixField(151, "3000"));
                msg.Content.SetField(new FixField(14, "0"));
                msg.Content.SetField(new FixField(6, "0"));

                FixGroup      grpTest     = new FixGroup(382, "2");
                FixCollection grpInstance = new FixCollection();
                grpInstance.AddField(new FixField(375, "foo"));
                grpInstance.AddField(new FixField(337, "bar"));
                grpTest.Instances.Add(grpInstance);
                grpTest.Instances.Add(grpInstance);

                msg.Content.AddGroup(grpTest);

                session.Send(msg);
            }

            if (session != null)
            {
                for (int i = 0; i != 10000; i++)
                {
                    FixMessage message = new FixMessage();

                    message.Header.AddField(new FixField(35, "D"));
                    session.Send(message);
                }
            }
        }
Esempio n. 11
0
 public void OnSessionOpened(IVfxFixAppSession session)
 {
     Console.WriteLine("FIX Client: Session opened...");
 }
Esempio n. 12
0
 public void OnSessionClosed(IVfxFixAppSession session)
 {
     Console.WriteLine("FIX CLIENT: - Session Closed.");
 }
Esempio n. 13
0
 public void OnSessionClosed(IVfxFixAppSession session)
 {
 }
Esempio n. 14
0
 public void OnSessionClosed(IVfxFixAppSession session)
 {
 }
Esempio n. 15
0
 public void OnSessionTxAppMessage(IVfxFixAppSession session, FixMessage msg)
 {
 }
Esempio n. 16
0
 public void OnSessionRxAdmMessage(IVfxFixAppSession session, FixMessage msg)
 {
     FixField fixSCID = msg.Header.GetField(49);
     Console.WriteLine(string.Format("FIX CLIENT: {0} SENT: {1}", fixSCID.Content, msg.ToString()));
 }
Esempio n. 17
0
 public void OnSessionOpened(IVfxFixAppSession session)
 {
     Console.WriteLine("FIX Server: Session opened...");
 }
Esempio n. 18
0
 public void OnSessionClosed(IVfxFixAppSession session)
 {
     Console.WriteLine("FIX CLIENT: - Session Closed.");
 }
Esempio n. 19
0
 public void OnSessionTxAppMessage(IVfxFixAppSession session, FixMessage msg)
 {
 }
Esempio n. 20
0
        public void OnSessionRxAppMessage(IVfxFixAppSession session, FixMessage msg)
        {
            FixField fixSCID = msg.Header.GetField(49);

            Console.WriteLine(string.Format("FIX SERVER: {0} SENT: {1}", fixSCID.Content, msg.ToString()));
        }