{{Quickfixn}} Problem parsing Amt fields
Ruaan Viljoen
ruaanv at gmail.com
Mon Dec 1 21:49:18 PST 2014
What is your decimal settings on your machine running the quickfix engine?
It appears to be a culture issue - if your dev machine uses ',' as
separator, it won't parse numbers using another separator correctly. If
this is the case, we should consider changing conversions of decimals to
use InvariantCulture instead:
Convert.ToInt32(msgstr.Substring(pos, tagend -
pos),System.Globalization.CultureInfo.InvariantCulture);
Hope that helps Mark,
Regards
Ruaan
Ruaan Viljoen
On 1 December 2014 at 22:59, Jeays, Mark <Mark.Jeays at bmo.com> wrote:
> Hi List,
>
>
>
> I've run into the following error trying to parse a TradeCaptureReport
> using QuickFix/n
>
>
>
> QuickFix.MessageParseError: Could not parse message: Error at position
> (355) while parsing msg
>
> …
>
> System.FormatException: Input string was not in a correct format.
>
> at System.Number.StringToNumber(String str, NumberStyles options,
> NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
>
> at System.Number.ParseInt32(String s, NumberStyles style,
> NumberFormatInfo info)
>
> at System.Convert.ToInt32(String value)
>
> at QuickFix.Message.ExtractField(String msgstr, Int32& pos,
> DataDictionary sessionDD, DataDictionary appDD)
>
> --- End of inner exception stack trace ---
>
> at QuickFix.Message.ExtractField(String msgstr, Int32& pos,
> DataDictionary sessionDD, DataDictionary appDD)
>
> at QuickFix.Message.ExtractField(String msgstr, Int32& pos)
>
> at QuickFix.Session.Next(String msgStr)
>
> at QuickFix.SocketInitiatorThread.ProcessStream()
>
> at QuickFix.SocketInitiatorThread.Read()
>
>
>
>
>
> Position 355 corresponds to the decimal place in an Amt field for accrued
> interest:
>
>
>
> 159=120865.75
>
>
>
> We've also noticed this same issue for another Amt field, NetMoney.
>
>
>
> These are the Data definitions for the fields:
>
>
>
> <field number='118' name='NetMoney' type='AMT'/>
>
> <field number='159' name='AccruedInterestAmt' type='AMT'/>
>
>
>
> It seems that QF is interpreting these as an integer instead of as a
> decimal. The specification states that the Amt data type has a float as a
> base type and the example shows two decimal places.
>
>
>
> How would I get QF to parse this as a decimal?
>
>
>
> Thanks,
>
>
>
> Mark
>
> _______________________________________________
> Quickfixn mailing list
> Quickfixn at lists.quickfixn.com
> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20141202/4e3b0eb3/attachment.htm>
More information about the Quickfixn
mailing list