|
From: Joerg T. <Joe...@ma...> - 2007-03-26 08:06:32
|
Hi Mohammad,
On 03/26/2007 08:32 AM, Mohammad Kamran Liaqat wrote:
> I want to send some data with my message which I have dug out from my
> database.How can I attach with my message??
> Here's my code,,
>
>
> * Message message = new Message();
> quickfix.Message.Header header = message.getHeader();
> header.setField(new BeginString("FIX.4.2"));
> header.setField(new SenderCompID("client1"));
> header.setField(new TargetCompID("ifkaar"));
> header.setField(new MsgType("D"));
> message.setField(new HeartBtInt(30));
> message.setField(new EncryptMethod());
> Session.sendToTarget(message);*
> **
> now I wanna attach few String components with my message,,,e.g String
> amount,String account etc. Can anybody help me with how to go about it??
Did you check the "Sending messages" part of the QuickFIX/J docs:
http://www.quickfixj.org/quickfixj/usermanual/usage/sending_messages.html
The best approach would be the section "Most Type Safe... DO THIS!":
import quickfix.fix42.NewOrderSingle;
...
NewOrderSingle order = new NewOrderSingle();
...
order.set( new Account( "aaa" ) );
order.set( new OrderQty( 2000 ) );
Please be careful converting double values to String and back (you could get unexpected .9999... in
the decimal place). Alternatively, you can set the string directly:
order.setString( OrderQty.FIELD, "2000" );
Cheers, Jörg
--
Joerg Thoennes
http://www.macd.com Tel.: +49 (0)241 44597-24
Macdonald Associates GmbH Geschäftsführer: Roger Macdonald
Lothringer Str. 52, D-52070 Aachen Amtsgericht Aachen, HRB 8151, Ust.-Id DE813021663
|