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?