Search code examples
c#quickfixfix-protocol

How to get Milliseconds from group.getMDEntryTime().getValue()


How do I get milliseconds from QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries

Here is my code

private DateTime getClose(QuickFix44.MarketDataSnapshotFullRefresh mds)
{
  DateTime close = new DateTime(0L);
  try
  {
    DateTime last = new DateTime(0L);
    QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries group = new QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries();
      for (uint i = 1; i < mds.getNoMDEntries().getValue(); i++)
    {
      group = (QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries)mds.getGroup(i, group);
      if (group.getMDEntryTime().getValue() != null)
      {

        last = new DateTime(group.getMDEntryDate().getValue().Ticks + group.getMDEntryTime().getValue().Ticks);
        close = ((close.Ticks > last.Ticks) ? close : last);
      }
    }
  }
  catch (Exception e) { }
  //return TimeZoneInfo.ConvertTime(close, TimeZoneInfo.Utc, TimeZoneInfo.Local);
  return close;
}

But when I print the close date I get the date with Milliseconds as 000 as shown below

08/28/2015 18:43:48.000


Solution

  • Looks like your market data provider isn't sending you milliseconds...

    last = new DateTime(group.getMDEntryDate().getValue().Ticks + group.getMDEntryTime().getValue().Ticks);
    

    Or if they are, you could try getting the MDEntryDate directly, like:

    group.getField(new StringField("272")).getValue()