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. Shortly, this Excel VBA code will send me messages about buying or selling stocks that I am tracking.
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?
Thanks for your help.
You have several options for sending FIX messages from Excel.
First of all, writing a FIX engine from scratch is no small task. 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. 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. There are various commercial engines you can find listed here: http://fixprotocol.org/products/1 - some offer excel plugins with their product SDK.
2) Embed QuickFIX.NET into your VBA code. See http://www.quickfixengine.org/ for code examples (too large of a topic to post in that answer).
3) Purchase an FIX for Excel plugin. 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
One more note:
When I coded this, the threading model for Excel did not allow for asynchronous updates of cells. So, when I sent a command to the remote FIX server, the response messages (trades) were received asynchronously. When I received the response, I attempted to update Excel. The Excel process would crash hard if I was simultaneously editing a cell when an update arrived.
One solution to overcome this is to use the Excel RTD interface (RTD = "Real Time Data") to update your trade blotter. This is another large-ish topic. Here is a starting point: