dxFeed .Net API  5.8.0
dxFeed .Net API library intended to provide market data access for DX clients
Public Member Functions
com.dxfeed.api.IDXFeed Interface Reference

Main entry class for dxFeed API (read it first). More...

Inheritance diagram for com.dxfeed.api.IDXFeed:
[legend]

Public Member Functions

IDXFeedSubscription< E > CreateSubscription< E > ()
 Creates new subscription for a single event type that is attached to this feed. For multiple event types in one subscription use CreateSubscription<E>(Type[]). This method creates new IDXFeedSubscription<E>. More...
 
IDXFeedSubscription< E > CreateSubscription< E > (params Type[] eventTypes)
 Creates new subscription for multiple event types that is attached to this feed. For a single event type use CreateSubscription<E>. This method creates new IDXFeedSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>). More...
 
IDXFeedTimeSeriesSubscription< E > CreateTimeSeriesSubscription< E > ()
 Creates new time series subscription for a single event type that is attached to this feed. For multiple event types in one subscription use CreateTimeSeriesSubscription<E>(Type[]). This method creates new IDXFeedTimeSeriesSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>). More...
 
IDXFeedTimeSeriesSubscription< E > CreateTimeSeriesSubscription< E > (params Type[] eventTypes)
 Creates new time series subscription for multiple event types that is attached to this feed. For a single event type use CreateTimeSeriesSubscription<E>. This method creates new IDXFeedTimeSeriesSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>). More...
 
void AttachSubscription< E > (IDXFeedSubscription< E > subscription)
 
void DetachSubscription< E > (IDXFeedSubscription< E > subscription)
 Detaches the given subscription from this feed. This method does nothing if the corresponding subscription is not attached to this feed. More...
 
Task< IDxLastingEventGetLastEventPromise< E > (object symbol, CancellationToken cancellationToken)
 Requests the last event for the specified event type and symbol. This method works only for event types that implement IDxLastingEvent marker interface. This method requests the data from the the uplink data provider, creates new event of the specified event type E, and completes the resulting promise with this event. More...
 
List< Task< IDxLastingEvent > > GetLastEventsPromises< E > (ICollection< object > symbols, CancellationToken cancellationToken)
 Requests the last events for the specified event type and a collection of symbols. This method works only for event types that implement IDxLastingEvent marker interface. This method requests the data from the the uplink data provider, creates new events of the specified event type E, and completes the resulting promises with these events. More...
 
Task< List< E > > GetIndexedEventsPromise< E > (object symbol, IndexedEventSource source, CancellationToken cancellationToken)
 Requests a list of indexed events for the specified event type, symbol, and source. This method works only for event types that implement IDxIndexedEvent interface. This method requests the data from the the uplink data provider, creates a list of events of the specified event type E, and completes the resulting promise with this list. The events are ordered by IDxIndexedEvent.Index in the list. More...
 
Task< List< E > > GetTimeSeriesPromise< E > (object symbol, long fromTime, long toTime, CancellationToken cancellationToken)
 Requests time series of events for the specified event type, symbol, and a range of time. This method works only for event types that implement IDxTimeSeriesEvent interface. This method requests the data from the the uplink data provider, creates a list of events of the specified event type E, and completes the resulting promise with this list. The events are ordered by IDxTimeSeriesEvent.Time in the list. More...
 

Detailed Description

Main entry class for dxFeed API (read it first).

Member Function Documentation

◆ AttachSubscription< E >()

void com.dxfeed.api.IDXFeed.AttachSubscription< E > ( IDXFeedSubscription< E >  subscription)

Attaches the given subscription to this feed. This method does nothing if the corresponding subscription is already attached to this feed.

This feed publishes data to the attached subscription. Application can attach IDXFeedEventListener<E> via IDXFeedSubscription<E>.AddEventListener(IDXFeedEventListener<E>) to get notified about data changes and can change its data subscription via IDXFeedSubscription<E> methods.

Template Parameters
EThe type of events.
Parameters
subscriptionThe subscription.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxEventType 

◆ CreateSubscription< E >() [1/2]

IDXFeedSubscription<E> com.dxfeed.api.IDXFeed.CreateSubscription< E > ( )

Creates new subscription for a single event type that is attached to this feed. For multiple event types in one subscription use CreateSubscription<E>(Type[]). This method creates new IDXFeedSubscription<E>.

Template Parameters
EThe type of events.
Returns
New IDXFeedSubscription<E> for a single event type.
Exceptions
InvalidOperationExceptionEndpoint was been closed.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxEventType 

◆ CreateSubscription< E >() [2/2]

IDXFeedSubscription<E> com.dxfeed.api.IDXFeed.CreateSubscription< E > ( params Type []  eventTypes)

Creates new subscription for multiple event types that is attached to this feed. For a single event type use CreateSubscription<E>. This method creates new IDXFeedSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>).

Template Parameters
EThe type of events.
Parameters
eventTypesThe classes of event types.
Returns
The new IDXFeedSubscription<E>.
Exceptions
InvalidOperationExceptionEndpoint was been closed.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxEventType 

◆ CreateTimeSeriesSubscription< E >() [1/2]

IDXFeedTimeSeriesSubscription<E> com.dxfeed.api.IDXFeed.CreateTimeSeriesSubscription< E > ( params Type []  eventTypes)

Creates new time series subscription for multiple event types that is attached to this feed. For a single event type use CreateTimeSeriesSubscription<E>. This method creates new IDXFeedTimeSeriesSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>).

Template Parameters
EThe base type of events.
Parameters
eventTypesThe classes of event types.
Returns
New time series subscription.
Exceptions
InvalidOperationExceptionEndpoint was been closed.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxTimeSeriesEvent 

◆ CreateTimeSeriesSubscription< E >() [2/2]

IDXFeedTimeSeriesSubscription<E> com.dxfeed.api.IDXFeed.CreateTimeSeriesSubscription< E > ( )

Creates new time series subscription for a single event type that is attached to this feed. For multiple event types in one subscription use CreateTimeSeriesSubscription<E>(Type[]). This method creates new IDXFeedTimeSeriesSubscription<E> and invokes AttachSubscription<E>(IDXFeedSubscription<E>).

Template Parameters
EThe type of event.
Returns
New time series subscription.
Exceptions
InvalidOperationExceptionEndpoint was been closed.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxTimeSeriesEvent 

◆ DetachSubscription< E >()

void com.dxfeed.api.IDXFeed.DetachSubscription< E > ( IDXFeedSubscription< E >  subscription)

Detaches the given subscription from this feed. This method does nothing if the corresponding subscription is not attached to this feed.

Parameters
subscriptionThe subscription.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxEventType 

◆ GetIndexedEventsPromise< E >()

Task<List<E> > com.dxfeed.api.IDXFeed.GetIndexedEventsPromise< E > ( object  symbol,
IndexedEventSource  source,
CancellationToken  cancellationToken 
)

Requests a list of indexed events for the specified event type, symbol, and source. This method works only for event types that implement IDxIndexedEvent interface. This method requests the data from the the uplink data provider, creates a list of events of the specified event type E, and completes the resulting promise with this list. The events are ordered by IDxIndexedEvent.Index in the list.

This method is designed for retrieval of a snapshot only. Use IDxConnection.CreateSnapshotSubscription(EventType, long, IDxSnapshotListener) if you need a list of time-series events that updates in real time.

The promise is TaskStatus.Canceled when the the underlying DXEndpoint is DXEndpoint.Close(). If the event is not available for any transient reason (no subscription, no connection to uplink, etc), then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait. Use CancellationTokenSource class constructors and methods to specify timeout while waiting for promise to complete. If the event is permanently not available (not supported), then the promise completes exceptionally with AggregateException.

