Infront Data Manager Connect Client (.NET)
Historical Timeseries

To get a historical time serie (open, high, low, close prices and volume) for a quotation the following steps must be done:

  1. Create a Routing Data Store(Gevasys.DataCore.StaticData.Http.RoutingDataStore Class).
  2. Create a instance of the required request message.
  3. Optional: Implement the interface IAsyncRouteCallback ( Gevasys.DataCore.StaticData.IAsyncRouteCallback Interface) for the calling class.
  4. Execute the request.
  5. Process the result.
using System;
using Gevasys.DataCore.RequestData.ProtoBuf.V2;
using log4net;
namespace Examples
{
class HistoricalTimeSeries
{
private static ILog log = LogManager.GetLogger("Historical");
private MessageSerializer serializer;
private RoutingDataStore rds;
public void Main()
{
ConfigurationHelper.Initialize();
serializer = new MessageSerializer();
rds = ConfigurationHelper.RoutingDataStore;
DateTime from = new DateTime(2019, 01, 30, 9, 0, 0);
DateTime to = new DateTime(2019, 01, 31, 13, 00, 0);
HistoricalTimeSeriesRequestMessage requestMessage = new HistoricalTimeSeriesRequestMessage
{
header = new RequestHeaderMessage
{
user = Authentication.GetUser(),
password = Authentication.GetPassword()
},
aggregation = HistoricAggregationParam.Day,
instrument = "846900.ETR",
withDividens = false,
withCorporateActions = false,
withIntraday = false,
tickType = TickTypeParam.Trade,
dateFrom = DateTimeConverter.Convert(ref from),
dateTo = DateTimeConverter.Convert(ref to)
};
StaticDataResponse response = rds.CallFunction(StaticDataFunctions.HISTORIC_DATA_V2,
InputFormat.PROTO.ToString(),
OutputFormat.PROTO.ToString(),
serializer.Serialize<HistoricalTimeSeriesRequestMessage>(OutputFormat.PROTO, requestMessage)
);
if (response.GetErrorCode() < 0)
{
log.Warn("Error when calling DMC: " + response.GetErrorMessage());
return;
}
HistoricalTimeSeriesMessage responseMessage = null;
try
{
byte[] responseData = response.GetData();
if (responseData != null && responseData.Length > 0)
{
responseMessage = serializer.Deserialize<HistoricalTimeSeriesMessage>(InputFormat.PROTO, responseData);
if (responseMessage.header != null)
{
if (responseMessage.header.error_code != ErrorCodes.Ok)
{
log.Warn("Error: " + responseMessage.header.error_message);
}
}
else
{
log.Error("The response from the call was empty. Please inform the vwd support to check the server configuration.");
}
}
}
catch (Exception e)
{
log.Error("", e);
}
if (responseMessage == null || responseMessage.header.error_code != ErrorCodes.Ok)
{
log.Error("Response empty or an error occured.");
return;
}
if (responseMessage.entry.Count < 5)
{
log.Error("no entries in response!!!!");
}
// dump response
foreach (HistoricalTimeSeriesEntryMessage row in responseMessage.entry)
{
DateTime date = DateTime.MinValue;
if (row.time.HasValue)
date = DateTimeConverter.FromUtcMillis(row.time.Value);
Console.WriteLine("Date: " + date.ToShortDateString() + " Open: " + row.open
+ " High: " + row.high
+ " Low: " + row.low
+ " Close: " + row.close
+ " Isue: " + row.issue
+ " Redemtion: " + row.redemption
+ " Volume: " + row.volume);
}
}
}
}

Note: Example available in "Data Manager Connect - ClientSamples".

Gevasys.DataCore
Definition: BinaryUpstreamClient.cs:5
Gevasys.DataCore.Configuration
Definition: ClassFactory.cs:17
Gevasys.DataCore.Webservice
Definition: Webservice.Generated/Reference.cs:11
Gevasys.DataCore.StaticData
Definition: AsyncFileDownloader.cs:10
Gevasys
Definition: BinaryUpstreamClient.cs:5
Examples
Definition: apiinitialize.cs:11
Gevasys.DataCore.StaticData.Http
Definition: AsyncFileDownloader.cs:10

Copyright (C) 2021 Infront Financial Technology GmbH
Mainzer Landstrasse 178 – 190
60327 Frankfurt am Main
Infront Data Manager Connect V4.1