public ScreenLog(SessionID sessionID, bool logIncoming, bool logOutgoing, bool logEvent) { sessionID_ = sessionID; logIncoming_ = logIncoming; logOutgoing_ = logOutgoing; logEvent_ = logEvent; }
public void process(Message message, SessionID sessionID) { Message echo = (Message)message; PossResend possResend = new PossResend(false); if (message.getHeader().isSetField(possResend)) message.getHeader().getField(possResend); ClOrdID clOrdID = new ClOrdID(); message.getField(clOrdID); Pair pair = new Pair(clOrdID, sessionID); if (possResend.getValue() == true) { if (orderIDs.Contains(pair)) return; } if(!orderIDs.Contains(pair)) orderIDs.Add(pair, pair); try { Session.sendToTarget(echo, sessionID); } catch (SessionNotFound) { } }
public void testSetGetSessionID() { Dictionary dictionary1 = new Dictionary(); dictionary1.setString( "ConnectionType", "initiator" ); Dictionary dictionary2 = new Dictionary(); dictionary2.setString( "ConnectionType", "acceptor" ); SessionID sessionID1 = new SessionID( "FIX.4.0", "SENDER1", "TARGET1" ); SessionID sessionID2 = new SessionID( "FIX.4.0", "SENDER2", "TARGET2" ); SessionID sessionID3 = new SessionID( "FIX.4.0", "SENDER3", "TARGET3" ); testObject.set( sessionID1, dictionary1 ); testObject.set( sessionID2, dictionary2 ); dictionary1 = testObject.get( sessionID1 ); dictionary2 = testObject.get( sessionID2 ); Assert.AreEqual( "initiator", dictionary1.getString("ConnectionType") ); Assert.AreEqual( "acceptor", dictionary2.getString("ConnectionType") ); try { testObject.get( sessionID3 ); Assert.Fail(); } catch( ConfigError ) {} }
public Session( IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider, SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID) { this.Application = app; this.SessionID = sessID; this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider); this.schedule_ = sessionSchedule; this.msgFactory_ = msgFactory; this.SenderDefaultApplVerID = senderDefaultApplVerID; this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString); if (this.SessionID.IsFIXT) this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID); else this.ApplicationDataDictionary = this.SessionDataDictionary; ILog log; if (null != logFactory) log = logFactory.Create(sessID); else log = new NullLog(); state_ = new SessionState(log, heartBtInt) { MessageStore = storeFactory.Create(sessID) }; // Configuration defaults. // Will be overridden by the SessionFactory with values in the user's configuration. this.PersistMessages = true; this.ResetOnDisconnect = false; this.SendRedundantResendRequests = false; this.ValidateLengthAndChecksum = true; this.CheckCompID = true; this.MillisecondsInTimeStamp = true; this.EnableLastMsgSeqNumProcessed = false; this.MaxMessagesInResendRequest = 0; this.SendLogoutBeforeTimeoutDisconnect = false; this.IgnorePossDupResendRequests = false; this.RequiresOrigSendingTime = true; this.CheckLatency = true; this.MaxLatency = 120; if (!IsSessionTime) Reset("Out of SessionTime (Session construction)"); else if (IsNewSession) Reset("New session"); lock (sessions_) { sessions_[this.SessionID] = this; } this.Application.OnCreate(this.SessionID); this.Log.OnEvent("Created session"); }
public void onCreate( SessionID sessionID ) { Session session = Session.lookupSession( sessionID ); try { if ( session != null ) session.reset(); } catch( Exception ) {} }
public override void onMessage(QuickFix43.SecurityDefinition message, SessionID sessionID) { QuickFix43.SecurityDefinition echo = message; try { Session.sendToTarget(echo, sessionID); } catch (SessionNotFound) { } }
public void FromApp(QuickFix.Message msg, SessionID sessionID) { Console.WriteLine("FromApp - " + msg.ToString() + "@" + sessionID.ToString()); try { Crack(msg, sessionID); } catch (Exception ex) { Console.WriteLine("==Cracker exception=="); Console.WriteLine(ex.ToString()); Console.WriteLine(ex.StackTrace); } }
/// <summary> /// Creates a file-based message store /// </summary> /// <param name="sessionID">session ID for the message store</param> /// <returns></returns> public Log Create(SessionID sessionID) { Dictionary sessionSettings = settings_.Get(sessionID); bool RotateLog = false; //default if undefined int RotateLogNumToKeep = 1; //default if undefined if (sessionSettings.Has(SessionSettings.FILE_LOG_ROTATE_ON_NEW_SESSION)) RotateLog = sessionSettings.GetBool(SessionSettings.FILE_LOG_ROTATE_ON_NEW_SESSION); if (sessionSettings.Has(SessionSettings.FILE_LOG_ROTATE_NUM_TO_KEEP)) RotateLogNumToKeep = sessionSettings.GetInt(SessionSettings.FILE_LOG_ROTATE_NUM_TO_KEEP); return new FileLog(sessionSettings.GetString(SessionSettings.FILE_LOG_PATH), sessionID, RotateLog, RotateLogNumToKeep); }
public void OnMessage(MarketDataIncrementalRefresh msg, SessionID sessionID) { FIX44XMLParser parser = new FIX44XMLParser(); Console.WriteLine("==========Header::=========="); Console.WriteLine(parser.getFieldName(Tags.BeginString.ToString()) + ":: " + msg.Header.GetString(Tags.BeginString)); Console.WriteLine(parser.getFieldName(Tags.BodyLength.ToString()) + ":: " + msg.Header.GetString(Tags.BodyLength)); Console.WriteLine(parser.getFieldName(Tags.MsgType.ToString()) + ":: MarketDataIncrementalRefresh (" + msg.Header.GetString(Tags.MsgType) + ")"); Console.WriteLine(parser.getFieldName(Tags.MsgSeqNum.ToString()) + ":: " + msg.Header.GetString(Tags.MsgSeqNum)); Console.WriteLine(parser.getFieldName(Tags.SenderCompID.ToString()) + ":: " + msg.Header.GetString(Tags.SenderCompID)); Console.WriteLine(parser.getFieldName(Tags.SendingTime.ToString()) + ":: " + msg.Header.GetString(Tags.SendingTime)); Console.WriteLine(parser.getFieldName(Tags.TargetCompID.ToString()) + ":: " + msg.Header.GetString(Tags.TargetCompID)); Console.WriteLine("==========Body:: =========="); Console.WriteLine(parser.getFieldName(Tags.NoMDEntries.ToString()) + ":: " + msg.GetString(Tags.NoMDEntries)); MarketDataIncrementalRefresh.NoMDEntriesGroup g0 = new MarketDataIncrementalRefresh.NoMDEntriesGroup(); for (int grpIndex = 1; grpIndex <= msg.GetInt(Tags.NoMDEntries); grpIndex += 1) { Console.WriteLine("---------- ----------"); msg.GetGroup(grpIndex, g0); // Console.WriteLine(parser.getFieldName(Tags.MDUpdateAction.ToString())+":: "+g0.GetString(Tags.MDUpdateAction)); Console.WriteLine(parser.getFieldName(Tags.MDUpdateAction.ToString()) + ":: " + parser.getFieldName(Tags.MDUpdateAction.ToString(), g0.GetString(Tags.MDUpdateAction).ToString()) + "(" + g0.GetString(Tags.MDUpdateAction) + ")" ); Console.WriteLine(parser.getFieldName(Tags.MDEntryType.ToString()) + ":: " + parser.getFieldName(Tags.MDEntryType.ToString(), g0.GetString(Tags.MDEntryType).ToString()) + "(" + g0.GetString(Tags.MDEntryType) + ")" ); try { Console.WriteLine(parser.getFieldName(Tags.MDEntryPx.ToString()) + ":: " + g0.GetString(Tags.MDEntryPx)); } catch (Exception ex) { Console.WriteLine(parser.getFieldName(Tags.MDEntrySize.ToString()) + ":: " + g0.GetString(Tags.MDEntrySize)); } Console.WriteLine(parser.getFieldName(Tags.MDEntryDate.ToString()) + ":: " + g0.GetString(Tags.MDEntryDate)); Console.WriteLine(parser.getFieldName(Tags.MDEntryTime.ToString()) + ":: " + g0.GetString(Tags.MDEntryTime)); } Console.WriteLine("==========Trailer:: =========="); Console.WriteLine(parser.getFieldName(Tags.CheckSum.ToString()) + ":: " + msg.Trailer.GetString(Tags.CheckSum)); }
public FileLog(string fileLogPath, SessionID sessionID) { sessionID_ = sessionID; if (!System.IO.Directory.Exists(fileLogPath)) System.IO.Directory.CreateDirectory(fileLogPath); string fname = new System.Text.StringBuilder(sessionID_.BeginString) .Append('-').Append(sessionID_.SenderCompID) .Append('-').Append(sessionID_.TargetCompID) .Append(".fixme.log") .ToString(); fname = System.IO.Path.Combine(fileLogPath, fname); file_ = new System.IO.StreamWriter(fname); }
public static string Prefix(SessionID sessionID) { System.Text.StringBuilder prefix = new System.Text.StringBuilder(sessionID.BeginString) .Append('-').Append(sessionID.SenderCompID); if (SessionID.IsSet(sessionID.SenderSubID)) prefix.Append('_').Append(sessionID.SenderSubID); if (SessionID.IsSet(sessionID.SenderLocationID)) prefix.Append('_').Append(sessionID.SenderLocationID); prefix.Append('-').Append(sessionID.TargetCompID); if (SessionID.IsSet(sessionID.TargetSubID)) prefix.Append('_').Append(sessionID.TargetSubID); if (SessionID.IsSet(sessionID.TargetLocationID)) prefix.Append('_').Append(sessionID.TargetLocationID); if(sessionID.SessionQualifier.Length!=0) prefix.Append('-').Append(sessionID.SessionQualifier); return prefix.ToString(); }
public ILog Create(SessionID sessionID) { bool logIncoming = logIncoming_; bool logOutgoing = logOutgoing_; bool logEvent = logEvent_; if(settings_ != null && settings_.Has(sessionID)) { Dictionary dict = settings_.Get(sessionID); if (dict.Has(SCREEN_LOG_SHOW_INCOMING)) logIncoming = dict.GetBool(SCREEN_LOG_SHOW_INCOMING); if (dict.Has(SCREEN_LOG_SHOW_OUTGOING)) logOutgoing = dict.GetBool(SCREEN_LOG_SHOW_OUTGOING); if (dict.Has(SCREEN_LOG_SHOW_EVENTS)) logEvent = dict.GetBool(SCREEN_LOG_SHOW_EVENTS); } return new ScreenLog(sessionID, logIncoming, logOutgoing, logEvent); }
public void testOrderSend() { SessionNotFound exception = null; NewOrderSingle order = new NewOrderSingle(); try { Session.sendToTarget(order); } catch(SessionNotFound e) { exception = e; } Assert.IsNotNull( exception, "no exception thrown" ); exception = null; SessionID sessionID = new SessionID ("FIX.4.2", "TW", "ISLD"); order.set(new ClOrdID("12345")); order.set(new Symbol("LNUX")); order.set(new HandlInst('1')); order.set(new Side(Side.BUY)); order.set(new OrdType(OrdType.MARKET)); order.set(new TransactTime()); try { Assert.IsTrue(Session.sendToTarget(order, sessionID)); QuickFix.Message message = application.getMessage(); Assert.IsNotNull(message, "Message not received"); //Assert.IsTrue("Message not a NewOrderSingle", // message instanceof NewOrderSingle); Assert.IsTrue(Session.sendToTarget(order, sessionID)); } catch(SessionNotFound e) { exception = e; } Assert.IsNull(exception, "exception thrown"); }
public void OnMessage(NewOrderSingle msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Sender); }
public void fromApp(Message message, SessionID sessionID) { crack(message, sessionID); }
private void AppOnSessionLogon(SessionID sessionId) { Logger.InfoFormat("FixProxyServer.AppOnSessionLogon: {0}", sessionId); quoteRequest.RequestMarketData(sessionId); }
public void OnMessage(QuickFix.FIX40.News n, SessionID s) { }
public void OnLogon(SessionID sessionID) { //_mainform.ButtonClient44.BackColor = Color.Green; this.Connected = true; }
public void OnLogout(SessionID sessionID) { }
public void OnLogon(SessionID sessionID) { //Started.Set(); }
public void OnCreate(SessionID sessionID) { m_sessionID = sessionID; }
public void OnMessage(ExecutionReport msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Receiver); }
public void OnMessage(AccountInfoResponse msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Receiver); }
public void OnMessage(OrderCancelRequest msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Sender); }
public void FromApp(Message message, SessionID sessionID) { }
public void FromApp(Message message, SessionID sessionID) { System.Diagnostics.Debug.WriteLine("Received FIX app message: " + message.ToString()); }
public void FromAdmin(QuickFix.Message msg, SessionID sessionID) { DataContainer.form1.AppendReceiverBox(@"FromAdmin() invoked!!!!"); MessageDisplay(msg, sessionID, MessageDisplayer.Receiver); }
public void ToApp(Message message, SessionID sessionID) { }
/// <summary> /// Encapsulate the XmlRpc call to standardize security and error handling. /// </summary> private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) { XmlRpcResponse resp = null; string CacheKey = null; // Only bother with the cache if it isn't disabled. if (m_cacheTimeout > 0) { if (!function.StartsWith("groups.get")) { // Any and all updates cause the cache to clear m_memoryCache.Clear(); } else { StringBuilder sb = new StringBuilder(requestingAgentID + function); foreach (object key in param.Keys) { if (param[key] != null) { sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString()); } } CacheKey = sb.ToString(); m_memoryCache.TryGetValue(CacheKey, out resp); } } if (resp == null) { string UserService; UUID SessionID; GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); param.Add("RequestingAgentID", requestingAgentID.ToString()); param.Add("RequestingAgentUserService", UserService); param.Add("RequestingSessionID", SessionID.ToString()); param.Add("ReadKey", m_groupReadKey); param.Add("WriteKey", m_groupWriteKey); IList parameters = new ArrayList(); parameters.Add(param); ConfigurableKeepAliveXmlRpcRequest req; req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); try { resp = req.Send(m_groupsServerURI, 10000); if ((m_cacheTimeout > 0) && (CacheKey != null)) { m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); } } catch (Exception e) { m_log.ErrorFormat( "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", function, m_groupsServerURI); m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace); foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) { m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); } foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); } Hashtable respData = new Hashtable(); respData.Add("error", e.ToString()); return(respData); } } if (resp.Value is Hashtable) { Hashtable respData = (Hashtable)resp.Value; if (respData.Contains("error") && !respData.Contains("succeed")) { LogRespDataToConsoleError(respData); } return(respData); } m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); if (resp.Value is ArrayList) { ArrayList al = (ArrayList)resp.Value; m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count); foreach (object o in al) { m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString()); } } else { m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString()); } Hashtable error = new Hashtable(); error.Add("error", "invalid return value"); return(error); }
public void FromAdmin(Message message, SessionID sessionID) { }
/// <summary> /// Sends a message to the session specified by the provider session ID. /// </summary> /// <param name="message">FIX message</param> /// <param name="sessionID">target SessionID</param> /// <returns>true if send was successful, false otherwise</returns> public static bool SendToTarget(Message message, SessionID sessionID) { message.SetSessionID(sessionID); Session session = Session.LookupSession(sessionID); if (null == session) throw new SessionNotFound(sessionID); return session.Send(message); }
public void OnCreate(SessionID sessionID) { _session = Session.LookupSession(sessionID); }
public void FromAdmin(QuickFix.Message message, SessionID sessionID) { }
public void onLogout( SessionID sessionID ) { cracker.reset(); }
public void OnLogout(SessionID sessionID) { //_mainform.ButtonClient44.BackColor = Color.Red; this.Connected = false; }
public Log4NetLog(SessionID sessionId) : base(sessionId) { }
protected override void DoConnect(SessionID sessionID, Dictionary settings) { Session session = null; try { session = Session.LookupSession(sessionID); if (!session.IsSessionTime) return; IPEndPoint socketEndPoint = GetNextSocketEndPoint(sessionID, settings); SetPending(sessionID); session.Log.OnEvent("Connecting to " + socketEndPoint.Address + " on port " + socketEndPoint.Port); SocketInitiatorThread t = new SocketInitiatorThread(this, session, socketEndPoint, socketSettings_); t.Start(); AddThread(t); } catch (System.Exception e) { if (null != session) session.Log.OnEvent(e.Message); } }
public void ToApp(QuickFix.Message msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Sender); }
public void OnMessage(BusinessMessageReject msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Receiver); }
/// <summary> /// Looks up a Session by its SessionID /// </summary> /// <param name="sessionID">the SessionID of the Session</param> /// <returns>the Session if found, else returns null</returns> public static Session LookupSession(SessionID sessionID) { Session result; lock (sessions_) { if (!sessions_.TryGetValue(sessionID, out result)) result = null; } return result; }
public void OnLogout(SessionID sessionId) { Console.WriteLine("Successful Logout"); }
public void fromApp( Message message, SessionID sessionID ) { cracker.crack( message, sessionID ); }
public void OnMessage(QuickFix.FIX42.SecurityDefinition secDef, SessionID sessionId) { Console.WriteLine(secDef); }
public void onLogon( SessionID sessionID ) { }
public void FromAdmin(Message message, SessionID sessionId) { Console.WriteLine("From"); }
public virtual Log Create(SessionID sessionId) { var log = new Log4NetLog(sessionId); log.RichMessageLogging = RichMessageLogging; return log; }
private IPEndPoint GetNextSocketEndPoint(SessionID sessionID, QuickFix.Dictionary settings) { int num; if (!sessionToHostNum_.TryGetValue(sessionID, out num)) num = 0; string hostKey = SessionSettings.SOCKET_CONNECT_HOST + num; string portKey = SessionSettings.SOCKET_CONNECT_PORT + num; if (!settings.Has(hostKey) || !settings.Has(portKey)) { num = 0; hostKey = SessionSettings.SOCKET_CONNECT_HOST; portKey = SessionSettings.SOCKET_CONNECT_PORT; } try { IPAddress[] addrs = Dns.GetHostAddresses(settings.GetString(hostKey)); int port = System.Convert.ToInt32(settings.GetLong(portKey)); sessionToHostNum_[sessionID] = ++num; return new IPEndPoint(addrs[0], port); } catch (System.Exception e) { throw new ConfigError(e.Message, e); } }
public void OnCreate(SessionID sessionID) { }
public void OnLogon(SessionID sessionID) { _logonNotify(sessionID.TargetCompID); }
/// <summary> /// Creates a file-based message store /// </summary> /// <param name="sessionID">session ID for the message store</param> /// <returns></returns> public ILog Create(SessionID sessionID) { return new FileLog(settings_.Get(sessionID).GetString(SessionSettings.FILE_LOG_PATH), sessionID); }
public void ToAdmin(Message message, SessionID sessionID) { }
public void ToApp(Message message, SessionID sessionId) { }
public void FromApp(Message message, SessionID sessionID) { Console.WriteLine("IN: " + message); Crack(message, sessionID); }
public void ToApp(Message message, SessionID sessionID) { Console.WriteLine("OUT: " + message); }