示例#1
0
        /// <summary>
        /// Send a FIX style status message specifing all parameters
        /// </summary>
        /// <param name="myState"></param>
        /// <param name="myText"></param>
        /// <param name="myBegin"></param>
        /// <param name="mySID"></param>
        /// <param name="myTID"></param>
        /// <param name="myFixName"></param>
        public void SendStatusMessage(KaiTrade.Interfaces.Status myState, string myText, string myBegin, string mySID, string myTID, string myFixName)
        {
            try
            {
                // Update a FIX session status
                UpdateStatus(myFixName, myBegin, myTID, mySID, myState, myText);

                IDriverStatusMessage myDSM;

                setupStatus(out myDSM, myState, myText);

                IDriverSession mySession = new DriverSession();
                mySession.SessionName = myFixName;              
                mySession.BeginString = myBegin;
                mySession.SID = mySID;
                mySession.TID = myTID;
                mySession.UserName = myFixName;
                mySession.State = myState;
                mySession.Text = myText;
                myDSM.Sessions.Add(mySession);
                
                KaiTrade.Interfaces.IMessage statusMsg = new K2DataObjects.Message();
                statusMsg.Format = "XML";
                statusMsg.Label = "DriverStatus";
                statusMsg.Data = JsonConvert.SerializeObject(myDSM);
                SendStatusMessage(statusMsg);
                _lastStatus = statusMsg;
            }
            catch (Exception myE)
            {
                log.Error("SendStatusMessage", myE);
            }

        }
示例#2
0
 /// <summary>
 /// Add a session with the details specified
 /// </summary>
 /// <param name="myName"></param>
 /// <param name="myVersion"></param>
 /// <param name="myTID"></param>
 /// <param name="mySID"></param>
 protected IDriverSession AddSession(string myName, string myVersion, string myTID, string mySID)
 {
     try
     {
         IDriverSession mySession = new DriverSession(this, myName, myVersion, myTID, mySID);
         string myKey = mySession.Key;
         if (_sessions.ContainsKey(myKey))
         {
             _sessions[myKey] = mySession;
         }
         else
         {
             _sessions.Add(myKey, mySession);
         }
         return mySession;
     }
     catch (Exception myE)
     {
         log.Error("AddSession2", myE);
         return null;
     }
 }