-1

This is the test output from a slightly modified quickfix/examples/tradeclient/Application.cpp

<message>
  <header>
    <field number="8"><![CDATA[FIX.4.4]]></field>
    <field number="35"><![CDATA[V]]></field>
    <field number="1"><![CDATA[CLIENT1]]></field>
    <field number="15"><![CDATA[USD]]></field>
    <field number="38"><![CDATA[1]]></field>
    <field number="49"><![CDATA[CLIENT1]]></field>
    <field number="55"><![CDATA[EUR/USD]]></field>
    <field number="56"><![CDATA[EXECUTOR]]></field>
    <field number="108"><![CDATA[10]]></field>
    <field number="146"><![CDATA[1]]></field>
    <field number="265"><![CDATA[0]]></field>
    <field number="448"><![CDATA[EXECUTOR]]></field>
    <field number="453"><![CDATA[1]]></field>
  </header>
  <body>
    <field number="146"><![CDATA[1]]></field>
    <field number="262"><![CDATA[MARKETDATAID]]></field>
    <field number="263"><![CDATA[0]]></field>
    <field number="264"><![CDATA[0]]></field>
    <field number="267"><![CDATA[1]]></field>
    <group>
      <field number="55"><![CDATA[EUR/USD]]></field>
    </group>
    <group>
      <field number="269"><![CDATA[0]]></field>
    </group>
  </body>
  <trailer>
  </trailer>
</message>



8=FIX.4.49=15735=V1=CLIENT115=USD38=149=CLIENT155=EUR/USD56=EXECUTOR108=10146=1265=0448=EXECUTOR453=1146=155=EUR/USD262=MARKETDATAID263=0264=0267=1269=010=045

OUT: 8=FIX.4.49=18735=V1=CLIENT115=USD34=738=149=CLIENT152=20131101-13:09:38.92355=EUR/USD56=EXECUTOR108=10146=1265=0448=EXECUTOR453=1146=155=EUR/USD262=MARKETDATAID263=0264=0267=1269=010=223

How do I get the value of EUR/USD for streaming into a chart such as Qt Chart Director?

This is the code I have modified so and recompiled so far:

FIX44::MarketDataRequest Application::queryMarketDataRequest44()
{
  FIX::MDReqID mdReqID( "MARKETDATAID" );
  FIX::SubscriptionRequestType subType( FIX::SubscriptionRequestType_SNAPSHOT );
  FIX::MarketDepth marketDepth( 0 );

  FIX44::MarketDataRequest::NoMDEntryTypes marketDataEntryGroup;
  FIX::MDEntryType mdEntryType( FIX::MDEntryType_BID );
  marketDataEntryGroup.set( mdEntryType );

  FIX44::MarketDataRequest::NoRelatedSym symbolGroup;
  FIX::Symbol symbol( "EUR/USD" );
  symbolGroup.set( symbol );

//FIX::StrikeCurrency strikecurrency( "USD" );

  FIX44::MarketDataRequest message( mdReqID, subType, marketDepth );
  message.addGroup( marketDataEntryGroup );
  message.addGroup( symbolGroup );
//  message.addGroup( strikeCurrency );


//message.StrikeCurrency = "USD";

message.getHeader().setField(35, "V"); 
    message.getHeader().setField(265, "0"); 
    message.getHeader().setField(1, "CLIENT1"); 
    //message.getHeader().setField(267, "2"); 
    message.getHeader().setField(146, "1"); 
    message.getHeader().setField(55, "EUR/USD"); 
    message.getHeader().setField(38, "1"); 
    message.getHeader().setField(15, "USD");//????? 
    message.getHeader().setField(453, "1"); 

    message.getHeader().setField(448, "EXECUTOR");

    message.getHeader().setField(108, "10"); 

  queryHeader( message.getHeader() );

  std::cout << message.toXML() << std::endl;
  std::cout << message.toString() << std::endl;

  return message;
}

Is this type safe?

1 Answers1

-1

tag 6/31 would be places to check for prices. One can look at the code for quickfixj as reference for checking type safe options - Using tag numbers is the least type safe option. Hope it helps

http://www.quickfixj.org/quickfixj/usermanual/1.5.3/usage/receiving_messages.html

Update: http://www.quickfixj.org/quickfixj/usermanual/1.5.3/usage/receiving_messages.html Please check the most type safe option. If you are receiving pricing from a market maker, you can use the onMessage method for the corresponding FIX 4.4 message. Inside the onMessage (which will get invoked once you receive the mkt data message), you can retrieve the price by specifying the type and using that in the message.get call - if that does not work for you any reason (which it should for pricing), then look at using the tag number as an alternate.

I tried:

std::cout << "AvgPx: " << message.getHeader().getField(6) << std::endl << std::endl;

...and also...

std::cout << "AvgPx: " << message.getField(6) << std::endl << std::endl;

...for both tags 6 and 31 but get an error "Field not found"

ANOTHER UPDATE

std::cout << "Px: " << message.get(FIX::FIELD::Price) << std::endl << std::endl;

Using just message.get generates the following compiler errors...

