Re: [Quickfix-developers] Just Starting...
Brought to you by:
orenmnero
From: Patrick W. <pw...@ka...> - 2008-01-16 23:03:08
|
You need to call the crack method. In this example I create an AdapterTradeResult class which encapsulates the response in a way which is sensible for my systems (sorry about formatting).=20 My Application-Derived class (not included here) calls this adapter whenever it receives a message. =09 public class QuickFixAdapter : MessageCracker { ..... public virtual void fromAdmin(Message message_, SessionID session_) { crack(message_, session_); } public virtual void fromApp(Message message_, SessionID session_) { crack(message_, session_); } =20 public override void onMessage(QuickFix42.ExecutionReport message_, SessionID session) { OrdType ordType =3D message_.getOrdType(); SecurityType secType =3D message_.getSecurityType(); ClOrdID orderId =3D message_.getClOrdID(); OrderID tradeId =3D message_.getOrderID(); ExecTransType transType =3D message_.getExecTransType(); ExecType type =3D message_.getExecType(); OrdRejReason reason =3D new OrdRejReason(); Text text =3D new Text(); if (message_.isSetOrdRejReason()) { reason =3D message_.getOrdRejReason(); } if (message_.isSetText()) { text =3D message_.getText(); } Symbol symbol =3D message_.getSymbol(); Currency currency =3D message_.getCurrency(); Side side =3D message_.getSide(); Price price =3D new Price(); if (message_.isSetPrice()) { price =3D message_.getPrice(); } OrderQty qty =3D new OrderQty(); if (message_.isSetOrderQty()) { qty =3D message_.getOrderQty(); } TransactTime transactTime =3D new TransactTime(); if (message_.isSetTransactTime()) { transactTime =3D message_.getTransactTime(); } char execType =3D type.getValue(); switch (execType) { case Configuration.Constants.EXEC_TYPE_FILLED: { =20 AdapterTradeResult tr =3D new AdapterTradeResult(); tr.AdapterType =3D _type; tr.Status =3D = eOrderAutoTradeResultStatus.Success; tr.Quantity =3D (int)qty.getValue(); tr.Price =3D price.getValue(); tr.Direction =3D side.getValue() =3D=3D Configuration.Constants.SIDE_BUY ? eOrderDirection.Buy : eOrderDirection.Sell; tr.TradeTime =3D transactTime.getValue(); tr.ExecutionOrderId =3D eeOrder.EEOrderId; tr.FillId =3D tradeId.getValue(); } break; case Configuration.Constants.EXEC_TYPE_REJECTED: { =20 string rejectionReason =3D "Rejection code: " + Convert.ToInt32(reason.getValue()); rejectionReason +=3D " description: " + text.getValue(); AdapterTradeResult tr =3D new AdapterTradeResult(); tr.AdapterType =3D _type; tr.Status =3D eOrderAutoTradeResultStatus.Rejected; tr.Description =3D rejectionReason; tr.TradeTime =3D transactTime.getValue(); } break; } //now I send the AdapterTradeResult message to downstream systems for processing ...... } } Good luck. Patrick -----Original Message----- From: qui...@li... [mailto:qui...@li...] On Behalf Of azmat Sent: Thursday, 17 January 2008 9:23 AM To: qui...@li... Subject: Re: [Quickfix-developers] Just Starting... QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html I went through the executor project (http://www.quickfixengine.org/quickfix/doc/html/csharp/application_2.ht ml)=20 but I can't see how this is beneficial to me. =20 I have this in my code write now: ThreadedSocketInitiator _initiator =3D null; public void Start() { if (_initiator !=3D null) throw new Exception("Already Started"); SessionSettings settings =3D new SessionSettings("FixSettings.txt"); Application application =3D new QFWrapper(this); FileStoreFactory storeFactory =3D new FileStoreFactory(settings); FileLogFactory logFactory =3D new FileLogFactory(settings); MessageFactory messageFactory =3D new = DefaultMessageFactory(); _initiator =3D new ThreadedSocketInitiator(application, storeFactory, settings, logFactory, messageFactory); _initiator.start(); } I have a qfwrapper class that is a nested class inside of a FixServer class.=20 QFWrapper inherits from MessageCracker and implements the QF Interface methods. The FIXServer class is the class that contains the start, stop and all the delegates I will need in order to function with a windows form. I can now communicate with our brokerage company, but the problem is in dissecting the messages that come back from the FIX Server. How do I (or where do I) take the message apart to realize what type of message it is...so I can then write all the various handling methods for the many different types of messages that we might expect from the Server. I imagine I will need to capture the message (in order to dissect it and run my own business logic) in the fromApp function. But I have no idea how to do any of the FIX Message 'surgery', so to speak.=20 Can someone help shed some light on this? thanks! Azmat Paige wrote: >=20 > QuickFIX Documentation: > http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html >=20 > You should start with the executor project. Review the code, set up a > config file with your connections and see if you can connect. You can go > to the Open Fix testing website to see if you can connect and practice > sending different types of orders. Below is my config file code: >=20 >=20 --=20 View this message in context: http://www.nabble.com/Just-Starting...-tp14811784p14896451.html Sent from the QuickFIX - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |