Thread: [Quickfix-developers] price as double
Brought to you by:
orenmnero
From: Vijay S. Y. <vy...@op...> - 2004-04-14 16:46:56
|
SGVsbG8sDQoxLikgSXMgdGhlcmUgYSB3YXkgdG8gZm9yY2UgcHJpY2VzIHRvIHJlc3BlY3Qgb25s eSB0d28gZGlnaXRzIHJpZ2h0IG9mIHRoZSBkZWNpbWFsIHBvaW50LiBJIHN1cHBseSBwcmljZT05 My4xOSB0byBhIG5ld09yZGVyU2luZ2xlIG9iamVjdCBhbmQgdGhlIGFjdHVhbCBzdHJpbmcgcGFz c2VkIHRvIHRoZSBjb3VudGVycGFydHkgY29udGFpbnMgOTMuMTkwMDAyNDQNCiANClRoZSBjb3Vu dGVycGFydHkgZG9lcyBub3QgbGlrZSB0aGlzIGFuZCByZWplY3RzIHRoZSBvcmRlci4NCiANCkkg dHJpZWQgY2FsbGluZyBtc2cudG9TdHJpbmcgdG8gZ2V0IHRoZSBzdHJpbmcgb3V0IHdpdGhvdXQg dGhlIHByaWNlIGFuZCBhcHBlbmQgNDQ9OTMuMTkgdG8gaXQgYW5kIGNyZWF0aW5nIGEgbWVzc2Fn ZSB0aHJvdWdoIHRoaXMgc3RyaW5nIGJ1dCB0aGlzIG5ldyBtZXNzYWdlIGZhaWxzIHZhbGlkYXRp b24uDQogDQoyKSBJcyB0aGVyZSBhbnl3YXkgdG8gZ2V0IGEgc3RyaW5nIG91dCB3aXRob3V0IHRo ZSBoZWFkZXIgYW5kIHRyYWlsZXIgKGkuZS4ganVzdCBnZXQgdGhlIGJvZHkpLCBjaGFuZ2UgdGhl IGJvZHkgYW5kIGNyZWF0ZSBhIG5ldyBtZXNzYWdlIHRoYXQgY29uc3RydWN0cyB0aGUgaGVhZGVy IGFuZCB0cmFpbGVyIGJhc2VkIG9uIG1lc3NhZ2UgYm9keS4NCiANClRoYW5rcyBmb3IgeW91ciBo ZWxwDQogDQotLSB2aWpheQ0K |
From: Oren M. <or...@qu...> - 2004-04-14 16:55:47
|
Can you please indicate what system you are running on and which API you are using? --oren On Apr 14, 2004, at 11:36 AM, Vijay Singh Yadav wrote: > Hello, > 1.) Is there a way to force prices to respect only two digits right of > the decimal point. I supply price=93.19 to a newOrderSingle object and > the actual string passed to the counterparty contains 93.19000244 > > The counterparty does not like this and rejects the order. > > I tried calling msg.toString to get the string out without the price > and append 44=93.19 to it and creating a message through this string > but this new message fails validation. > > 2) Is there anyway to get a string out without the header and trailer > (i.e. just get the body), change the body and create a new message > that constructs the header and trailer based on message body. > > Thanks for your help > > -- vijay > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |
From: Joerg T. <Joe...@ma...> - 2004-04-15 09:03:17
|
Oren, with the Java API I have this problem form months. Doubles are not used in financial applications because of these rounding errors. In Java, we use BigDecimal in such cases. It would be good to have access to the String representation of a FIX field, ie get/set the value of all fields as String. How could I do that in C++ and Java? Cheers, Jörg > Can you please indicate what system you are running on and which API you > are using? > > --oren > > On Apr 14, 2004, at 11:36 AM, Vijay Singh Yadav wrote: > >> Hello, >> 1.) Is there a way to force prices to respect only two digits right of >> the decimal point. I supply price=93.19 to a newOrderSingle object and >> the actual string passed to the counterparty contains 93.19000244 >> >> The counterparty does not like this and rejects the order. >> >> I tried calling msg.toString to get the string out without the price >> and append 44=93.19 to it and creating a message through this string >> but this new message fails validation. >> >> 2) Is there anyway to get a string out without the header and trailer >> (i.e. just get the body), change the body and create a new message >> that constructs the header and trailer based on message body. >> >> Thanks for your help >> >> -- vijay >> ------------------------------------------------------- >> This SF.Net email is sponsored by: IBM Linux Tutorials >> Free Linux tutorial presented by Daniel Robbins, President and CEO of >> GenToo technologies. Learn everything from fundamentals to system >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >> _______________________________________________ >> Quickfix-developers mailing list >> Qui...@li... >> https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > -- Joerg Thoennes http://macd.com Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen |
From: Oren M. <or...@qu...> - 2004-04-15 14:12:39
|
The C++ fields have a setString and getString method. You can use=20 these to guarantee a perfect representation of your number. Java=20 doesn't have access to these, so it would need to be added to the API. =20= We can also replace the DoubleField with a BigDecimal field, or add=20 BigDecimal support to the existing field type. --oren On Apr 15, 2004, at 4:02 AM, Joerg Thoennes wrote: > Oren, > > with the Java API I have this problem form months. Doubles are not=20 > used in financial applications because of these rounding errors. In=20 > Java, we use BigDecimal in such cases. It would be good to have access=20= > to the String representation of a FIX field, ie get/set the value of=20= > all fields as String. How could I do that in C++ and Java? > > Cheers, J=F6rg > >> Can you please indicate what system you are running on and which API=20= >> you are using? >> --oren >> On Apr 14, 2004, at 11:36 AM, Vijay Singh Yadav wrote: >>> Hello, >>> 1.) Is there a way to force prices to respect only two digits right=20= >>> of the decimal point. I supply price=3D93.19 to a newOrderSingle=20 >>> object and the actual string passed to the counterparty contains=20 >>> 93.19000244 >>> >>> The counterparty does not like this and rejects the order. >>> >>> I tried calling msg.toString to get the string out without the price=20= >>> and append 44=3D93.19 to it and creating a message through this = string=20 >>> but this new message fails validation. >>> >>> 2) Is there anyway to get a string out without the header and=20 >>> trailer (i.e. just get the body), change the body and create a new=20= >>> message that constructs the header and trailer based on message=20 >>> body. >>> >>> Thanks for your help >>> >>> -- vijay >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by: IBM Linux Tutorials >>> Free Linux tutorial presented by Daniel Robbins, President and CEO = of >>> GenToo technologies. Learn everything from fundamentals to system >>> = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dclic= k >>> _______________________________________________ >>> Quickfix-developers mailing list >>> Qui...@li... >>> https://lists.sourceforge.net/lists/listinfo/quickfix-developers >> ------------------------------------------------------- >> This SF.Net email is sponsored by: IBM Linux Tutorials >> Free Linux tutorial presented by Daniel Robbins, President and CEO of >> GenToo technologies. Learn everything from fundamentals to system >> administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick >> _______________________________________________ >> Quickfix-developers mailing list >> Qui...@li... >> https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > --=20 > Joerg Thoennes > http://macd.com > Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH > Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcl= ick > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |