Provider Classes

In EasyLanguage, provider classes represent a group of component classes whose names end with the word "Provider." These classes are used to access data. The data may be historical, real-time, or both. Most of the provider classes are derived from the tsdata.common.DataProvider class, which in turn is derived from the elsystem.ELComponent class.

You can create methods in your EasyLanguage code that respond to events generated by instances of provider classes. Some provider classes have an Updated event that fires when the provider is loaded for the first time and, thereafter, when the data contained in the provider is updated real-time.  StateChanged events, another common event in provider classes, report a change in the state of the provider (loaded, unloaded, failed; see the DataState enumeration).  

Since providers are derived from the elsystem.ELComponent class, providers appear in the Toolbox in the TradeStation Development Environment (TDE). From the Toolbox you can drag and drop components, including providers, into your EasyLanguage code document. Components added to your code from the Toolbox are configured using the Properties Editor.

List of Providers
Name Description
AccountsProvider Gets account balance and other information from specified TradeStation accounts.
FundamentalQuotesProvider Gets information from specified fundamental fields for a symbol.
MarketDepthProvider Gets market depth bid and ask levels regarding specified ECN books for a symbol.
NewsProvider Gets news items for specified symbols and date ranges.
OptionChainProvider Gets information on the options available on a specified underlying security or index.
OrdersProvider Gets updated order status information based on user specified filters.
PositionsProvider Gets information about positions from specified TradeStation accounts.
PriceSeriesProvider Gets a historical price series for a specified symbol and interval, including real-time updates.
QuotesProvider Gets information from specified quote fields for a symbol.
RSSProvider Gets RSS news items from a specified RSS feed and web address.
SymbolAttributesProvider Gets information and attributes for a specified symbol.
SymbolListsProvider Gets information and attributes for a specified symbol.
TimeAndSalesProvider Gets information about   Level I trades as well as changes in the best bid and best ask prices.
Updated Event Handling

An Updated event for providers calls a user created method using format like this:   

<provider>_Updated(Object Sender, <prefix>UpdatedEventArgs Args)

The name of the method is typically made up of the <provider> component's name followed by _Updated. Here is an example that assumes that an AccountsProvider's Updated event is being handled, that the name of the AccountsProvider is MyAP, and that the updated event handler (the method shown below) does not return anything to the caller (return value is of type void):  

 

method void MyAP_Updated( Object sender, AccountUpdatedEventArgs args )

begin

// code to handle the Updated event goes here

end;

 

The handler will be called in two cases: when the DataProvider loads, and when values in the DataProvider (properties) update in real-time.

The sender parameter identifies the object that fired the event. More than one DataProvider can call a given event handler method.

The args parameter contains information about the nature of the change that happened in the DataProvider (initial update, real-time update, etc.) and contextual information regarding the updated value(s). For example, when an Order in an OrdersProvider is filled, the sender (the OrdersProvider) fires an Updated event. The OrderUpdatedEventArgs include information about the Order that was filled. Note that some properties of the args may be null because they are inapplicable or do not yet have values.

StateChanged Event Handling

A StateChanged event for providers calls a user created method using a format similar to that of the Updated Event (see above). The args provided when a StateChanged even fires provide information about the old state of the provider, the new state of the provider, and relevant error conditions (see StateChangedEventArgs).