QuickFIX / J混合了两个不同的版本 [英] QuickFIX/J mixing two different versions

查看:207
本文介绍了QuickFIX / J混合了两个不同的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用QuickFIX / J作为FIX框架的应用程序。
我的对手发给我一个FIX版本4.4
ExecutionReport 消息但只有一些字段(派对组件)版本5.0

I am writing an application that uses QuickFIX/J as FIX framework. My counterpart sends me an ExecutionReport message of FIX version 4.4 But only some fields (the Parties component) are of version 5.0

现在我正在尝试实现我可以读取此组件。

Now I am trying to implement that I can read this component.

这一个

@Override
public void onMessage(quickfix.fix44.ExecutionReport message, SessionID sessionID)
    throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {

    quickfix.fix50.component.Parties parties = new Parties();
    message.get(parties);
    // ...
}

不起作用!消息来自版本4.4,这就是为什么 message.get(...)只想要 quickfix.fix44.component.Parties ,不是版本5.0之一

doesn't work! Message is from version 4.4 and thats why message.get(...) only wants a quickfix.fix44.component.Parties, not one of version 5.0

如果我试试这个

@Override
public void onMessage(quickfix.fix50.ExecutionReport message, SessionID sessionID)
    throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {

    // ...
}

我收到以下错误:

Exception in thread "pool-2-thread-1" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    quickfix/fix44/ExecutionReport.get(Lquickfix/field/SettlType;)Lquickfix/field/SettlType; @2: invokevirtual
  Reason:
    Type 'quickfix/field/SettlType' (current frame, stack[1]) is not assignable to 'quickfix/CharField'
  Current Frame:
    bci: @2
    flags: { }
    locals: { 'quickfix/fix44/ExecutionReport', 'quickfix/field/SettlType' }
    stack: { 'quickfix/fix44/ExecutionReport', 'quickfix/field/SettlType' }
  Bytecode:
    0000000: 2a2b b600 5657 2bb0                    

    at quickfix.fix44.MessageFactory.create(MessageFactory.java:195)
    at quickfix.DefaultMessageFactory.create(DefaultMessageFactory.java:133)
    at quickfix.MessageUtils.parse(MessageUtils.java:145)
    at quickfix.mina.AbstractIoHandler.messageReceived(AbstractIoHandler.java:118)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
    at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:405)
    at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:235)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
    at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

这是因为我得到了4.4字段,但希望将它们视为4.4版本..查看这里

This is because I am getting 4.4 fields, but want to treat them like 4.4 versions.. Look here

也许有人可以帮助我...

Maybe anyone can help me...

感谢您的努力!

推荐答案

一种方法是自定义数据字典FIX4.4。 xml并替换其中有时可能是FIX 5.0格式的字段。例如,从FIX5.0.xml复制它们并将它们放在FIX4.4.xml中的正确消息中。

One way to do this is to customize the Data Dictionary FIX4.4.xml and replace the fields in it that can sometimes be in FIX 5.0 format. Eg by copying them from FIX5.0.xml and placing them in the proper messages in FIX4.4.xml.

来自 QuickFIX / J用户手册


最简单的自定义是修改一个或多个数据字典(例如,FIX44.xml)并重建QFJ。这允许您添加自定义字段,定义规范中未包含的新消息,更改字段是必需字段还是可选字段等。

The simplest customization is to just modify one or more data dictionaries (e.g., FIX44.xml) and rebuild QFJ. This allows you to add custom fields, define new messages not included in the specification, change whether fields are required or optional, and so on.

然后重建QuickFIX / J以反映这些变化。

Afterwards rebuild QuickFIX/J to reflect these changes.

查看有关如何重建QuickFIX / J的 QuickFIX / J用户常见问题解答 (编辑:版本1.5.x):

Check the QuickFIX/J user FAQ on how to rebuild QuickFIX/J ( version 1.5.x):


你需要安装ant。

You'll need ant installed.

QF / J从core / src / main / resources中的DD生成源。备份你要改变的那个,然后根据需要改变它。

QF/J generates the source from the DDs in core/src/main/resources. Make a back up of the one you're going to alter, and then alter it however you need to.

然后重建如下:


  1. ant jar

  2. 系统将提示您输入版本号;这只是确定给jar名称的后缀。输入您想要的任何内容。

  3. 等待构建完成

  4. 在core / target /
  5. 中找到您全新的QF / J罐子
  1. ant jar
  2. You will be prompted for a release number; this just determines the suffix given to the jar names. Enter whatever you want.
  3. Wait for build to finish
  4. Find your brand-new QF/J jars in core/target/


在FAQ(我如何重建QF / J)中稍微进一步调用ANT更具体:

A little further in the FAQ (how do I rebuild QF/J) the call to ANT is more specific:


版本参数只是一个文件名后缀。 skip.jalopy 参数是可选的,将跳过一些耗时的文档生成。

The version argument is just a filename suffix. The skip.jalopy argument is optional and will skip some time-consuming doc generation.

ant version = SOME_STRING - Dskip.jalopy = true clean jar

ant version=SOME_STRING -Dskip.jalopy=true clean jar






重建QuickFIX / J版本1.6的说明。 x



对于版本1.6.0,使用Maven完成。


Instructions for rebuilding QuickFIX/J version 1.6.x

For version 1.6.0 building is done with Maven.


如果您正在从命令行构建代码,您需要下载并安装Maven(版本3.2.5或更高版本)。如果您使用IDE构建,通常会包含Maven。从源代码构建需要Java 6 +。

If you are building the code from the command line you'll need to download and install Maven (version 3.2.5 or newer). If you are building from an IDE, Maven is usually included. Building from source requires Java 6+.


  1. 查看GitHub中的代码。有关克隆存储库的更多详细信息,请参阅GitHub上的说明。

  2. 将目录更改为签出代码的顶级目录。您应该看到一个pom.xml文件。

  3. 运行 mvn package 来构建QuickFIX / J和示例jar文件。这也将为各种FIX版本生成所有与FIX消息相关的代码。

  4. 代码生成器有一个选项可以使用BigDecimal而不是double来表示价格和数量等字段。要启用此功能,请在运行generate.code目标时在命令行上传递-Dgenerator.decimal选项。

  1. Check out the code from GitHub. See the instructions at GitHub for more details on cloning the repository.
  2. Change directory to the top-level directory of the checked out code. You should see a pom.xml file.
  3. Run mvn package to build the QuickFIX/J and examples jar files. This will also generate all the FIX message-related code for the various FIX versions.
  4. There is an option for the code generator to use BigDecimal instead of double for fields like price and quantity. To enable this feature pass a -Dgenerator.decimal option on the command line when running the generate.code target.

有各种命令-line开关你可以传递给ant来修改产生的行为:

There are various command-line switches you can pass to ant to modify the produced behavior:



Switch                  Description                             Default
-Dgenerator.decimal     Generate BigDecimal vs doubles fields   false
-DskipAT=true           Skip running of acceptance test suite.  false




例如,为了生成具有BigDecimals的字段并跳过接受测试:

For example, in order to generate fields with BigDecimals and skip acceptance tests:



mvn test -Dgenerator.decimal=true -DskipAT=true 

这篇关于QuickFIX / J混合了两个不同的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