解析 FIX 消息的最佳方法?

发布于 2024-08-22 15:30:15 字数 51 浏览 7 评论 0原文

如何使用 python 解析 FIX 消息? (“金融”FIX 协议中的 FIX 消息)

How do you parse a FIX message using python ?
(FIX message as in the 'financial' FIX Protocol)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

不即不离 2024-08-29 15:30:15

您的意思是使用 QuickFIX 吗? (我可以在你的标签中看到 QuickFIX)

如果是这样的话,我不知道。
一般来说,为 FIX 消息编写一个简单的解析器并不困难。
我发现有效修复上的网络工具可以完成这项工作。

do you mean by using QuickFIX ? (I can see QuickFIX in your tags)

if that is the case, I don't know.
Generally it's not difficult to write a simple parser for a FIX message.
I found that the web tools on valid fix do the job.

提赋 2024-08-29 15:30:15

除了使用实际的快速修复引擎之外,当您知道修复消息包含特定标签时,很容易解析它。

它包含 0x1 个分隔的“key=value”字符串对。一个复杂的问题是组,因为您必须确定该标签是组中的第一个标签(组标题),然后确定该组何时结束(当它遇到不在该组中的另一个标签时)。

另一个有问题的字段是 RawData,它可以包含任何内容,包括字段分隔符 0x1,但它前面是 RawDataLength,因此您必须先读取该字段,然后读取 RawData 标记后面的 RawDataLength 字节数才能到达下一个字段。

我相信quickfixengine 使用标签字典,它可以确定该标签是一个组中的第一个标签,然后继续添加,直到命中不在一个组中的标签。

当我需要对 FIX 消息进行自定义解析时,我通常确切地知道我们期望什么消息和什么数据,因此我可以针对这些消息进行调整。

Apart from using the actual quickfixengine it's easy to parse fix message when you know it contains specific tags.

It contains 0x1 separated pairs of 'key=value' strings. One complication are groups because you have to figure out that the tag is the first in a group (group header) and then figure out when the group ends (when it hits another tag not in the group).

Another problematic field is the RawData which can contain anything including the field separator 0x1, but it is preceded by RawDataLength so you have to read that first and then read RawDataLength number of bytes after the RawData tag to get to the next field.

I believe quickfixengine uses the dictionary of tags where it can figure out that the tag is first of a group then keep adding until hitting tag that is not in a group.

When I need to do custom parsing of FIX messages I mostly know exactly what messages and what data we expect so I can tweak it for those messages.

满栀 2024-08-29 15:30:15

FIX 格式解析起来非常烦人(因为非 XML 格式,即几乎每个人仍在使用的格式,没有子组开始和结束标记,相反,您必须根据标签排序规则和标签来计算它)不在子组中,头或尾可以是任何顺序)。

因此,我建议您使用现有的库来执行此操作,而不是自己解析它。

唯一维护良好的开源选项是 Java QuickFIX/J 库。

有许多商业解决方案,例如 CameronFIX

The FIX format is surprisingly annoying to parse (as the non-XML format, i.e. the one still used by pretty much everyone, has no subgroup start and end markers, instead you have to work it out based on tag ordering rules, and tags that are not in a subgroup, the header or the tail can be in any order).

So rather than parse it yourself I'd recommend you use an existing library to do so.

The only well maintained open source option is the Java QuickFIX/J library.

There are many commercial solutions, e.g. CameronFIX

峩卟喜欢 2024-08-29 15:30:15

尝试 http://fix.nowing.com

它是一个基于网络的修复消息解析器

try http://fix.nowing.com

it's a web based fix message parser

瞎闹 2024-08-29 15:30:15

从quickfixj源代码来看,它使用treeMap来处理FIX消息。

关于XML格式,我认为FIX更好,尽管在JAVA中解析更困难。因为 XML 太重了。

from the quickfixj source code, it uses treeMap to handle the FIX message.

regarding to XML format, i think FIX is better, though the parsing is harder in JAVA. coz XML is too heavy.

画尸师 2024-08-29 15:30:15

没有最好的方法,但考虑到您或 SO 系统附加的快速修复标签,请查看 QuickFix 开源 FIX 引擎将是一个很好的起点。

如果您在一家重要的公司,或者如果您需要更多支持和服务,那么还有许多商业供应商。

祝你好运

There is no one best way, but given the quickfix tag that either you or the SO system attached, a look at QuickFix open source FIX engine would be a good place to start.

There are many commercial vendors as well if you are at a company where that matters, or if you want more support and services.

Good Luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文