Re: [Quickfix-developers] out of sequence messages
Brought to you by:
orenmnero
From: Oren M. <ore...@ya...> - 2004-03-18 14:25:17
|
Any idea why two logon messages are being sent? --- Vijay Singh Yadav <vy...@op...> wrote: > Hello All, > I am writing an order routing gateway that collects > orders from various clients and sends them to a FIX > acceptor i.e. I am using the QuickFix initiator in > my code. The initiator sends messages to the > acceptor out of sequence. This leads to session > termination and incorrect processing. Any ideas are > welcome and appreciated. > > Thanks, > > -- Vijay > > 8=FIX.4.19=5935=A34=149=MEHI52=20040316-14:12:0656=OCON98=0108=3010=131 > > 8=FIX.4.19=4735=034=249=MEHI52=20040316-14:12:3856=OCON10=092 > > 8=FIX.4.19=9335=D34=349=MEHI52=20040316-14:12:5256=OCON1=MQOT11=321=138=10040=154=55=MSFT59=010=053 > > 8=FIX.4.19=5935=A34=549=MEHI52=20040316-14:14:1856=OCON98=0108=3010=140 > > 8=FIX.4.19=9135=D34=649=MEHI52=20040316-14:14:3856=OCON1=MQOT11=521=138=140=154=55=SPX59=010=160 > > 8=FIX.4.19=12035=D34=343=Y49=MEHI52=20040316-14:14:4256=OCON122=20040316-14:12:521=MQOT11=321=138=10040=154=55=MSFT59=010=142 > > 8=FIX.4.19=9235=D34=749=MEHI52=20040316-14:14:4256=OCON1=MQOT11=621=138=1240=154=55=SPX59=010=208 > > 8=FIX.4.19=6035=A34=1049=MEHI52=20040316-14:14:5156=OCON98=0108=3010=173 > > As you can see sequence numbers 1-3 were sent in > order. Sequence number 4 is missing and sequence > number 3 is resent after sequence 6. Sequence 8 and > 9 are missing. > > I am pasing C# code below (I have stripped off the > try/catch blocks for brevity's sake) > > namespace IMTC_FIXInitiator > { > class Executor > { > private SocketInitiator m_initiator; > private Thread WorkerThread; > public Executor() > { > } > public void Go() > { > SessionSettings settings = new > SessionSettings("OCONNER.CFG"); > Application application = new Application(); > FileStoreFactory factory = new > FileStoreFactory(settings); > FileLogFactory logFactory = new > FileLogFactory("output"); > MessageFactory messageFactory = new > DefaultMessageFactory(); > m_initiator = new SocketInitiator (application, > factory, > settings, > logFactory, > messageFactory); > m_initiator.start(); > Console.WriteLine ("Initiator started"); > while (!application.IsConnected()) > { > Console.WriteLine ("Waiting to establish a > connection with FIX server"); > Thread.Sleep(100); > } > ProcessOrders(); > > } > public void Stop() {m_initiator.stop();} > private void ProcessOrders() > { > SqlConnection Conn=new SqlConnection(); > Conn.ConnectionString="Data Source=10.60.0.104; > Integrated Security=SSPI;" + > "Initial Catalog=imt; uid=sa;pwd=;Connect > Timeout=5"; > > SqlCommand myCMD=new SqlCommand(); > myCMD.CommandType=CommandType.StoredProcedure; > myCMD.CommandText="GetOrders"; > myCMD.Connection=Conn; > > myCMD.Parameters.Add("@cOrderStatus",SqlDbType.Char,1).Value='N'; > > SqlDataAdapter da; > da=new SqlDataAdapter(); > da.SelectCommand=myCMD; > DataSet ds=new DataSet(); > Conn.Open(); > while(true) > { > da.Fill(ds); > Conn.Close(); > > DataRow[]currRows=ds.Tables[0].Select(null,null,DataViewRowState.CurrentRows); > foreach(DataRow myRow in currRows) > { > Console.WriteLine("Submitting order with > client order id = "+myRow["orderid"]); > SendOrder(Convert.ToInt32(myRow["orderid"]), > Convert.ToString(myRow["symbol"]), > Convert.ToChar(myRow["orderside"]), > Convert.ToInt32(myRow["qty"])); > } > Console.Write("No new orders to be submitted"); > > } > } > > > > public void SendOrder(int oid,string osym,char > osd,int oqty) > { > Message order; > Side side; > ClOrdID id=new ClOrdID(oid.ToString()); > HandlInst inst=new > HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE); > Symbol sym=new Symbol(osym); > Side sd=new Side(osd); > OrdType otyp=new OrdType(OrdType.MARKET); > QuickFix41.NewOrderSingle newOrderSingle=new > QuickFix41.NewOrderSingle(id,inst,sym,sd,otyp); > > newOrderSingle.set(new Account("MQOT")); > newOrderSingle.set(new OrderQty(oqty)); > newOrderSingle.set(new > TimeInForce(TimeInForce.DAY)); > newOrderSingle.getHeader().setField(new > SenderCompID("MEHI")); > newOrderSingle.getHeader().setField(new > TargetCompID("OCON")); > > order = newOrderSingle; > Session.sendToTarget(order); > } > } > } > > > N¬HS^µéX¬²'²Þu¼ÂâìSºÚ+©l·.)îÆÛ¢¸Þ±éíyÖò ©âzThm¸§°úÞ²'^Ö§t!¡ñ:(µç!h'¬-æ«ëÞ¯+ax®ºwZéíj[-¢Ì¬µévh§Ëkjبm§ÿÚvÊ,vw(öõã½Z÷ë(§%ɺ'$~,]z÷¥¢«²f¢)à+-Bèø±uëÞ^®Éb²Û,¢êÜyú+éÞ¶m¦Ïÿ+-²Ê.Ç¢¸ë+-³ùb²Ø§~êº'$~,]z÷¥¢« __________________________________ Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://mail.yahoo.com |