简体   繁体   English

使用Excel VBA修复协议

[英]Fix Protocol with Excel VBA

I have already created code in Excel VBA which collects data by dde link and executes them according to some rules. 我已经在Excel VBA中创建了代码,该代码通过dde链接收集数据并根据一些规则执行它们。 Shortly, this Excel VBA code will send me messages about buying or selling stocks that I am tracking. 很快,此Excel VBA代码将向我发送有关我正在跟踪的买卖股票的消息。

Now, I want to execute these messages by using fix protocol. 现在,我想使用修复协议执行这些消息。 Is it possible to use Excel VBA to create a fix protocol engine which connects to web service and enables you to execute operations which come from Excel VBA? 是否可以使用Excel VBA创建连接到Web服务并允许您执行Excel VBA的操作的修订协议引擎?

Thanks for your help. 谢谢你的帮助。

You have several options for sending FIX messages from Excel. 您有几种从Excel发送FIX消息的选项。

First of all, writing a FIX engine from scratch is no small task. 首先,从头开始编写FIX引擎并非易事。 For starters, the specification (especially for earlier versions such as 4.2) is fairly ambiguous and much of the details can only be known from practical experience. 对于初学者而言,该规范(尤其是对于4.2等早期版本)相当含糊,许多细节只能从实际经验中了解。 So, you are better off starting with an off-the-shelf solution. 因此,最好从现成的解决方案开始。

You have several options: 您有几种选择:

1) From Excel, call into a remote API of a FIX engine. 1)从Excel中,调用FIX引擎的远程API。 There are various commercial engines you can find listed here: http://fixprotocol.org/products/1 - some offer excel plugins with their product SDK. 您可以在此处找到各种商业引擎: http : //fixprotocol.org/products/1-一些商业引擎提供带有产品SDK的excel插件。

2) Embed QuickFIX.NET into your VBA code. 2)将QuickFIX.NET嵌入到您的VBA代码中。 See http://www.quickfixengine.org/ for code examples (too large of a topic to post in that answer). 有关代码示例,请参见http://www.quickfixengine.org/ (该主题太大,无法在该答案中发布)。

3) Purchase an FIX for Excel plugin. 3)购买FIX for Excel插件。 There are several. 有几种。 I can't recommend one (for various reasons). 我不能推荐(出于各种原因)。 Again, you can search the FIX Protocol Ltd site for some starting points: http://fixprotocol.org/products/2 同样,您可以在FIX Protocol Ltd网站上搜索一些起点: http : //fixprotocol.org/products/2

One more note: 还有一点注意事项:

When I coded this, the threading model for Excel did not allow for asynchronous updates of cells. 当我对此进行编码时,Excel的线程模型不允许单元的异步更新。 So, when I sent a command to the remote FIX server, the response messages (trades) were received asynchronously. 因此,当我向远程FIX服务器发送命令时,异步接收到响应消息(交易)。 When I received the response, I attempted to update Excel. 收到响应后,我尝试更新Excel。 The Excel process would crash hard if I was simultaneously editing a cell when an update arrived. 如果我在更新到达时同时编辑单元格,则Excel进程将严重崩溃。

One solution to overcome this is to use the Excel RTD interface (RTD = "Real Time Data") to update your trade blotter. 解决此问题的一种方法是使用Excel RTD界面(RTD =“实时数据”)更新您的交易记录器。 This is another large-ish topic. 这是另一个大话题。 Here is a starting point: 这是一个起点:

Microsoft KB: How to set up and use the RTD function in Excel Microsoft KB:如何在Excel中设置和使用RTD功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM