Thread: [Quickfix-developers] StartDay and EndDay keys
Brought to you by:
orenmnero
From: Thiago M. <thi...@cm...> - 2008-08-11 16:08:56
|
Hi guys, I have a problem about StartDay and EndDay keys. When this keys are presents i don't get disconnect because isSessionTime just return true File: SessionTime.cpp Method: isSessionTime ( currentDay == startDay && startDay < endDay ) is true but ( timeOnly > endTime ) too is true I think that missing this ..... else if( currentDay == startDay && timeOnly > endTime ) return false; "Houston, have we a problem ?" sorry for my english...it's so so else if( startDay < endDay ) { if( currentDay < startDay || currentDay > endDay ) return false; else if( currentDay == startDay && ( timeOnly < startTime ) || ( timeOnly > endTime ) ) return false; else if( currentDay == endDay && timeOnly > endTime ) return false; } tks |
From: George H. <ge...@so...> - 2008-08-14 21:35:35
|
Hello everyone, During runtime I want to read a file, with field names, and when a deal comes in, just print to screen the fields I am interested in (for starters). However, I see that the field names are enum'ed from file: FieldNumbers.h How do I generate a field number from a string? Is there a built-in way of doing this or do I have to (somehow) keep a copy of "FieldNumbers.h" in my executable? Or, worst case, keep the fields I am interested in as numbers in the setup file? This is not at all user friendly and I would like to avoid that. -G |
From: George H. <ge...@so...> - 2008-08-15 16:28:25
|
Hello again everyone, Here is some more info on what I am trying to do: Let's say I have a file called: fixfields.cfg In the file I have: OrderQty Symbol Price ClOrdID Side Currently, from: "Application::onMessage" function, I do: FIX::Symbol symbol; FIX::Side side; FIX::OrderQty orderQty; FIX::Price price; FIX::ClOrdID clOrdID; ... ... message.get( symbol ); message.get( side ); message.get( orderQty ); message.get( price ); message.get( clOrdID ); I am sure you recognize this as the sample executor application. What I want to do is: message.get( "symbol_1_from_file" ); message.get( "symbol_2_from_file" ); message.get( "symbol_3_from_file" ); ... ... You see, what I want to do is "message.get" for the fields I read in from the config file. This way the fields are not hard coded in the app. The question is, is there a way to get the field, as a string, and then find the appropriate enum? I hope this makes more sense. Also, and this is a big one, I am a "C" programmer. I am relatively new to "C++". So, please bear with me. -George On Aug 14, 2008, at 5:34 PM, George Hrysanthopoulos wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > Hello everyone, > > During runtime I want to read a file, with field names, and when a > deal comes in, just print to screen > the fields I am interested in (for starters). > > However, I see that the field names are enum'ed from file: > FieldNumbers.h > > How do I generate a field number from a string? Is there a built-in > way of doing this > or do I have to (somehow) keep a copy of "FieldNumbers.h" in my > executable? > > Or, worst case, keep the fields I am interested in as numbers in the > setup file? > This is not at all user friendly and I would like to avoid that. > > -G > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |
From: Mike G. <mg...@co...> - 2008-08-30 16:47:38
|
George, If I understand correctly, you need a lookup of field name (as string) -> field number (as int)? What about leveraging the code generator? I.e. create a stylesheet in the spec/ dir: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" encoding="UTF-8"/> <xsl:template match="text()"/> <xsl:template match="/">/* -*- C++ -*- */ <xsl:copy-of select="document('COPYRIGHT.xml')"/> #ifndef FIX_FIELDNAMESTONUMBERS_H #define FIX_FIELDNAMESTONUMBERS_H #include <map> #include <string> class FieldNamesToNumbers { private: std::map<std::string,int> fieldNamesToNumbers_; public: int get(const std::string & fieldName) { return fieldNamesToNumbers_[fieldName]; } FieldNamesToNumbers() { <xsl:apply-templates/> } }; #endif </xsl:template> <xsl:template match="fields/field"> fieldNamesToNumbers_["<xsl:value-of select="@name"/>"] = <xsl:value-of select="@number"/>; </xsl:template> </xsl:stylesheet> Run this command (or better yet, add it to spec/generate_c++.sh): xsltproc -o ../src/C++/FieldNamesToNumbers.h FieldNamesToNumbers.xsl FIX44.xml And in your code: #include <quickfix/FieldNamesToNumbers.h> FieldNamesToNumbers conv; /* ... */ message.getField(conv.get(field_name_1_from_config_file)); message.getField(conv.get(field_name_2_from_config_file)); Now you'll always be up-to-date with the lastest data dictionary. Simply re-run the generator if it changes. -- Mike Gatny Connamara Systems, LLC http://www.connamara.com/ |
From: George H. <ge...@so...> - 2008-09-02 23:08:36
|
Mike, After reading your message I felt like a neanderthal man watching the space shuttle take off (and with the same level of understanding). I did not even realize it could be done this way. So, many thanks for this very cool piece of code. This was my approach: Given a file of Field names that I am interested in: 1 # 2 # 3 # @(#) $Id: system.tgs xxxx 2008-08-22 04:29:18Z svn $ 4 # @(#) Test Field Tags 5 # 6 ClOrdID # 11 7 MsgType # 35 8 OrderQty # 38 9 OrdType # 40 10 Price # 44 11 Side # 54 12 Symbol # 55 I create a string-to-field number using XML reader against the Data Dictionary. This means that the Data Dictionary must be used. In the code I do: In global.h // // Simple class to keep track of names and tags class Tags2Nums { public: std::string name; int number; std::string strNumber; int header; int trailer; int required; }; std::string lmsgstr; // // The vector below is used to keep track on the name <-> number relationship vector<Tags2Nums> tagVector; In Application.cpp for( unsigned int ui=0; ui < tagVector.size(); ui++ ) { if( !tagVector[ui].header ) { // // Get the text of the message lmsgstr = message.getField(tagVector[ui].number); std::cerr << "\t" << tagVector[ui].name << ":" << "[" << tagVector[ui].number << "] " << lmsgstr << std::endl; } else { // Header tags are processed differently printf("\tFound Header Tag\n"); } } Does this make sense or am I really on the wrong track here? -George On Aug 30, 2008, at 12:47 PM, Mike Gatny wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > George, > > If I understand correctly, you need a lookup of field name (as string) > -> field number (as int)? > > What about leveraging the code generator? I.e. create a stylesheet in > the spec/ dir: > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="text" encoding="UTF-8"/> > > <xsl:template match="text()"/> > > <xsl:template match="/">/* -*- C++ -*- */ > <xsl:copy-of select="document('COPYRIGHT.xml')"/> > #ifndef FIX_FIELDNAMESTONUMBERS_H > #define FIX_FIELDNAMESTONUMBERS_H > > #include <map> > #include <string> > > class FieldNamesToNumbers > { > private: > std::map<std::string,int> fieldNamesToNumbers_; > > public: > > int get(const std::string & fieldName) > { > return fieldNamesToNumbers_[fieldName]; > } > > FieldNamesToNumbers() > { > <xsl:apply-templates/> > } > }; > > #endif > </xsl:template> > <xsl:template match="fields/field"> > fieldNamesToNumbers_["<xsl:value-of select="@name"/>"] = > <xsl:value-of > select="@number"/>; > </xsl:template> > </xsl:stylesheet> > > Run this command (or better yet, add it to spec/generate_c++.sh): > xsltproc -o ../src/C++/FieldNamesToNumbers.h FieldNamesToNumbers.xsl > FIX44.xml > > And in your code: > > #include <quickfix/FieldNamesToNumbers.h> > FieldNamesToNumbers conv; > /* ... */ > message.getField(conv.get(field_name_1_from_config_file)); > message.getField(conv.get(field_name_2_from_config_file)); > > Now you'll always be up-to-date with the lastest data dictionary. > Simply re-run the generator if it changes. > > -- > Mike Gatny > Connamara Systems, LLC > http://www.connamara.com/ > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |
From: Mike G. <mg...@co...> - 2008-09-04 03:41:23
|
> Does this make sense or am I really on the wrong track here? This looks to me like it gets the job done, so I say go with it. -- Mike Gatny Connamara Systems, LLC http://www.connamara.com/ |
From: George H. <ge...@so...> - 2008-09-02 22:48:04
|
Hello everyone, I noticed that the executor(acceptor) sample app has: "Application::fromAdmin" defined and active (in Application.cpp). However, the fixclient (initiator) app does not have this defined, only a function prototype: Application.h: void toAdmin( FIX::Message&, const FIX::SessionID& ) {} Application.h: void fromAdmin( const FIX::Message&, const FIX::SessionID& ) Is Application::fromAdmin only for acceptor applications? If not, is there some sample code that shows what kind of events and actions can be processed there from an initiator app? Thanks in advance for your help. -George |
From: Andrei G. <an...@gm...> - 2008-09-03 00:40:43
|
On Tue, Sep 2, 2008 at 7:47 PM, George Hrysanthopoulos <ge...@so...> wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > > Hello everyone, > I noticed that the executor(acceptor) sample app has: "Application::fromAdmin" defined and active (in Application.cpp). > However, the fixclient (initiator) app does not have this defined, only a function prototype: > Application.h: void toAdmin( FIX::Message&, const FIX::SessionID& ) {} > Application.h: void fromAdmin( const FIX::Message&, const FIX::SessionID& ) > Is Application::fromAdmin only for acceptor applications? > If not, is there some sample code that shows what kind of events and actions can be processed there from an initiator app? > Thanks in advance for your help. > -George All incoming session level messages (i.e. Logon, Heartbeat, ...) end up showing in the fromAdmin method. It doesn't matter if the application is an acceptor/initiator. |
From: Shane T. <str...@co...> - 2008-09-10 13:21:55
|
What is your current configuration setting for start/end day and time? On Mon, Aug 11, 2008 at 11:11 AM, Thiago Melo <thi...@cm...>wrote: > QuickFIX Documentation: > http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > > Hi guys, > > I have a problem about StartDay and EndDay keys. > > When this keys are presents i don't get disconnect because isSessionTime > just return true > > File: SessionTime.cpp > Method: isSessionTime > > ( currentDay == startDay && startDay < endDay ) is true but ( timeOnly > > endTime ) too is true > > I think that missing this ..... > > else if( currentDay == startDay && timeOnly > endTime ) > return false; > > "Houston, have we a problem ?" > > sorry for my english...it's so so > > else if( startDay < endDay ) > { > if( currentDay < startDay || currentDay > endDay ) > return false; > else if( currentDay == startDay && ( timeOnly < startTime ) || > ( timeOnly > endTime ) ) > return false; > else if( currentDay == endDay && timeOnly > endTime ) > return false; > } > > tks > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > -- Shane Trotter Connamara Systems, LLC |