{{Quickfixn}} Quickfixn : How to write execution report to store file
vishvesh raval
vishveshraval at hotmail.com
Sun Feb 2 22:28:39 PST 2014
SORRY GUYS,I MADE THE CHANGES IN CODE.PLEASE REFER AND GIVE ME SUGGESTION.
Hello, I have created a application to send messages between client-server and I am having a problem on server side.I want to write the incoming NewOrderSingle message( .body extension file) files in store folder on server side.The newordersingle message along with executionreport message get written into store file on client side. but on server side I don’t get application messages(file with .body extension) in store file. How to write the incoming application messages to the file and not the admin messages. My sample code is as follows. public class clsFIXServer : QuickFix.MessageCracker, QuickFix.IApplication { public void FromApp(QuickFix.Message message, QuickFix.SessionID sessionID) { Console.WriteLine("IN: " + message); Crack(message, sessionID); } public void OnCreate(QuickFix.SessionID sessionID) { } public void OnLogon(QuickFix.SessionID sessionID) { } public void OnLogout(QuickFix.SessionID sessionID) { } public void ToAdmin(QuickFix.Message message, QuickFix.SessionID sessionID) { } public void ToApp(QuickFix.Message message, QuickFix.SessionID sessionId) { Console.WriteLine("OUT: " + message); } public void OnMessage(QuickFix.FIX44.NewOrderSingle n, SessionID s) { Symbol symbol = n.Symbol; Side side = n.Side; OrdType ordType = n.OrdType; OrderQty orderQty = n.OrderQty; Price price = new Price(DEFAULT_MARKET_PRICE); ClOrdID clOrdID = n.ClOrdID;
switch (ordType.getValue()) { case OrdType.LIMIT: price = n.Price; if (price.Obj == 0) throw new IncorrectTagValue(price.Tag); break; case OrdType.MARKET: break; default: throw new IncorrectTagValue(ordType.Tag); }
QuickFix.FIX44.ExecutionReport exReport = new QuickFix.FIX44.ExecutionReport( new OrderID(GenOrderID()), new ExecID(GenExecID()), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), symbol, //shouldn't be here? side, new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
exReport.Set(clOrdID); exReport.Set(symbol); exReport.Set(orderQty); exReport.Set(new LastQty(orderQty.getValue())); exReport.Set(new LastPx(price.getValue()));
if (n.IsSetAccount()) exReport.SetField(n.Account);
try { Session.SendToTarget(exReport, s); } catch (SessionNotFound ex) { Console.WriteLine("==session not found exception!=="); Console.WriteLine(ex.ToString()); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
} My client side function that creates the newordersingle message :- public void Run(){objEMSOrder = ((FIXFormatter.EMSOrder)messageQueue.Receive().Body);if (this._session.SessionID.BeginString == "FIX.4.4") { QuickFix.FIX44.NewOrderSingle m = objMessageCreator.NewOrderSingle44MessageCreator(objEMSOrder); //DLL FUNCTION THAT CREATES MESSAGE if (m != null) { m.Header.GetField(Tags.BeginString); SendMessage(m); } }}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20140203/228196d8/attachment-0001.htm>
More information about the Quickfixn
mailing list