Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting MDEntryDate field causes parsing datetime from string intead of just date. #135

Closed
nkokarev opened this issue Oct 24, 2012 · 11 comments

Comments

@nkokarev
Copy link

I faced issue when i tried to get MDEntryDate NoMDEntriesGroup of FullSnapshot. I believe it is not only a one place. The root problem is an exception in DateTimeConverter.ConvertToDateTime methods. This method tried to get Date and Time when string contains only Date (MDEntryDate).

Fix44:MarketDataSnapshotFullRefresh.cs:4985
public QuickFix.Fields.MDEntryDate Get(QuickFix.Fields.MDEntryDate val)
{
GetField(val);
return val;
}

GetField from FieldMap class simply parses datetime instead of date.

@gbirchmeier
Copy link
Member

Can you be more specific? Is it throwing an exception? What exception is it throwing? What are you doing when it throws an exception? How can I best reproduce what you are seeing?

@nkokarev
Copy link
Author

Re: [quickfixn] getting MDEntryDate field causes parsing datetime from string intead of just date. (#135)
Hello Grant,
I am receiving MarketDataSnapshotFullRefresh (FIX44) message. This message contains NoMDEntriesGroup. Group has field MDEntryDate. 
So i am taking group and call Get method passing instance of MDEntryDate class. Once i call this method i receive exception
 MarketDataSnapshotFullRefresh 8=FIX.4.49=39735=W34=249=MA52=20121024-12:21:42.17056=xxxx22=448=BE093290051855=[N/A]262=1b145288-9c9a-4911-a084-7341c69d3e6b762=EURO_EUR268=2269=0270=97.62515=EUR271=1246000272=20121024273=07:30:47276=I282=BEARGB21XXX299=154785755528=Unassigned Bonds5637=2269=1270=108.0815=EUR271=884000272=20121024273=07:30:47276=I282=BEARGB21XXX299=154679025528=Unassigned Bonds5637=210=147
QuickFix.FieldConvertError: Could not convert field: Could not convert string (20121024) to DateTime: String was not recognized as a valid DateTime. ---> System.FormatException: String was not recognized as a valid DateTime.
         at System.DateTimeParse.ParseExactMultiple(String s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style)
         at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style)
         at QuickFix.Fields.Converters.DateTimeConverter.ConvertToDateTime(String str) in C:\WORK\qfn src 1.2.0.143\QuickFIXn\Fields\Converters\DateTimeConverter.cs:line 30
         --- End of inner exception stack trace ---
         at QuickFix.Fields.Converters.DateTimeConverter.ConvertToDateTime(String str) in C:\WORK\qfn src 1.2.0.143\QuickFIXn\Fields\Converters\DateTimeConverter.cs:line 34
         at QuickFix.FieldMap.GetDateTime(Int32 tag) in C:\WORK\qfn src 1.2.0.143\QuickFIXn\Message\FieldMap.cs:line 309
         at QuickFix.FieldMap.GetField(DateTimeField field) in C:\WORK\qfn src 1.2.0.143\QuickFIXn\Message\FieldMap.cs:line 179
         at QuickFix.FIX44.MarketDataSnapshotFullRefresh.NoMDEntriesGroup.Get(MDEntryDate val) in C:\WORK\qfn src 1.2.0.143\QuickFIXn\Message\FIX44\MarketDataSnapshotFullRefresh.cs:line 4987
The root issue is that Get(MDEntryDate field) method - simply call GetField(Fields.DateTimeField field) - here Date treated as DateTime as MDEntryDate is a child of DateTimeField. 
I think there must be DateField from which MDEntryDate should be inherited.
Feel free to ask me more details.
Can you be more specific? Is it throwing an exception? What exception is it throwing? What are you doing when it throws an exception? How can I best reproduce what you are seeing?—
Reply to this email directly or view it on GitHub. 
-- 
Best regards,
 Nikita                            mailto:nkokarev@gmail.com

@Formator
Copy link
Contributor

Formator commented Dec 5, 2012

Hi

In my branch DateOnly_TimeOnly_Field, I have write UnitTests that show this error. There are two problems that need to be fixed:
1 FieldMap:

  • GetDateTime(int tag) must handle field DateOnlyField
  • There should be new function like "GetDateTime(int tag)" to handle TimeOnlyField and return TimeSpan
  • There shoud be two new functions like DateTimeField GetField(Fields.DateTimeField field) to handle DateOnlyField and TimeOnlyField

2 TimeOnlyField

  • Must accept TimeSpan in constructor

@Formator
Copy link
Contributor

Formator commented Dec 5, 2012

@gbirchmeier: I will fix this problem tomorow.

@gbirchmeier
Copy link
Member

Awesome, thanks @Formator.

@mcmillab
Copy link

has this been fixed?
I'm getting the same error, and I've just updated to v1.3.0, but that did not solve it.

@gbirchmeier
Copy link
Member

Download the 1.4.0 beta. Or wait until we promote that beta to the official 1.4.0 release, which we'll probably do this week or next.

@mcmillab
Copy link

thanks

On 26 February 2013 13:41, Grant Birchmeier notifications@github.comwrote:

Download the 1.4.0 beta. Or wait until we promote that beta to the
official 1.4.0 release, which we'll probably do this week or next.


Reply to this email directly or view it on GitHubhttps://github.com//issues/135#issuecomment-14089433
.

@mcmillab
Copy link

I'm now using 1.4, but still getting the same error:
Could not convert field: Could not convert string (20130326) to DateTime: String was not recognized as a valid DateTime.
Message 7256870 Rejected: Incorrect data format for value (Field=272)

@gbirchmeier
Copy link
Member

Can you provide the message that's being rejected?

@mcmillab
Copy link

20130326-03:42:43.020 : 8=FIX.4.2 9=153 35=W 49=XXX 56=YYY 34=7608399
52=20130326-03:42:41.569 55=GBP/USD 268=1 269=2 270=1.51823 271=0
272=20130326 273=23:42:40 274=0 10=070

20130326-03:42:43.035 : 8=FIX.4.2 9=141 35=3 34=47 49=YYY
52=20130326-03:42:43.035 56=XXX 45=7608399 58=Incorrect data format for
value 371=272 372=W 373=6 10=073

On 26 March 2013 14:39, Grant Birchmeier notifications@github.com wrote:

Can you provide the message that's being rejected?


Reply to this email directly or view it on GitHubhttps://github.com//issues/135#issuecomment-15439324
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants