[This is preliminary documentation and is subject to change.]
Defines the Datastream Web Service client
System
Object
Datastream.DswsApi
DSClient
Namespace: Datastream.DswsApiAssembly: Datastream.DswsApi.NET4.0 (in Datastream.DswsApi.NET4.0.dll) Version: 1.0.0.0 (1.0.0.0)
public static class DSClient
public static class DSClient
Public NotInheritable Class DSClient
Public NotInheritable Class DSClient
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.
The following example illustrates typical usage of this class.
void OnMyAppStart()
{
DSClient.Options.UserName = "myusername@mycompany.com";
DSClient.Options.Password = "mypassword";
DSClient.Options.EndPointType = DSEndPointTypes.Soap;
DSClient.Init();
DSClient.DataService.Logon();
}
void OnMyGetDswsData()
{
var request = new DSDataRequest()
{
Instrument = new DSInstrument("VOD"),
DataTypes = new DSDataTypes("PL", "PH"),
Date = new DSTimeSeriesDate(DSDateType.Relative(-30), DSDateType.Relative(-10), DSDateFrequency.Daily)
};
var response = DSClient.DataService.GetData(request);
double[] dt1Values = response["PL"]["VOD"].GetValue<double[]>();
double[] dt2Values = response["PH"]["VOD"].GetValue<double[]>();
}
void OnMyAppShutDown()
{
DSClient.ShutDown();
}
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();
}
.NET API Framework
Supported in: 4.1, 3.6