Table of Contents

Interface INewsProvider

Namespace
ATAS.Indicators.News
Assembly
ATAS.Indicators.dll

Access to financial news, economic events, earnings and dividend data of the ATAS news server (data sourced from EODHD). Requires the news feature of the user's subscription.

Added in ATAS 8.0.15.

public interface INewsProvider
Extension Methods

Remarks

Instruments are identified by the ATAS instrument code and exchange (for example, AAPL and NASDAQ); the server maps them to the data-feed symbols. Earnings and dividend requests for an instrument without such a mapping fail.

A System.DateTime argument with System.DateTimeKind.Unspecified is treated as UTC and a local one is converted to UTC. History requests for news and economic events cover at most the last 365 days.

Events may be raised on a background thread, not on the UI thread. Exceptions thrown by event handlers are swallowed. Network methods throw System.InvalidOperationException when the news service is not available (the feature is not enabled, the server address is unknown, there is no platform session, or the history request failed after several attempts).

Methods

GetDividendsAsync(string, string, DateTime, CancellationToken)

Loads the dividend payments of an instrument with an ex-dividend date on or after from, ordered by that date.

Task<IReadOnlyList<Dividend>> GetDividendsAsync(string code, string exchange, DateTime from, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

from DateTime

The earliest ex-dividend date to return.

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<Dividend>>

The dividend payments.

Exceptions

ArgumentException

code or exchange is empty.

GetDividendsCalendarAsync(string, string, DateTime, CancellationToken)

Loads the dividend calendar entries of an instrument, including upcoming ones, dated on or after from, ordered by date.

Task<IReadOnlyList<DividendEvent>> GetDividendsCalendarAsync(string code, string exchange, DateTime from, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

from DateTime

The earliest date to return.

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<DividendEvent>>

The calendar entries.

Exceptions

ArgumentException

code or exchange is empty.

GetEarningsAsync(string, string, DateTime, CancellationToken)

Loads the earnings reports of an instrument, including scheduled ones, whose report date is on or after from, ordered by report date. The server keeps about ten years of history.

Task<IReadOnlyList<EarningsEvent>> GetEarningsAsync(string code, string exchange, DateTime from, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

from DateTime

The earliest report date to return.

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<EarningsEvent>>

The earnings records.

Exceptions

ArgumentException

code or exchange is empty.

GetEarningsTrendsAsync(string, string, CancellationToken)

Loads the analyst estimates of an instrument for all available forecast horizons. The data has no date filter.

Task<IReadOnlyList<EarningsTrend>> GetEarningsTrendsAsync(string code, string exchange, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<EarningsTrend>>

The estimate records.

Exceptions

ArgumentException

code or exchange is empty.

GetEconomicEventsAsync(string?, string?, EconomicEventComparison?, DateTime, CancellationToken)

Loads economic events matching the filter without subscribing. The result covers the period from from to 30 days ahead, so it includes scheduled releases; EconomicEventsReceived is not raised.

Task<IReadOnlyList<EconomicEvent>> GetEconomicEventsAsync(string? country, string? type, EconomicEventComparison? comparison, DateTime from, CancellationToken ct = default)

Parameters

country string

The ISO 3166-1 alpha-2 country code, or null or empty to match any country.

type string

The indicator name (see GetEventTypesAsync(CancellationToken)), or null or empty to match any type.

comparison EconomicEventComparison?

The comparison basis, or null to match any.

from DateTime

The start of the period to load.

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<EconomicEvent>>

The matching events.

Exceptions

ArgumentException

None of country, type and comparison is specified.

GetEventCountriesAsync(CancellationToken)

Gets the ISO 3166-1 alpha-2 codes of the countries for which economic events are available. The result is cached after the first successful request.

Task<IReadOnlyList<string>> GetEventCountriesAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<string>>

The list of country codes.

GetEventTypesAsync(CancellationToken)

Gets the catalog of known economic indicator names, the values of Type. The result is cached after the first successful request.

Task<IReadOnlyList<string>> GetEventTypesAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<string>>

The list of indicator names.

GetTagsAsync(CancellationToken)

Gets the catalog of known news topic tags (upper case, sorted). The result is cached after the first successful request.

Task<IReadOnlyList<string>> GetTagsAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

A token to cancel the request.

Returns

Task<IReadOnlyList<string>>

The list of tags.

SubscribeEarningsAsync(string, string, CancellationToken)

Subscribes to revisions of the earnings records of an instrument, delivered through EarningsReceived.

Task SubscribeEarningsAsync(string code, string exchange, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the subscription is active.

Exceptions

ArgumentException

code or exchange is empty.

SubscribeEconomicEventsAsync(string?, string?, EconomicEventComparison?, DateTime, CancellationToken)

Subscribes to economic events matching the filter. The events since from, including releases scheduled for the next 30 days, are delivered through EconomicEventsReceived before the task completes, then new and updated events follow.

Task SubscribeEconomicEventsAsync(string? country, string? type, EconomicEventComparison? comparison, DateTime from, CancellationToken ct = default)

Parameters

country string

The ISO 3166-1 alpha-2 country code, or null or empty to match any country.

type string

The indicator name (see GetEventTypesAsync(CancellationToken)), or null or empty to match any type.

comparison EconomicEventComparison?

The comparison basis, or null to match any.

from DateTime

The start of the history to load.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the history is delivered and the live subscription is active.

Exceptions

ArgumentException

None of country, type and comparison is specified.

SubscribeNewsBySymbolAsync(string, string, DateTime, CancellationToken)

Subscribes to news about an instrument. The history since from is delivered through NewsReceived before the task completes, then live articles follow.

Task SubscribeNewsBySymbolAsync(string code, string exchange, DateTime from, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

from DateTime

The start of the history to load.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the history is delivered and the live subscription is active.

Exceptions

ArgumentException

code or exchange is empty.

SubscribeNewsByTagAsync(string, DateTime, CancellationToken)

Subscribes to news with a topic tag. The history since from is delivered through NewsReceived before the task completes, then live articles follow.

Task SubscribeNewsByTagAsync(string tag, DateTime from, CancellationToken ct = default)

Parameters

tag string

The topic tag; see GetTagsAsync(CancellationToken).

from DateTime

The start of the history to load.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the history is delivered and the live subscription is active.

Exceptions

ArgumentException

tag is empty.

UnsubscribeEarningsAsync(string, string, CancellationToken)

Cancels a subscription made by SubscribeEarningsAsync(string, string, CancellationToken). Does nothing when there is no such subscription.

Task UnsubscribeEarningsAsync(string code, string exchange, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the subscription is cancelled.

Exceptions

ArgumentException

code or exchange is empty.

UnsubscribeEconomicEventsAsync(string?, string?, EconomicEventComparison?, CancellationToken)

Cancels a subscription made by SubscribeEconomicEventsAsync(string?, string?, EconomicEventComparison?, DateTime, CancellationToken) with the same filter. Does nothing when there is no such subscription.

Task UnsubscribeEconomicEventsAsync(string? country, string? type, EconomicEventComparison? comparison, CancellationToken ct = default)

Parameters

country string

The country code of the subscription, or null.

type string

The indicator name of the subscription, or null.

comparison EconomicEventComparison?

The comparison basis of the subscription, or null.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the subscription is cancelled.

Exceptions

ArgumentException

None of country, type and comparison is specified.

UnsubscribeNewsBySymbolAsync(string, string, CancellationToken)

Cancels a subscription made by SubscribeNewsBySymbolAsync(string, string, DateTime, CancellationToken). Does nothing when there is no such subscription.

Task UnsubscribeNewsBySymbolAsync(string code, string exchange, CancellationToken ct = default)

Parameters

code string

The ATAS instrument code.

exchange string

The ATAS exchange of the instrument.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the subscription is cancelled.

Exceptions

ArgumentException

code or exchange is empty.

UnsubscribeNewsByTagAsync(string, CancellationToken)

Cancels a subscription made by SubscribeNewsByTagAsync(string, DateTime, CancellationToken). Does nothing when there is no such subscription.

Task UnsubscribeNewsByTagAsync(string tag, CancellationToken ct = default)

Parameters

tag string

The topic tag.

ct CancellationToken

A token to cancel the request.

Returns

Task

A task that completes when the subscription is cancelled.

Events

EarningsReceived

Occurs when earnings records of instruments subscribed with SubscribeEarningsAsync(string, string, CancellationToken) are revised by the server (for example, when the actual figures are published on the report date). No history is delivered through this event; use GetEarningsAsync(string, string, DateTime, CancellationToken) for it.

event Action<IReadOnlyCollection<EarningsEvent>>? EarningsReceived

Event Type

Action<IReadOnlyCollection<EarningsEvent>>

EconomicEventsReceived

Occurs when economic events arrive: the history batch requested by SubscribeEconomicEventsAsync(string?, string?, EconomicEventComparison?, DateTime, CancellationToken) and then new or updated events (for example, a published Actual value) for all active subscriptions.

event Action<IReadOnlyCollection<EconomicEvent>>? EconomicEventsReceived

Event Type

Action<IReadOnlyCollection<EconomicEvent>>

NewsReceived

Occurs when news articles arrive: the history batch requested by a subscription and then live articles for all active news subscriptions.

event Action<IReadOnlyCollection<NewsArticle>>? NewsReceived

Event Type

Action<IReadOnlyCollection<NewsArticle>>