Re: [Quickfix-developers] sendToTarget and "SessionNotFound" woes...
Brought to you by:
orenmnero
From: Alex M. <ale...@ya...> - 2008-07-01 12:43:27
|
Same errors. Apologies for the confusion, I was trying various combinations and I copied the latest (working) version of my INI file when I was using the type-safe code. Rgds, Alexandros ----- Original Message ---- From: John Haldi <jo...@ha...> To: Alex Marangos <ale...@ya...> Sent: Tuesday, 1 July, 2008 1:36:23 PM Subject: RE: [Quickfix-developers] sendToTarget and "SessionNotFound" woes... Alex, I'm a little confused. If you want to write FIX-version agnostic code, why are you using the DataDictionary for 4.0? I don't know the details under the hood for the SendToTarget method, but what happens if you change UseDataDictionary to N, strip the DataDictionary entry from the config file completely, and then use the SendToTarget(msg,sID) signature with the quickfix.message object? John ________________________________ From: qui...@li... [mailto:qui...@li...urceforge..net] On Behalf Of Alex Marangos Sent: Tuesday, July 01, 2008 8:11 AM To: qui...@li... Subject: [Quickfix-developers] sendToTarget and "SessionNotFound" woes... Hi all, I'm writing a simple QuickFix application (just evaluating it for now) in C#, and I'm having problems getting sendToTarget to work... Sorry for the length of this email, but I'm completely baffled by what does and doesn't work.... So far, I've created a ThreadedSocketInitiator with the following config: [DEFAULT] ConnectionType=acceptor SocketAcceptPort=40000 ReconnectInterval=60 FileStorePath=Logs\QuickFIX.Acceptor FileLogPath=Logs\QuickFIX.Acceptor PersistMessages=Y [SESSION] BeginString=FIX.4.0 SenderCompID=ACCEPTOR40 TargetCompID=INITIATOR40 StartTime=00:00:00 EndTime=23:59:59 HeartBtInt=5 UseDataDictionary=Y DataDictionary=FIX40.xml ValidateFieldsHaveValues=Y ValidateFieldsOutOfOrder=N On the receiving end I have an instance of the executor running, with the appropriate session configuration. I can start both applications and the sessions connect and heartbeat. Now I'm confused as to what's needed when creating a FIX message and using sendToTarget() in my application, as in some cases it works, in others it doesn't. The code to create and send the message looks like: 01: stringbeginString = "FIX.4.0"; 02: stringsenderCompID = "INITIATOR40"; 03: stringtargetCompID = "ACCEPTOR40"; 04: QuickFix.Messagefixmsg = newQuickFix.Message(); 05: QuickFix.BeginStringbgn = newBeginString(beginString); 06: QuickFix.SenderCompIDscid = newSenderCompID(senderCompID); 07: QuickFix.TargetCompIDtcid = newTargetCompID(targetCompID); 08: QuickFix.MsgTypemsgType = newQuickFix.MsgType(QuickFix.MsgType.ORDER_SINGLE); 09: QuickFix.OrdTypeordType = newQuickFix.OrdType(QuickFix.OrdType.MARKET); 10: intrnd = newSystem.Random().Next(); 11: QuickFix.ClOrdIDclOrdID = newQuickFix.ClOrdID(rnd.ToString()); 12: QuickFix.HandlInsthandlInst = newQuickFix.HandlInst(QuickFix.HandlInst.AUTOMATED_EXECUTION_ORDER_PUBLIC); 13: QuickFix.OrderQtyorderQty = newQuickFix.OrderQty(1000); 14: QuickFix.Symbolsymbol = newQuickFix.Symbol("IBM"); 15: QuickFix.Sideside = newQuickFix.Side(QuickFix.Side.BUY); 16: fixmsg.getHeader().setField(bgn); 17: fixmsg.getHeader().setField(scid); 18: fixmsg.getHeader().setField(tcid); 19: fixmsg.setField(ordType); 20: fixmsg.setField(msgType); 21: fixmsg.setField(clOrdID); 22: fixmsg.setField(handlInst); 23: fixmsg.setField(symbol); 24: fixmsg.setField(side); 25: fixmsg.setField(orderQty); 26: fixmsg.setField(ordType); 27: Console.WriteLine("Message to send: {0}", fixmsg.ToString()); 28: Console.WriteLine("BeginString: {0}", beginString); 29: Console.WriteLine("SenderCompID: {0}", senderCompID); 30: Console.WriteLine("TargetCompID: {0}", targetCompID); 31: SessionIDsID = newSessionID(beginString, senderCompID, targetCompID); 32: Console.WriteLine("Session Exists: {0}", Session.doesSessionExist(sID)); 33: Session.sendToTarget(fixmsg, senderCompID, targetCompID); This throws a "SessionNotFound" error. Session.doesSessionExist(sID) returns "True", however... And if I replace sendToTarget() with: Session.sendToTarget(fixmsg, sID); I get an exception as follows: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at _CxxThrowException(Void* , _s__ThrowInfo* ) at FIX.FieldMap.getField(FieldMap* , FieldBase* field) at Application.create(Application* , Message* unmanaged) at Application.toApp(Application* , Message* message, SessionID* sessionID) at FIX.Session.sendToTarget(Message* , SessionID* ) at QuickFix.Session.sendToTarget(Message message, SessionID sessionID) at QuickFIXMessageProvider.MessageProvider.Test2() in C:\Temp\QuickFIX\Prototypes\Test\Properties\MessageSender.cs:line 357 at QuickFIXMessageProvider.MessageProvider.ReceivedMsg(Message msg, String SenderCompID, String TargetCompID, String BeginString) in C:\Temp\QuickFIX\Prototypes\Test\Properties\MessageSender.cs:line 245 Now, if I change my code above to use QuickFix40.NewOrderSingle (instead of QuickFix.Message), it works... So just change line 04 to read: 04: QuickFix40.NewOrderSinglefixmsg = newQuickFix40.NewOrderSingle(); (commenting out lines 08 and 20 which set the MsgType) With the above changes (using version-specific message class), sendToTarget works fine, regardles of which method signature I use... (and sendToTarget(fixmsg, sID) doesn't throw the above exception either, it works fine). I'd like to avoid using FIX version-specific code if possible, which is why I'm trying to figure out what I need to do to get my code above to work correctly. Any help would be appreciated. Rgds, Alexandros ________________________________ Not happy with your email address? Get the one you really want - millions of new email addresses available now at Yahoo! No virus found in this incoming message. Checked by AVG. Version: 8.0.101 / Virus Database: 270.4.3/1526 - Release Date: 6/30/2008 8:43 AM __________________________________________________________ Not happy with your email address?. Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html |