dxFeed .Net API  7.1.0
dxFeed .Net API library intended to provide market data access for DX clients
com.dxfeed.ipf.live.InstrumentProfileConnection Class Reference

Connects to an instrument profile URL and reads instrument profiles using Simple File Format with support of streaming live updates. Please see Instrument Profile Format documentation for complete description. More...

Public Member Functions

delegate void OnErrorEventHandler (object sender, ErrorEventArgs e)
 
 InstrumentProfileConnection (string address)
 Creates instrument profile connection with a specified address and Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
 
 InstrumentProfileConnection (string address, string login, string password)
 Creates instrument profile connection with a specified address and basic user and password credentials Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
 
 InstrumentProfileConnection (string address, string token)
 Creates instrument profile connection with a specified address and bearer token Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
 
void Start ()
 Starts this instrument profile connection. This connection's state immediately changes to State.Connecting and the actual connection establishment proceeds in the background. More...
 
void Close ()
 Closes this instrument profile connection. This connection's state immediately changes to State.Closed and the background update procedures are terminated. More...
 
void AddUpdateListener (InstrumentProfileUpdateListener listener)
 Adds listener that is notified about any updates in the set of instrument profiles. If a set of instrument profiles is not empty, then this listener is immediately notified right from inside this add method. More...
 
void RemoveUpdateListener (InstrumentProfileUpdateListener listener)
 Removes listener that is notified about any updates in the set of instrument profiles. More...
 
override string ToString ()
 Returns a string representation of the object. More...
 

Properties

long UpdatePeriod [get, set]
 Gets or sets update period in milliseconds. It is period of an update check when the instrument profiles source does not support live updates and/or when connection is dropped. Default update period is 1 minute. More...
 

Events

OnErrorEventHandler OnError
 

Detailed Description

Connects to an instrument profile URL and reads instrument profiles using Simple File Format with support of streaming live updates. Please see Instrument Profile Format documentation for complete description.

The key different between this class and InstrumentProfileReader is that the later just reads a snapshot of a set of instrument profiles, while this classes allows to track live updates, e.g. addition and removal of instruments.

To use this class you need an address of the data source from you data provider. The name of the IPF file can also serve as an address for debugging purposes.

The recommended usage of this class to receive a live stream of instrument profile updates is:

class UpdateListener : InstrumentProfileUpdateListener {
public void InstrumentProfilesUpdated(ICollection<InstrumentProfile> instruments) {
foreach (InstrumentProfile ip in instruments) {
// do something with instrument here.
}
}
}
class Program {
static void Main(string[] args) {
string address = "<host>:<port>";
InstrumentProfileConnection connection = new InstrumentProfileConnection(path);
UpdateListener updateListener = new UpdateListener();
connection.AddUpdateListener(updateListener);
connection.Start();
}
}

If long-running processing of instrument profile is needed, then it is better to use InstrumentProfileUpdateListener.InstrumentProfilesUpdated notification to schedule processing task in a separate thread.

This class is thread-safe.

Constructor & Destructor Documentation

◆ InstrumentProfileConnection() [1/3]

com.dxfeed.ipf.live.InstrumentProfileConnection.InstrumentProfileConnection ( string  address)
inline

Creates instrument profile connection with a specified address and Address may be just "&lt;host&gt;:&lt;port&gt;" of server, URL, or a file path. The "[update=&lt;period&gt;]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation.

Parameters
addressAddress of server

◆ InstrumentProfileConnection() [2/3]

com.dxfeed.ipf.live.InstrumentProfileConnection.InstrumentProfileConnection ( string  address,
string  login,
string  password 
)
inline

Creates instrument profile connection with a specified address and basic user and password credentials Address may be just "&lt;host&gt;:&lt;port&gt;" of server, URL, or a file path. The "[update=&lt;period&gt;]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation.

Parameters
addressAddress of server
loginThe user name (may be null).
passwordThe user password (may be null).

◆ InstrumentProfileConnection() [3/3]

com.dxfeed.ipf.live.InstrumentProfileConnection.InstrumentProfileConnection ( string  address,
string  token 
)
inline

Creates instrument profile connection with a specified address and bearer token Address may be just "&lt;host&gt;:&lt;port&gt;" of server, URL, or a file path. The "[update=&lt;period&gt;]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation.

Parameters
addressAddress of server
tokenThe bearer authorization's token

Member Function Documentation

◆ AddUpdateListener()

void com.dxfeed.ipf.live.InstrumentProfileConnection.AddUpdateListener ( InstrumentProfileUpdateListener  listener)
inline

Adds listener that is notified about any updates in the set of instrument profiles. If a set of instrument profiles is not empty, then this listener is immediately notified right from inside this add method.

Parameters
listenerProfile update listener.
Exceptions
ArgumentNullExceptionIf listener is null.

◆ Close()

void com.dxfeed.ipf.live.InstrumentProfileConnection.Close ( )
inline

Closes this instrument profile connection. This connection's state immediately changes to State.Closed and the background update procedures are terminated.

◆ RemoveUpdateListener()

void com.dxfeed.ipf.live.InstrumentProfileConnection.RemoveUpdateListener ( InstrumentProfileUpdateListener  listener)
inline

Removes listener that is notified about any updates in the set of instrument profiles.

Parameters
listenerProfile update listener.
Exceptions
ArgumentNullExceptionIf listener is null.

◆ Start()

void com.dxfeed.ipf.live.InstrumentProfileConnection.Start ( )
inline

Starts this instrument profile connection. This connection's state immediately changes to State.Connecting and the actual connection establishment proceeds in the background.

◆ ToString()

override string com.dxfeed.ipf.live.InstrumentProfileConnection.ToString ( )
inline

Returns a string representation of the object.

Returns
String representation of the object.

Property Documentation

◆ UpdatePeriod

long com.dxfeed.ipf.live.InstrumentProfileConnection.UpdatePeriod
getset

Gets or sets update period in milliseconds. It is period of an update check when the instrument profiles source does not support live updates and/or when connection is dropped. Default update period is 1 minute.


The documentation for this class was generated from the following file: