private void MessageDisplay(QuickFix.Message msg, SessionID sessionID, MessageDisplayer msgDisplayer) { if (msgDisplayer == MessageDisplayer.Sender) { DataContainer.form1.AppendSenderBox($@"=================={msg.GetType()}=================="); DataContainer.form1.AppendSenderBox("@" + sessionID.ToString()); var msgLst = msg.ToList(); var msgHeaderLst = msg.Header.ToList(); foreach (var item in msgHeaderLst) { DataContainer.form1.AppendSenderBox(Fix44XmlParser.getFieldName(item.Key.ToString()) + @": " + Fix44XmlParser.getFieldValueName(item.Key.ToString(), item.Value.ToString())); } foreach (var item in msgLst) { DataContainer.form1.AppendSenderBox(Fix44XmlParser.getFieldName(item.Key.ToString()) + @": " + Fix44XmlParser.getFieldValueName(item.Key.ToString(), item.Value.ToString())); } } else if (msgDisplayer == MessageDisplayer.Receiver) { DataContainer.form1.AppendReceiverBox($@"=================={msg.GetType()}=================="); DataContainer.form1.AppendReceiverBox("@" + sessionID.ToString()); var msgLst = msg.ToList(); var msgHeaderLst = msg.Header.ToList(); foreach (var item in msgHeaderLst) { DataContainer.form1.AppendReceiverBox(Fix44XmlParser.getFieldName(item.Key.ToString()) + @": " + Fix44XmlParser.getFieldValueName(item.Key.ToString(), item.Value.ToString())); } foreach (var item in msgLst) { DataContainer.form1.AppendReceiverBox(Fix44XmlParser.getFieldName(item.Key.ToString()) + @": " + Fix44XmlParser.getFieldValueName(item.Key.ToString(), item.Value.ToString())); } } }
public virtual void OnMessage(QuickFix.FIX44.ApplicationRawDataReporting message, SessionID session) { try { //logger.InfoFormat("RawDataLength[{0}] getLength[{1}]", message.RawDataLength, message.RawData.getLength()); UmdfUtils.dumpFastData(UmdfUtils.ENCODING.GetBytes(message.RawData.getValue()), 0, Int32.Parse(message.RawDataLength.ToString())); string[] quebraApplReqID = message.ApplReqID.ToString().Split("|".ToCharArray()); string applReqID = quebraApplReqID[0]; string sessionIDResponse = quebraApplReqID[1]; // Retorna o applReqID original message.Set(new QuickFix.Fields.ApplReqID(quebraApplReqID[0])); // Inverte origem e destino da mensagem, para devolver a resposta ao cliente Fix message.Header.SetField(new QuickFix.Fields.SenderCompID(_dctSessionsFixClients[sessionIDResponse].TargetCompID)); message.Header.SetField(new QuickFix.Fields.SenderSubID(_dctSessionsFixClients[sessionIDResponse].TargetSubID)); message.Header.SetField(new QuickFix.Fields.TargetCompID(_dctSessionsFixClients[sessionIDResponse].SenderCompID)); message.Header.SetField(new QuickFix.Fields.TargetSubID(_dctSessionsFixClients[sessionIDResponse].SenderSubID)); logger.InfoFormat("SessionID[{0}]: ApplicationRawDataReporting enviando para sessionIDResponse[{1}] msg[{2}]", session.ToString(), sessionIDResponse, message.ToString()); bool bRet = Session.SendToTarget(message, _dctSessionsFixClients[sessionIDResponse]); if (!bRet) { logger.ErrorFormat("SessionID[{0}]: Falha ApplicationRawDataReporting sessionIDResponse[{1}] msg[{2}]", session.ToString(), sessionIDResponse, message.ToString()); } } catch (Exception ex) { logger.Error("onMessage(ApplicationRawDataReporting): " + ex.Message, ex); } }
public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageReport message, SessionID session) { try { string[] quebraApplReqID = message.ApplReqID.ToString().Split("|".ToCharArray()); string applReqID = quebraApplReqID[0]; string sessionIDResponse = quebraApplReqID[1]; // Retorna o applReqID original message.Set(new QuickFix.Fields.ApplReqID(quebraApplReqID[0])); // Inverte origem e destino da mensagem, para devolver a resposta ao cliente Fix message.Header.SetField(new QuickFix.Fields.SenderCompID(_dctSessionsFixClients[sessionIDResponse].TargetCompID)); message.Header.SetField(new QuickFix.Fields.SenderSubID(_dctSessionsFixClients[sessionIDResponse].TargetSubID)); message.Header.SetField(new QuickFix.Fields.TargetCompID(_dctSessionsFixClients[sessionIDResponse].SenderCompID)); message.Header.SetField(new QuickFix.Fields.TargetSubID(_dctSessionsFixClients[sessionIDResponse].SenderSubID)); logger.InfoFormat("SessionID[{0}]: ApplicationMessageReport enviando para sessionIDResponse[{1}] msg[{2}]", session.ToString(), sessionIDResponse, message.ToString()); bool bRet = Session.SendToTarget(message, _dctSessionsFixClients[sessionIDResponse]); if (!bRet) { logger.ErrorFormat("SessionID[{0}]: Falha ApplicationMessageReport sessionIDResponse[{1}] msg[{2}]", session.ToString(), sessionIDResponse, message.ToString()); } } catch (Exception ex) { logger.Error("onMessage(ApplicationMessageReport): " + ex.Message, ex); } }
public void OnLogon(SessionID sessionID) { Console.WriteLine("Logon - " + sessionID.ToString()); m_bConnected = true; //FixApiConnectEventListener(); Logger.Instance().Log($"Trade Connection: Logon - {sessionID.ToString()}"); }
public void OnLogout(SessionID sessionID) { Console.WriteLine("Logout - " + sessionID.ToString()); m_bConnected = false; //FixApiDisconnectEventListener(); Logger.Instance().Log($"Price Connection: Logout - {sessionID.ToString()}", LogStyle.HighLight); }
public void onLogon(SessionID value) { AppLogger.Debug(value.ToString()); Console.WriteLine(string.Format("@onLogon:{0}", value.ToString())); new Thread(ProcesssNewOrderSingleThread).Start(null); SessionID = value; }
public void onLogon(SessionID value) { AppLogger.Debug(value.ToString()); Console.WriteLine(string.Format("@onLogon:{0}", value.ToString())); SessionID = value; StartPublishingExecutionReports(); }
public void OnLogon(SessionID sessionID) { AppLogger.Debug(sessionID.ToString()); Console.WriteLine(string.Format("@onLogon:{0}", sessionID.ToString())); SessionID = sessionID; StartPublishingExecutionReports(); }
public void OnLogon(SessionID sessionID) { Console.WriteLine("Logon - " + sessionID.ToString()); m_bConnected = true; //FixApiConnectEventListener(); Logger.Instance().Log($"Price Connection: Logon - {sessionID.ToString()}"); for (int i = 0; i < Global_Config.m_SymbolsToSubscribe.Count; i++) { SubscribeMarketData(Global_Config.m_SymbolsToSubscribe[i], i.ToString()); } }
public void OnLogout(SessionID sessionID) { Console.WriteLine("Logout - " + sessionID.ToString()); //IsConnected = false; HashSet <QuickFix.SessionID> sidset = MySessionSettings.GetSessions(); if (sessionID.TargetCompID.CompareTo(sidset.ElementAt(0).TargetCompID) == 0) { //orderSession = Session.LookupSession(sessionID); if (OrderSessionLogoutEvent != null) { OrderSessionLogoutEvent(); } } else { //priceSession = Session.LookupSession(sessionID); if (PriceSessionLogoutEvent != null) { PriceSessionLogoutEvent(); } } }
public virtual void OnMessage(QuickFix.FIX44.Reject message, SessionID session) { try { string sessionRejectReason = message.IsSetSessionRejectReason() ? message.SessionRejectReason.ToString() : "0"; string refSeqNum = message.IsSetRefSeqNum() ? message.RefSeqNum.ToString() : "no-ref-seq-num"; string refTagID = message.IsSetRefTagID() ? message.RefTagID.ToString() : "no-tag-id"; string refMsgType = message.IsSetRefMsgType() ? message.RefMsgType.ToString() : "no-ref-msg-type"; string text = message.IsSetText() ? message.Text.ToString() : "no-text"; logger.Error("onMessage(Reject): onMessage(Reject) SessionID: " + session.ToString()); logger.Error("onMessage(Reject): Reason =[" + sessionRejectReason + "]"); logger.Error("onMessage(Reject): RefSeqNum=[" + refSeqNum + "]"); logger.Error("onMessage(Reject): RefTagID=[" + refTagID + "]"); logger.Error("onMessage(Reject): RefMsgType=[" + refMsgType + "]"); logger.Error("onMessage(Reject): Error=[" + text + "]"); } catch (QuickFix.UnsupportedMessageType uex) { logger.Error("onMessage(Reject): " + uex.Message + "\r\n Data: " + uex.Data, uex); } catch (Exception ex) { logger.Error("onMessage(Reject): " + ex.Message, ex); } }
internal async Task <DACPResponse> SubmitRequestAsync(DACPRequest request) { if (request.IncludeSessionID) { request.QueryParameters["session-id"] = SessionID.ToString(); } string uri = request.GetURI(); _log.Info("Submitting request for: " + uri); HttpResponseMessage response = await HttpClient.PostAsync(uri, request.HttpContent, request.CancellationToken).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { _log.Info("Invalid response ({0}) for: {1}", response.StatusCode, uri); throw new DACPRequestException(response); } byte[] data = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); _log.Info("Received response for: " + uri); // Get the content of the first node IEnumerable <DACPNode> nodes = null; if (data.Length > 0) { data = DACPUtility.GetResponseNodes(data, true).First().Value; nodes = DACPUtility.GetResponseNodes(data); } return(new DACPResponse(response, nodes)); }
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 void NewTransaction(string tableID, int numberOfGuest, string status) { Transaction.Table_UID = new Guid(tableID); Transaction.NumberOfGuest = numberOfGuest; Transaction.Status = status; ITransaction.CreateAsync(Transaction, SessionID.ToString()).Wait(); }
public void OnLogon(SessionID sessionID) { _seen = new HashSet <string>(); Console.WriteLine("Logon - " + sessionID.ToString()); if (ExecuteSecurityListRequest) { // get all the symbols SecurityListRequestAll(); // get symbols only by the symbol prefix if (!string.IsNullOrWhiteSpace(FilterBySymbolIdForSecurityListRequest)) { SecurityListRequestFilteredBySymbolIdPrefix(FilterBySymbolIdForSecurityListRequest); } // get symbols from specific exchange if (!string.IsNullOrWhiteSpace(FilterByExchangeNameForSecurityListRequest)) { SecurityListRequestFilteredByExchange(FilterByExchangeNameForSecurityListRequest); } } // subscribe by symbol ids //MarketDataRequestTrades(SubscribeBySymbolRegex); //MarketDataRequestQuotes(SubscribeBySymbolRegex); //MarketDataRequestFullOrderbook(SubscribeBySymbolRegex); MarketDataRequestFullOrderbookIncremential(SubscribeBySymbolRegex); }
public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageRequest message, SessionID session) { try { string sessionID = session.ToString(); string applReqID = message.ApplReqID.ToString(); logger.InfoFormat("SessionID[{0}]: ApplicationMessageRequest ApplReqID[{1}]", sessionID, applReqID); // Acrescenta o sessionID do cliente para controle applReqID = applReqID + "|" + sessionID; message.Set(new QuickFix.Fields.ApplReqID(applReqID)); string[] quebraApplReqID = applReqID.Split("-".ToCharArray()); string channelID = quebraApplReqID[1]; logger.DebugFormat("SessionID[{0}]: ApplicationMessageRequest enviando para ChannelID[{1}] msg[{2}]", sessionID, channelID, message.ToString()); bool bRet = Session.SendToTarget(message, _dctSessionsFixChannels[channelID]); if (!bRet) { logger.ErrorFormat("SessionID[{0}]: Falha ApplicationMessageRequest msg[{1}]", sessionID, message.ToString()); } } catch (Exception ex) { logger.Error("onMessage(ApplicationMessageRequest): " + ex.Message, ex); } }
public Pair(ClOrdID clOrdID, SessionID sessionID) { this.clOrdID = clOrdID; this.sessionID = sessionID; hashCode = ("C:" + clOrdID.ToString() + "S:" + sessionID.ToString()).GetHashCode(); }
private void Set(SessionID sessionID, QuickFix.Dictionary settings) { if (Has(sessionID)) { throw new ConfigError("Duplicate Session " + sessionID.ToString()); } settings.SetString(SessionSettings.BEGINSTRING, sessionID.BeginString); settings.SetString(SessionSettings.SENDERCOMPID, sessionID.SenderCompID); if (SessionID.IsSet(sessionID.SenderSubID)) { settings.SetString(SessionSettings.SENDERSUBID, sessionID.SenderSubID); } if (SessionID.IsSet(sessionID.SenderLocationID)) { settings.SetString(SessionSettings.SENDERLOCID, sessionID.SenderLocationID); } settings.SetString(SessionSettings.TARGETCOMPID, sessionID.TargetCompID); if (SessionID.IsSet(sessionID.TargetSubID)) { settings.SetString(SessionSettings.TARGETSUBID, sessionID.TargetSubID); } if (SessionID.IsSet(sessionID.TargetLocationID)) { settings.SetString(SessionSettings.TARGETLOCID, sessionID.TargetLocationID); } settings.Merge(defaults_); Validate(settings); settings_[sessionID] = settings; }
public XElement BuildXML(QuickFix.Message msg, MsgType msgType, DateTime? logTimeStamp = null, string origChkSum = null) { //Debug.WriteLine(" ~~~> " + msg.GetType().ToString()); SessionID sessionID = msg.GetSessionID(msg); FIXClassInfo fixClass = null; if (msg.GetType() == typeof(QuickFix.Message)) { var classes = fixClasses[msgType.ToString(), Utils.NormalizeFIXNameSpace(sessionID.BeginString)]; if(classes != null && classes.Count>0) fixClass = classes[0]; } //var root = new XElement(msg.GetType().ToString()); var root = new XElement((fixClass!=null) ? fixClass.type.FullName : msg.GetType().ToString()); root.Add(new XAttribute("MessageType", msgType.ToString())); root.Add(new XAttribute("Session", sessionID.ToString())); if(logTimeStamp.HasValue) root.Add(new XAttribute("LogTimeStamp", logTimeStamp.Value)); var header = new XElement(msg.Header.GetType().ToString()); ProcessFieldMapToXML(header, msg.Header); root.Add(header); var body = new XElement(msg.GetType().ToString() + ".Body"); ProcessFieldMapToXML(body, msg); root.Add(body); var trailer = new XElement(msg.Trailer.GetType().ToString()); ProcessFieldMapToXML(trailer, msg.Trailer, origChkSum); root.Add(trailer); return root; }
public void ToAdmin(QuickFix.Message message, SessionID sessionID) { DoLog(string.Format("@toAdmin <{0}>:{1}", sessionID.ToString(), message.ToString()), Fwk.Main.Common.Util.Constants.MessageType.Information); if (message is Logon) { message.Header.SetField(new ResetSeqNumFlag(ResetSeqNumFlag.NO)); } }
internal async Task <DacpResponse> SendRequestAsync(DacpRequest request) { if (request.IncludeSessionID) { request.QueryParameters["session-id"] = SessionID.ToString(); } return(await SendRequestAsync(request.GetURI(), request.CancellationToken).ConfigureAwait(false)); }
public void FromApp(QuickFix.Message message, SessionID sessionID) { DoLog(string.Format("@fromApp<{0}>:{1}", sessionID.ToString(), message.ToString()), Fwk.Main.Common.Util.Constants.MessageType.Information); if (message is QuickFix.FIX44.ExecutionReport) { Thread processExecReport = new Thread(ProcesssExecutionReportMessage); processExecReport.Start((QuickFix.FIX44.ExecutionReport)message); } }
public void OnLogon(SessionID sessionID) { SessionID = sessionID; if (!TestingModulesInitialized) { InstantiateTestingModules();//Now we can start the tests TestingModulesInitialized = true; } DoLog(string.Format("@onLogon:{0}", sessionID.ToString()), Fwk.Main.Common.Util.Constants.MessageType.Information); }
public void FromAdmin(QuickFix.Message message, SessionID sessionID) { DoLog(string.Format("@fromAdmin<{0}>:{1}", sessionID.ToString(), message.ToString()), Fwk.Main.Common.Util.Constants.MessageType.Information); if (message is Reject) { Reject reject = (Reject)message; Thread rejectPrcThread = new Thread(ProcessMessageReject); rejectPrcThread.Start(reject); } }
/// <summary> /// Called on logon to the FIX session. /// </summary> /// <param name="sessionId">The session identifier.</param> public void OnLogon(SessionID sessionId) { var connected = new SessionConnected( this.Brokerage, sessionId.ToString(), this.guidFactory.Generate(), this.clock.TimeNow()); this.messagingAdapter.SendToBus(connected, null, this.clock.TimeNow()); this.Logger.LogDebug(LogId.Network, $"Connected to session {sessionId}"); }
protected bool SessionEquals(SessionID sessionID1, SessionID sessionID2) { if (sessionID1 == null || sessionID2 == null) { return(false); } else { return(sessionID1.ToString() == sessionID2.ToString()); } }
public void onCreate(SessionID sessionID) { SystemLogger.WriteOnConsoleAsync(true, string.Format("new sessionID: {0} ", sessionID.ToString()), ConsoleColor.Cyan, ConsoleColor.Black, false); lock (_lockObj) { if (!_sessionCode_sessionDetails.ContainsKey(sessionID.ToString())) { if (!_targetCompID_SessionCode.ContainsKey(sessionID.getTargetCompID())) { SystemLogger.WriteOnConsoleAsync(true, string.Format("not added sessionID: {0} because not found in database", sessionID.ToString()), ConsoleColor.White, ConsoleColor.Red, false); return; } _sessionCode_sessionDetails.Add(_targetCompID_SessionCode[sessionID.getTargetCompID()], new SessionInfo() { Session = sessionID, TargetCode = sessionID.getTargetCompID() }); _sessionID_sessionCode.Add(sessionID.ToString(), _targetCompID_SessionCode[sessionID.getTargetCompID()]); //SystemLogger.WriteOnConsoleAsync(true, string.Format("new added sessionID: {0} ", sessionID.ToString()), ConsoleColor.Cyan, ConsoleColor.Black, false); } } }
public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageRequest message, SessionID session) { try { string sessionID = session.ToString(); logger.InfoFormat("SessionID[{0}]: ApplicationMessageRequest ApplReqID[{1}] msg[{2}]", sessionID, message.ApplReqID.ToString(), message.ToString()); } catch (Exception ex) { logger.Error("onMessage(ApplicationMessageRequest): " + ex.Message, ex); } }
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); } }
public void TestToString() { SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET"); Assert.That(sessionID.ToString(), Is.EqualTo("FIX.4.2:SENDER->TARGET")); sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET", "QUALIFIER"); Assert.That(sessionID.ToString(), Is.EqualTo("FIX.4.2:SENDER->TARGET:QUALIFIER")); sessionID = new SessionID("FIX.4.2", "SENDER", "SENDERSUB", "TARGET", "TARGETSUB"); Assert.That(sessionID.ToString(), Is.EqualTo("FIX.4.2:SENDER/SENDERSUB->TARGET/TARGETSUB")); sessionID = new SessionID("FIX.4.2", "SENDER", "SENDERSUB", "SENDERLOC", "TARGET", "TARGETSUB", "TARGETLOC"); Assert.That(sessionID.ToString(), Is.EqualTo("FIX.4.2:SENDER/SENDERSUB/SENDERLOC->TARGET/TARGETSUB/TARGETLOC")); sessionID = new SessionID("FIX.4.2", "SENDER", "SENDERSUB", "SENDERLOC", "TARGET", "TARGETSUB", "TARGETLOC", "QUALIFIER"); Assert.That(sessionID.ToString(), Is.EqualTo("FIX.4.2:SENDER/SENDERSUB/SENDERLOC->TARGET/TARGETSUB/TARGETLOC:QUALIFIER")); }