Note, that this method does not work when DXEndpoint was created with DXEndpoint.Role::STREAM_FEED role (promise completes exceptionally).

Event source

Use the IndexedEventSource.DEFAULT value for source with events that do not have multiple sources (like IDxSeries). For events with multiple sources (like IDxOrder and IDxSpreadOrder), use an even-specific source class (for example, OrderSource). This method does not support synthetic sources of orders (orders that are automatically generated from IDxQuote events).

Event flags and consistent snapshot

This method completes promise only when a consistent snapshot of time series has been received from the data feed. The IDxIndexedEvent.EventFlags property of the events in the resulting list is always zero.

Threads

Use Task.ContinueWith(Action<Task>) method on the resulting promise to receive notification when the promise becomes done.

Template Parameters
EThe event type.
Parameters
symbolThe collection of symbols.
sourceThe source.
cancellationTokenThe task cancellation token.
Returns
The promise for the result of the request.
Exceptions
ArgumentExceptionThe symbol symbol is not one of string or CandleSymbol.
ArgumentNullExceptionThe symbol or source is null.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxIndexedEvent 

◆ GetLastEventPromise< E >()

Task<IDxLastingEvent> com.dxfeed.api.IDXFeed.GetLastEventPromise< E > ( object  symbol,
CancellationToken  cancellationToken 
)

Requests the last event for the specified event type and symbol. This method works only for event types that implement IDxLastingEvent marker interface. This method requests the data from the the uplink data provider, creates new event of the specified event type E, and completes the resulting promise with this event.

This method is designed for retrieval of a snapshot only. Use DXFeedSubscription<E> if you need event updates in real time.

The promise is TaskStatus.Canceled when the the underlying DXEndpoint is DXEndpoint.Close(). If the event is not available for any transient reason (no subscription, no connection to uplink, etc), then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait. Use CancellationTokenSource class constructors and methods to specify timeout while waiting for promise to complete. If the event is permanently not available (not supported), then the promise completes exceptionally with AggregateException.

There is a bulk version of this method that works much faster for a single event type and multiple symbols. See GetLastEventsPromises<E>(ICollection<object>, CancellationToken).

Note, that this method does not work when DXEndpoint was created with DXEndpoint.Role::STREAM_FEED role (promise completes exceptionally).

Threads

Use Task.ContinueWith(Action<Task>) method on the resulting promise to receive notification when the promise becomes done.

Use the following pattern of code to acquire multiple events (either for multiple symbols and/or multiple events) and wait with a single timeout for all of them:

List<Task<LastingEvent>> promises = new List<Task<LastingEvent>>();
// iterate the following line for all events and/or symbols that are needed
promises.Add(feed.GetLastEventPromise<eventType>(symbol, new CancellationTokenSource(taskTimeout).Token));
// combine the list of promises into one with Task utility method and wait
try
{
Task.WaitAll(tasks.ToArray());
}
catch (AggregateException) {}
// now iterate the promises to retrieve results
foreach (Task<LastingEvent> promise in promises)
// result received exceptionally if this event was not found
// so first check that task completes successfully
if (promise.Status == TaskStatus.RanToCompletion)
doSomethingWith(promise.Result);
Template Parameters
EThe event type.
Parameters
symbolThe symbol.
cancellationTokenThe task cancellation token.
Returns
The promise for the result of the request.
Exceptions
ArgumentExceptionThe symbol symbol is not one of string or CandleSymbol.
ArgumentNullExceptionThe symbol is null.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :class 
E :IDxLastingEvent 

◆ GetLastEventsPromises< E >()

List<Task<IDxLastingEvent> > com.dxfeed.api.IDXFeed.GetLastEventsPromises< E > ( ICollection< object >  symbols,
CancellationToken  cancellationToken 
)

Requests the last events for the specified event type and a collection of symbols. This method works only for event types that implement IDxLastingEvent marker interface. This method requests the data from the the uplink data provider, creates new events of the specified event type E, and completes the resulting promises with these events.

