如何从 group.getMDEntryTime().getValue() 获取毫秒数
How to get Milliseconds from group.getMDEntryTime().getValue()
如何从 QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries
中获取毫秒数
这是我的代码
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;
}
但是当我打印结束日期时,我得到了毫秒为 000 的日期,如下所示
08/28/2015 18:43:48.000
看起来您的市场数据提供商没有向您发送毫秒...
last = new DateTime(group.getMDEntryDate().getValue().Ticks + group.getMDEntryTime().getValue().Ticks);
或者如果是,您可以尝试直接获取 MDEntryDate,例如:
group.getField(new StringField("272")).getValue()
我不会说这种语言,但我在 python 中遇到了类似的问题,我通过查看消息的 header 而不是其他地方解决了这个问题。以防万一这对您有帮助,请参阅 the question here.
如何从 QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries
这是我的代码
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;
}
但是当我打印结束日期时,我得到了毫秒为 000 的日期,如下所示
08/28/2015 18:43:48.000
看起来您的市场数据提供商没有向您发送毫秒...
last = new DateTime(group.getMDEntryDate().getValue().Ticks + group.getMDEntryTime().getValue().Ticks);
或者如果是,您可以尝试直接获取 MDEntryDate,例如:
group.getField(new StringField("272")).getValue()
我不会说这种语言,但我在 python 中遇到了类似的问题,我通过查看消息的 header 而不是其他地方解决了这个问题。以防万一这对您有帮助,请参阅 the question here.