.NET/COM Support
TracNav menu
-
Marketcetera
-
Overview
- Photon
- ORS
- Tradebase
- OrderLoader
- Virtual Appliance
- User Mailing List
- Download
- License
- Reporting Bugs
-
Documentation
- Marketcetera Platform Configuration
- ORS Guide
- Photon Installation and Configuration
- Photon Guide
- Photon Scripting
- Tradebase Guide
- OrderLoader Guide
- Configuration Files Guide
- Configuring Market Data Feeds
- Order Limits
- Excel Integration
- .NET Support
-
Support
- Support
- User FAQ
- Developer FAQ
-
For Developers
- Architecture
- Building Marketcetera Platform
- Building Photon
- Building Tradebase
- Building Appliance
- Building MarketceteraCOM
- FIX Overview
- Developer Mailing List
- Developer Notes
- Contribute!
- Reading List
- Third-party Dependencies
- Exchange Simulator
- JavaDoc
- Blog
Note: Currently Marketcetera .NET/COM support works only with release 0.4.2 (can be found here). We are working on making it compatible with our latest release 0.5.0.
Marketcetera provides an easy way to integrate with the OMS through Microsoft's .NET technologies.
We provide a MarketceteraCOM component that implements the interface defined in COM API. It allows you to
- Start/Stop connection to the Marketcetera OMS
- Send generic FIX message
- Register for exceptions
- Register for Application and Session callback events
Using this API one can write glue tools to send orders to the Marketcetera Platform from any Microsoft application, such as C#, C++ and VB.Net applications.
This allows you to keep your existing processes, and keep your algorithms in C++ or VB.Net, and easily plug into the Marketcetera Platform infrastructure.
See the underlying implementation of MarketceteraCOM component.
Sample Code
The following code generates a new single order message (FIX MsgType='D'), using version 4.2 of the FIX protocol, representing the order "Buy 1000 IBM paying 123.40".
using System;
using System.Collections.Generic;
using System.Text;
using MarketceteraCOM;
using NMS;
using QuickFix;
namespace FIXMessageAdapterExample
{
class FIXMessageAdapterExample
{
static void Main(string[] args)
{
MarketceteraCOM.FIXMessageAdapter adapter = new MarketceteraCOM.FIXMessageAdapter();
adapter.ExceptionEvent += new ExceptionListener(OnException);
adapter.ApplicationMessageEvent += new FIXMessageHandler(OnApplicationMessage);
adapter.SessionMessageEvent += new FIXMessageHandler(OnSessionMessage);
adapter.Init("tcp://localhost:61616", "ors-commands", "ors-messages", "enduser", "enduser_password");
adapter.Start();
adapter.SendMessage(createMessage());
Console.In.Read();
adapter.Stop();
}
public static Message createMessage()
{
QuickFix.MessageFactory messageFactory = new QuickFix.DefaultMessageFactory();
QuickFix.Message message = messageFactory.create("FIX.4.2", MsgType.ORDER_SINGLE);
ClOrdID id = new ClOrdID(Guid.NewGuid().ToString());
message.setField(id);
message.setField(new HandlInst(HandlInst.MANUAL_ORDER));
message.setField(new Symbol("IBM"));
message.setField(new Side(Side.BUY));
message.setField(new OrdType(OrdType.LIMIT));
message.setField(new TransactTime());
message.setField(new OrderQty(1000));
message.setField(new Price(123.4));
return message;
}
private static void OnException(System.Exception ex)
{
Console.Out.WriteLine("Exception: " + ex.Message);
}
private static void OnApplicationMessage(Message message)
{
Console.Out.WriteLine("Application message: " + message);
}
private static void OnSessionMessage(Message message)
{
Console.Out.WriteLine("Session message: " + message);
}
}
}
QuickFIX .Net Reference
You can find the documentation for the QuickFIX .Net APIs here at their documentation page. An additional useful resource is the B2Bits FIXopaedia.
API reference
As of version 0.4.0 of the Marketcetera Platform, the primary COM API has changed. That API, called IFIXMessageAdapter (along with its concrete class FIXMessageAdapter) is much simpler, and allows you to work directly with the Marketcetera Platform using the QuickFIX .Net libraries. For an API that may be easier to use from VB6 and Excel, see the Excel Integration page
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using NMS;
namespace MarketceteraCOM
{
public delegate void FIXMessageHandler(QuickFix.Message message);
interface IFIXMessageAdapter
{
/// <summary>
/// Initializes the connection to the Marketcetera platform.
/// </summary>
/// <param name="serverURL">The URL of the ActiveMQ connection</param>
/// <param name="destinationQueue">The name of the queue to which to send messages</param>
/// <param name="responseTopic">The name of the topic from which to receive messages</param>
/// <param name="fixVersionString">The version of FIX to use for this connection.
/// Currently the only supported version is "FIX.4.2", all other values will cause an exception.</param>
void Init(String serverURL, String destinationQueue, String responseTopic);
/// <summary>
/// Start the adapter, making an network connection to the message queue.
/// </summary>
void Start();
/// <summary>
/// Stop the adapter, disconnecting from the message queue and freeing all resources.
/// </summary>
void Stop();
void SendMessage(QuickFix.Message message);
/// <summary>
/// Event that notifies the client of "application level" events, as defined by the QuickFIX API. These
/// include execution reports and cancel rejects.
/// </summary>
event FIXMessageHandler ApplicationMessageEvent;
/// <summary>
/// Event that notifies the client of "session level" events, as defined by the QuickFIX API. These
/// include login, logout, and rejects for malformatted messages.
/// </summary>
event FIXMessageHandler SessionMessageEvent;
/// <summary>
/// Event that notifies the client of any other asynchronous error condition.
/// </summary>
event ExceptionListener ExceptionEvent;
}
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IFIXMessageAdapterEvents
{
void ApplicationMessageEvent(QuickFix.Message message);
void SessionMessageEvent(QuickFix.Message message);
void ExceptionHandler(Exception ex);
}
}
