DataSource.NET  7.1.31.142147-b54558a5
DataSource.NET Documentation

DataSource.NET

About DataSource.NET

DataSource.NET is a .NET assembly that provides an implementation of the Caplin DataSource 5 API and protocol for use by .NET applications. With Caplin DataSources, you can create applications that use Caplin's DataSource protocol to send financial market data in the form of structured records to other DataSource-enabled applications.

It is recommended that you read the DataSource Overview to gain an understanding of:

  • What DataSource is and how it can be used.
  • Fundamental DataSource concepts & features.

DataSource.NET features

DataSource.NET provides the following capabilities

Getting Started

You typically use the DataSource API to integrate an external entity that provides data, into a DataSource network. The basic steps for doing this are:

  • Implement the IDataProvider interface, to provide data that your DataSource application can send to connected DataSource peers. Your implementation would typically interface with an external entity that supplies the data.
  • Create an instance of the DataSource class.
  • Create an IPublisher. The IPublisher publishes messages to other DataSource peers that are connected to this DataSource, and determines the subscription management strategy (see Subscription Management (Publishers)).
  • Associate an instance of your IDataProvider with the IPublisher, so that the IPublisher has a source of data that it can publish.
  • Start the DataSource.

The code example below shows all these steps, apart from the first one.

Publishers

The API includes several types of Publisher that implement the IPublisher interface. For example, there is a Broadcast Publisher (IBroadcastPublisher), which sends updates to all connected peers regardless of whether they have requested the subject. You create an instance of a particular Publisher by calling a CreateXXXPublisher() method on the DataSource.

Namespaces

A namespace determines which particular subjects can have their data published by a given IPublisher. The rules defining what subjects are in a particular namespace are determined by implementations of the INamespace interface. An INamespace instance is associated with an IPublisher when you call the CreateXXXPublisher() method on the DataSource. The IPublisher uses the INamespace to ensure that its associated IDataProvider only receives requests for subjects in a specified namespace.

You can write your own implementation of INamespace, but the API provides some ready-made implementations that should be suitable for most situations - see PrefixNamespace and RegexNamespace

For example, PrefixNamespace ensures that data is only published if its subject matches the specified prefix. So, if the prefix supplied in the constructor for an instance of PrefixNamespace is " /I/ ", data with the subject " /I/VOD.L " will be published, whereas data with the subject "/R/VOD.L " will not be published.

Example showing the DataSource, IPublisher, IDataProvider and INamespace

In this example, the implementation of IDataProvider is called ExampleDataProvider, and the INamespace class used is PrefixNamespace.

using System;
using System.Threading;
using DataSourceExamples.DataProvider;
namespace DataSourceExamples.Overview
{
class OverviewExample
{
public static void SimpleExample(String configuration, ILogger logger)
{
// Create a DataSource.
DataSource dataSource = new DataSource(configuration, logger);
// Create our data provider
new ExampleDataProvider(dataSource);
// Now start the DataSource.
dataSource.Start();
// Prevent the program from exiting.
while (true)
{
Thread.Sleep(1000);
}
}
}
}

Deploying DataSource.NET

DataSource.Net comprises 4 DLLs: the DataSource.NET.dll, datasrc.dll, pthreadVC.dll and hs_regex.dll. All 4 DLLs must be available to a DataSource.NET application.


Generated on Fri Jul 7 2023 17:09:44 for DataSource.NET