Hi Govert,
I like the latter approach via RTD and ExcelRtdServer base class you described. I am, however, running in a few issues:
* I created an Rtd Server class that derives from ExcelRtdServer and also store within the same class my cached data like
public class RtdServer : ExcelRtdServer
{
private readonly List<Topic> _topics;
private Dictionary<string, double> _realtimePrices;
private Dictionary<string, double[]> _dailyPriceSeries;
private Dictionary<string, double[]> _intradayPriceSeries;
...
..
.
I update the cached data from a UDF that is defined outside the Rtd Server like
public static class UserDefinedFunctions
{
private static RtdServer _rtdServer;
static UserDefinedFunctions()
{
_rtdServer = new RtdServer();
}
[ExcelFunction(Description = "UpdateRealTimePrices")]
public static string UpdateRealTimePrices(object[] symbols, double[] realTimePrices)
{
return _rtdServer.UpdateRealTimePrices(symbols, realTimePrices);
}
[ExcelFunction(Description = "GetTodaysMovers")]
public static object GetTodaysMovers()
{
return XlCall.RTD("ExcelLibrary.RtdServer", null, "TodaysMoversSubscription");
}
...
..
.
And I also expose a UDF to subscribe via Topic to the Rtd Server as can be seen above.
The problem I am experiencing is that the call to XlCall.RTD(... spins up a different instance of RtdServer than the RtdServer instance I define in my static UDF function class "UserDefinedFunctions"
As a result I cannot update both the cached data and peruse the same data to update Rtd topic subscribers with the refreshed data in any meaningful way.
Is there a way to get a reference or pass a reference to the existing instance of RtdServer when I subscribe to the topic within a UDF function via XlCall.RTD?
Thanks