~/Downloads/quickfix/examples/tradeclient$ make g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I.. -g -O2 -Wall -ansi -Wpointer-arith -Wwrite-strings -I/usr/include/libxml2 -MT Application.o -MD -MP -MF .deps/Application.Tpo -c -o Application.o Application.cpp Application.cpp: In member function ‘FIX44::MarketDataRequest Application::queryMarketDataRequest44()’: Application.cpp:589:45: error: no matching function for call to ‘FIX44::MarketDataRequest::get(int)’ Application.cpp:589:45: note: candidates are: ../../include/quickfix/fix44/MarketDataRequest.h:29:5: note: FIX::MDReqID& FIX44::MarketDataRequest::get(FIX::MDReqID&) const ../../include/quickfix/fix44/MarketDataRequest.h:29:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::MDReqID&’ ../../include/quickfix/fix44/MarketDataRequest.h:30:5: note: FIX::SubscriptionRequestType& FIX44::MarketDataRequest::get(FIX::SubscriptionRequestType&) const ../../include/quickfix/fix44/MarketDataRequest.h:30:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::SubscriptionRequestType&’ ../../include/quickfix/fix44/MarketDataRequest.h:31:5: note: FIX::MarketDepth& FIX44::MarketDataRequest::get(FIX::MarketDepth&) const ../../include/quickfix/fix44/MarketDataRequest.h:31:5: note:
no known conversion for argument 1 from ‘int’ to ‘FIX::MarketDepth&’ ../../include/quickfix/fix44/MarketDataRequest.h:32:5: note: FIX::MDUpdateType& FIX44::MarketDataRequest::get(FIX::MDUpdateType&) const ../../include/quickfix/fix44/MarketDataRequest.h:32:5: note:
no known conversion for argument 1 from ‘int’ to ‘FIX::MDUpdateType&’ ../../include/quickfix/fix44/MarketDataRequest.h:33:5: note: FIX::AggregatedBook& FIX44::MarketDataRequest::get(FIX::AggregatedBook&) const ../../include/quickfix/fix44/MarketDataRequest.h:33:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::AggregatedBook&’ ../../include/quickfix/fix44/MarketDataRequest.h:34:5: note: FIX::OpenCloseSettlFlag& FIX44::MarketDataRequest::get(FIX::OpenCloseSettlFlag&) const ../../include/quickfix/fix44/MarketDataRequest.h:34:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::OpenCloseSettlFlag&’ ../../include/quickfix/fix44/MarketDataRequest.h:35:5: note: FIX::Scope& FIX44::MarketDataRequest::get(FIX::Scope&) const ../../include/quickfix/fix44/MarketDataRequest.h:35:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::Scope&’ ../../include/quickfix/fix44/MarketDataRequest.h:36:5: note: FIX::MDImplicitDelete& FIX44::MarketDataRequest::get(FIX::MDImplicitDelete&) const ../../include/quickfix/fix44/MarketDataRequest.h:36:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::MDImplicitDelete&’ ../../include/quickfix/fix44/MarketDataRequest.h:37:5: note: FIX::NoMDEntryTypes& FIX44::MarketDataRequest::get(FIX::NoMDEntryTypes&) const ../../include/quickfix/fix44/MarketDataRequest.h:37:5: note: no known conversion for argument 1 from ‘int’ to ‘FIX::NoMDEntryTypes&’ ../../include/quickfix/fix44/MarketDataRequest.h:44:5: note: FIX::NoRelatedSym& FIX44::MarketDataRequest::get(FIX::NoRelatedSym&) const ../../include/quickfix/fix44/MarketDataRequest.h:44:5: note:
no known conversion for argument 1 from ‘int’ to ‘FIX::NoRelatedSym&’ make: * [Application.o] Error 1

This was fixed due to a scoping error.

YET ANOTHER UPDATE

Here is my hacked Application.cpp from tradeclient...

Lines added:

#include "quickfix/SessionID.h"


FIX44::MarketDataRequest Application::queryMarketDataRequest44()
{
    FIX::MDReqID mdReqID( "CLIENT1" );
    ...
    FIX::Symbol symbol( "EUR/USD" );
    ...

    FIX::SessionID sessionID;
    FIX44::ExecutionReport execReport;
    Application::onMessage(execReport, sessionID);
    ...

The following code...

std::cout << std::endl  << "OUT: " << message << std::endl << "Px: " << message.getHeader().getField(FIX::FIELD::Price) << std::endl << std::endl;

...generates the following error:

quickfix/bin$ ./tradeclient cfg/tradeclient.cfg  
1) Enter Order
2) Cancel Order
3) Replace Order
4) Market data test
5) Quit
Action: 
Logon - FIX.4.4:CLIENT1->EXECUTOR
4

1) FIX.4.0
2) FIX.4.1
3) FIX.4.2
4) FIX.4.3
5) FIX.4.4
6) FIXT.1.1 (FIX.5.0)
BeginString: 5

MarketDataRequest

SenderCompID: CLIENT1

TargetCompID: EXECUTOR

Use a TargetSubID?: n
<message>
  <header>
    <field number="8"><![CDATA[FIX.4.4]]></field>
    <field number="35"><![CDATA[V]]></field>
    <field number="49"><![CDATA[CLIENT1]]></field>
    <field number="56"><![CDATA[EXECUTOR]]></field>
  </header>
  <body>
    <field number="146"><![CDATA[1]]></field>
    <field number="262"><![CDATA[CLIENT1]]></field>
    <field number="263"><![CDATA[0]]></field>
    <field number="264"><![CDATA[0]]></field>
    <field number="267"><![CDATA[1]]></field>
    <group>
      <field number="55"><![CDATA[EUR/USD]]></field>
    </group>
    <group>
      <field number="269"><![CDATA[0]]></field>
    </group>
  </body>
  <trailer>
  </trailer>
</message>
    8=FIX.4.49=8135=V49=CLIENT156=EXECUTOR146=155=EUR/USD262=CLIENT1263=0264=0267=1269=010=097
Px: 44
terminate called after throwing an instance of 'FIX::FieldNotFound'
  what():  Field not found
Aborted (core dumped)

LATEST UPDATE YET

The fields we need aren't being listed in the XML output.

How do we specify a message to send a request for all the pricing related fields (6/31) or is using enum best? e.g. Price.

How and where do I print the price for FIX4.4?

ali haider
  • 19,175
  • 17
  • 80
  • 149