This is a bulk version of GetLastEventPromise<E>(object, CancellationToken) method.

The promise is TaskStatus.Canceled when the the underlying DXEndpoint is DXEndpoint.Close(). If the event is not available for any transient reason (no subscription, no connection to uplink, etc), then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait. Use CancellationTokenSource class constructors and methods to specify timeout while waiting for promise to complete. If the event is permanently not available (not supported), then the promise completes exceptionally with AggregateException.

Note, that this method does not work when DXEndpoint was created with DXEndpoint.Role::STREAM_FEED role (promise completes exceptionally).

Threads

Use Task.ContinueWith(Action<Task>) method on the resulting promise to receive notification when the promise becomes done.

Use the following pattern of code to acquire multiple events (either for multiple symbols and/or multiple events) and wait with a single timeout for all of them:

List<Task<LastingEvent>> promises = feed.GetLastEventsPromises<IDxTrade>(
symbols,
new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token);
// combine the list of promises into one with Task utility method and wait
try
{
Task.WaitAll(promises.ToArray());
}
catch (AggregateException) { }
// now iterate the promises to retrieve results
foreach (var promise in promises)
// result received exceptionally if this event was not found
// so first check that task completes successfully
if (promise.Status == TaskStatus.RanToCompletion)
Console.WriteLine(promise.Result);
Template Parameters
EThe event type.
Parameters
symbolsThe collection of symbols.
cancellationTokenThe task cancellation token.
Returns
The list of promises for the result of the requests, one item in list per symbol.
Exceptions
ArgumentExceptionThe one of symbols is not string or CandleSymbol.
ArgumentNullExceptionThe one of symbols is null.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :class 
E :IDxLastingEvent 

◆ GetTimeSeriesPromise< E >()

Task<List<E> > com.dxfeed.api.IDXFeed.GetTimeSeriesPromise< E > ( object  symbol,
long  fromTime,
long  toTime,
CancellationToken  cancellationToken 
)

Requests time series of events for the specified event type, symbol, and a range of time. This method works only for event types that implement IDxTimeSeriesEvent interface. This method requests the data from the the uplink data provider, creates a list of events of the specified event type E, and completes the resulting promise with this list. The events are ordered by IDxTimeSeriesEvent.Time in the list.

This method is designed for retrieval of a snapshot only. Use IDxConnection.CreateSnapshotSubscription(EventType, long, IDxSnapshotListener) if you need a list of time-series events that updates in real time.

The range and depth of events that are available with this service is typically constrained by upstream data provider.

The promise is TaskStatus.Canceled when the the underlying DXEndpoint is DXEndpoint.Close(). If the event is not available for any transient reason (no subscription, no connection to uplink, etc), then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait. Use CancellationTokenSource class constructors and methods to specify timeout while waiting for promise to complete. If the event is permanently not available (not supported), then the promise completes exceptionally with AggregateException.

Note, that this method does not work when DXEndpoint was created with DXEndpoint.Role::STREAM_FEED role (promise completes exceptionally).

Event flags

This method completes promise only when a consistent snapshot of time series has been received from the data feed. The IDxIndexedEvent.EventFlags property of the events in the resulting list is always zero.

Threads

Use Task.ContinueWith(Action<Task>) method on the resulting promise to receive notification when the promise becomes done.

Template Parameters
EThe event type.
Parameters
symbolThe symbol.
fromTimeThe time, inclusive, to request events from IDxTimeSeriesEvent.Time.
toTimeThe time, inclusive, to request events to IDxTimeSeriesEvent.Time. Use long.MaxValue to retrieve events without an upper limit on time.
cancellationTokenThe task cancellation token.
Returns
The promise for the result of the request.
Exceptions
ArgumentExceptionThe symbol symbol is not one of string or CandleSymbol.
ArgumentNullExceptionThe symbol is null.

Implemented in com.dxfeed.api.DXFeed.

Type Constraints
E :IDxTimeSeriesEvent 

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