Onix Solutions Logo

Onix Solutions' Hotspot Itch Handler — Programmer's Guide

Version 1.15

Introduction

The Onix Solutions Hotspot Itch Handler is a .NET class library (assembly) that provides access to order book information from the Hotspot ECN book via Hotspot ECN ITCH Protocol. This specific implementation is for applications written in .NET supported languages (C#, Visual Basic (VB.NET), Managed C++, Delphi .NET, etc).

The handler automatically performs all session management tasks required by the ITCH Session Management Protocol and converts bytes stream segments into high-level application messages and events.

System Requirements

.NET Framework 2.0, .NET Framework 3.0 or .NET Framework 3.5.

Recommended Development Environment

Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008.

Getting Started

All Itch Handler classes are located in the Onixs.HotspotItch and Onixs.HotspotItch.BookMessages namespaces.

The recommended process for using the Handler is as follows:

  1. Create the Handler object.
  2. Subscribe to the relevant Handler events.
  3. Establish the connection.
  4. Subscribe to ticker data (optional).
  5. Process the incoming messages that are available via Handler events arguments.
  6. Close the connection.

Supported version of Hotspot ECN ITCH Protocol

The Handler must only be used with the supported version of Hotspot ECN ITCH Protocol; otherwise parsing errors will be reported. All subsequent versions are available to supported clients.

To check the supported version, the Handler.ItchProtocolVersion property can be used.

For example:

Console.WriteLine("Supported version of the Hotspot ECN ITCH Protocol: " + Handler.ItchProtocolVersion);

Error-reporting

Exception handling is used as a fundamental error-reporting mechanism. In the event of any errors an Exception is thrown.

Connection management

To establish a connection the Handler.Connect method is used.

This method blocks until a reply from the ECN ITCH Gateway is received. If the logon is rejected than an exception is thrown.

To close the connection the Handler.Disconnect method is used.

For example:

using System;
using System.Threading;
using Onixs.HotspotItch;
try
{                              
const string host = "HotspotFX ECN Book Server IP Address";
const int serverPort = 9011; // HotspotFX ECN Book Server port
const string login = " YourLogin";
const string password = "hotspot";
             
Handler handler = new Handler();

handler.Connect(host, serverPort, login, password);

Console.WriteLine("Press any key to disconnect...");
Console.ReadKey();
       
handler.Disconnect();                

}
catch (Exception ex)
{
       Console.WriteLine("Exception:" + ex);
}

Handler Events

A Error event is fired when an error is detected.

A Disconnected event is fired when the connection is closed.

A MarketSnapshotReceived event is fired when a Market Snapshot Message is received.

A NewOrderReceived event is fired when a New Order Message is received.

A CancelOrderReceived event is fired when a Cancel Order Message is received.

A ModifyOrderReceived event is fired when a Modify Order Message is received.

A TickerReceived event is fired when a Ticker is received.

For example:

{
   //…
   handler.MarketSnapshotReceived += new Handler.MarketSnapshotReceivedEventHandler(handler_MarketSnapshotReceived);

   handler.NewOrderReceived += new Handler.NewOrderReceivedEventHandler(handler_NewOrderReceived);

   handler.ModifyOrderReceived += new Handler.ModifyOrderReceivedEventHandler(handler_ModifyOrderReceived);

   handler.CancelOrderReceived += new Handler.CancelOrderReceivedEventHandler(handler_CancelOrderReceived);

   handler.TickerReceived += new Handler.TickerReceivedEventHandler(handler_TickerReceived);
   //…
}

static void handler_TickerReceived(object sender, Handler.TickerReceivedEventArgs args)
{
   Console.WriteLine("Ticker Message received: " + args.Ticker);
}

static void handler_CancelOrderReceived(object sender, Handler.CancelOrderReceivedEventArgs args)
{
   Console.WriteLine("Cancel Order Message received: " + args.CancelOrder);
}

static void handler_ModifyOrderReceived(object sender, Handler.ModifyOrderReceivedEventArgs args)
{
   Console.WriteLine("Modify Order Message received: " + args.ModifyOrder);
}

static void handler_NewOrderReceived(object sender, Handler.NewOrderReceivedEventArgs args)
{
   Console.WriteLine("New Order Message received: " + args.NewOrder);
}

static void handler_Disconnected(object sender, Handler.DisconnectedEventArgs args)
{
   Console.WriteLine("Handler is disconnected: " + args.Reason);
}

static void handler_Error(object sender, Handler.ErrorEventArgs args)
{
   Console.WriteLine("Error: " + args.Description);
}

static void handler_MarketSnapshotReceived(object sender, Handler.MarketSnapshotReceivedEventArgs args)
{
   Console.WriteLine("MarketSnapshot received: " + args.Snapshot);
}

  

Ticker Data

To subscribe to ticker data for a specific currency pair the Handler.SubscribeTicker method is used.

To subscribe to ticker data for all currency pairs the Handler.SubscribeTickerForAllCurrencyPairs method is used.

To subscribe only to ticker data for certain currency pairs, multiple Handler.SubscribeTicker calls should be made, one for each desired currency pair.

To unsubscribe from ticker data for the previously subscribed currency pair the Handler.UnsubscribeTicker method is used.

To unsubscribe from ticker data for all previously subscribed currency pairs the Handler.UnsubscribeTickerForAllCurrencyPairs method is used.

Market Snapshot Request

To request missing market data for a specific currency pair the Handler.RequestMarketSnapshot method is used.

To request missing market data for all currency pairs the Handler.RequestMarketSnapshotForAllCurrencyPairs method is used.

Resources

© Onix Solutions