DSClient ClassDSWS API (.NET)

[This is preliminary documentation and is subject to change.]

Defines the Datastream Web Service client
Inheritance Hierarchy

System  Object
   Datastream.DswsApi  DSClient

Namespace: Datastream.DswsApi
Assembly: Datastream.DswsApi.NET4.0 (in Datastream.DswsApi.NET4.0.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public static class DSClient
Remarks

This class is to be used as the entry point for accessing the Datastream Web Service API. Typically, you will configure the DSApiOptions, populate the DSDataRequest and get the data through DataService. You can either explicitly call the properties inside DSApiOptions or use the appSettings element of your configuration file to set the options. You can either create a single request or create multiple requests and execute them at one go by calling GetDataBundle(IEnumerable  DSDataRequest  ) . Further you can retrieve the data asynchronously through IDSDataServiceAsync methods.
Examples

The following example illustrates typical usage of this class.
void OnMyAppStart()
{
                // Configure options when the application starts
     DSClient.Options.UserName = "myusername@mycompany.com";
     DSClient.Options.Password = "mypassword";
     DSClient.Options.EndPointType = DSEndPointTypes.Soap;
     DSClient.Init();

                // Make sure we logon and have a valid token
     DSClient.DataService.Logon();
}

void OnMyGetDswsData()
{

                // Create a data request 
                var request = new DSDataRequest()
     {
         Instrument = new DSInstrument("VOD"),
         DataTypes = new DSDataTypes("PL", "PH"),
         Date = new DSTimeSeriesDate(DSDateType.Relative(-30), DSDateType.Relative(-10), DSDateFrequency.Daily)
     };

                // Execute the request 
                var response = DSClient.DataService.GetData(request);

                // Get the response value 
                double[] dt1Values = response["PL"]["VOD"].GetValue<double[]>();
                double[] dt2Values = response["PH"]["VOD"].GetValue<double[]>();

 }

                void OnMyAppShutDown()
 {
                // Shutdown when the application is closed
     DSClient.ShutDown();
 }
Version Information

.NET API Framework

Supported in: 4.1, 3.6
See Also