[Quickfix-users] Logon Problem
Brought to you by:
orenmnero
From: <rgo...@ve...> - 2011-09-07 13:00:08
|
<HTML> <P>Hi,</P> <P><BR> <SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; FONT: 13px/19px 'Trebuchet MS', Verdana, Tahoma, Arial, sans-serif; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span>I am using QucikFix (C#) to create Fix initiator. I try to logon FXCM server using a username and passwod. But my onLogon method is never triggered. When SocketInitior is started, onCreate method is running then onLogout methot is calling. After onCreate method, the onLogon method should be running but it is not. So always initiator.isLoggedOn() method return false. How can I logon successfully?<BR> <BR> My QuickFix.Application interface implemented application is as follows:<BR> <BR> class MyApp2 : QuickFix44.MessageCracker, QuickFix.Application<BR> {<BR> public SessionID sessionId;<BR> private SessionSettings settings;<BR> private string userName, password, userPin;<BR> private CollInquiryID colInquiryId;<BR> private DateTime startDate;<BR> private const int REQUEST_LIST_OF_TRADING_SESSIONS = 5;<BR> private object requestID = 1;<BR> public MyApp2(QuickFix.SessionSettings setting)<BR> {<BR> long temp = 0;<BR> this.requestID = temp;<BR> this.settings = setting;<BR> }<BR> public void fromAdmin(Message message, SessionID sessionId)<BR> {<BR> try<BR> {<BR> crack(message, sessionId);<BR> }<BR> catch (Exception ex)<BR> {<BR> <BR> throw ex;<BR> }<BR> }<BR> <BR> public void fromApp(Message message, SessionID sessionId)<BR> {<BR> try<BR> {<BR> crack(message, sessionId);<BR> }<BR> catch (Exception ex)<BR> {<BR> <BR> throw ex;<BR> }<BR> }<BR> <BR> public void onCreate(SessionID sessionId)<BR> {<BR> this.sessionId = sessionId;<BR> this.userName = this.settings.get(this.sessionId).getString("username");<BR> this.password = this.settings.get(this.sessionId).getString("password");<BR> <BR> }<BR> <BR> public void onLogon(SessionID sessionId)<BR> {<BR> Console.WriteLine("Login for :{0}", this.userName);<BR> this.startDate = new DateTime();<BR> this.SendUserRequest();<BR> this.SendUserRequest();<BR> }<BR> <BR> public void onLogout(SessionID sessionId)<BR> {<BR> <BR> }<BR> <BR> public void toAdmin(Message message, SessionID sessionId)<BR> {<BR> <BR> }<BR> <BR> public void toApp(Message message, SessionID sessionId)<BR> {<BR> <BR> }<BR> public void SendUserRequest()<BR> {<BR> QuickFix44.UserRequest userRequest = new QuickFix44.UserRequest();<BR> userRequest.setString(UserRequestID.FIELD, this.NextId().ToString());<BR> userRequest.setString(QuickFix.Username.FIELD, this.userName);<BR> userRequest.setString(QuickFix.Password.FIELD, this.password);<BR> userRequest.setInt(QuickFix.UserRequestType.FIELD, REQUEST_LIST_OF_TRADING_SESSIONS);<BR> this.Send(userRequest);<BR> }<BR> public void Send(Message message)<BR> {<BR> try<BR> {<BR> bool isSent = QuickFix.Session.sendToTarget(message, this.sessionId);<BR> }<BR> catch (Exception ex)<BR> {<BR> throw ex;<BR> }<BR> }<BR> private long NextId()<BR> {<BR> lock (this.requestID)<BR> {<BR> long temp = (long)this.requestID;<BR> this.requestID = ++temp;<BR> if (temp > 0x7FFFFFF0)<BR> {<BR> temp = 1;<BR> this.requestID = temp;<BR> }<BR> }<BR> return (long)this.requestID;<BR> }<BR> }<BR> <BR> The main program is as follows:<BR> <BR> string path = "quickfix.cfg";<BR> FileStream reader = new FileStream(path,FileMode.Open);<BR> SessionSettings settings = new SessionSettings(reader);<BR> reader.Close();<BR> MyApp2 application = new MyApp2(settings);<BR> MessageStoreFactory storeFactory = new FileStoreFactory(settings);<BR> LogFactory logFactory = new FileLogFactory(settings);<BR> MessageFactory messageFactory = new DefaultMessageFactory();<BR> SocketInitiator initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory);<BR> initiator.start();</SPAN></P><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; FONT: 13px/19px 'Trebuchet MS', Verdana, Tahoma, Arial, sans-serif; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span> <P><BR> After initiator.start(); the onLogon method is not running.</P> <P>Config file is as follows :</P> <P>[DEFAULT]<BR> FileStorePath=..\store<BR> FileLogPath=..\log<BR> ConnectionType=initiator<BR> StartTime=00:00:00<BR> EndTime=00:00:00<BR> HeartBtInt=30<BR> UseDataDictionary=Y<BR> DefaultMarketPrice=12.30<BR> SocketAcceptPort=80<BR> Timezone=America/New_York<BR> StartDay=Sunday<BR> StartTime=00:00:00<BR> EndDay=Sunday<BR> EndTime=00:00:00<BR> ValidateUserDefinedFields=N<BR> ValidateFieldsHaveValues=N<BR> ValidateFieldsOutOfOrder=N<BR> AllowUnknownMsgFields=Y<BR> SocketTcpNoDelay=Y<BR> ScreenLogShowIncoming=Y<BR> ScreenLogShowOutgoing=Y<BR> ScreenLogShowEvents=Y<BR> ScreenLogShowHeartBeats=Y<BR> ScreenIncludeMilliseconds=Y<BR> DataDictionary=..\FIX44.xml<BR> ContinueInitializationOnError=Y<BR> SocketConnectHost=fixdemo1.fxcorporate.com <BR> SocketConnectPort=80<BR> ResetOnLogon=Y</P> <P>username=xxx<BR> password=xxx</P> <P><BR> [SESSION]<BR> BeginString=FIX.4.4<BR> SenderCompID=xxx<BR> TargetCompID=FXCM<BR> TargetSubID=MINIDEMO<BR> </P></SPAN></HTML> <BR> |