I have an RTD server that I am using to send data to and from Excel. I am trying to make it easier on the user by building a few simple functions in a Module in Excel's VBA to allow for them to grab data without knowing the whole backend.
Function parseData(ByVal arrayData As String) As Variant
parseData = Evaluate(arrayData)
End Function
Function getQuote(ByVal ticker As String) As String
getQuote = parseData(Application.RTD("rTech.Quotes", , ticker))
End Function
Function getBidSize(ByVal ticker As String) As String
getBidSize = Application.RTD("rTech.Quotes", , ticker, "bidsize")
End Function
Function getBidPrice(ByVal ticker As String) As String
getBidPrice = Application.RTD("rTech.Quotes", , ticker, "bidprice")
End Function
Function getAskSize(ByVal ticker As String) As String
getAskSize = Application.RTD("rTech.Quotes", , ticker, "asksize")
End Function
Function getAskPrice(ByVal ticker As String) As String
getAskPrice = Application.RTD("rTech.Quotes", , ticker, "askprice")
End Function
Function getLast(ByVal ticker As String) As String
getLast = Application.RTD("rTech.Quotes", , ticker, "last")
End Function
That is it basically, though when I always call them by doing
=getBidSize("XXXX")
it returns #VALUE for each attempt; I am guessing it is crashing on the Application.RTD portion but I am not 100% sure since when using Debug it just "stops" when i step over the RTD call.
The main reason this was causing a problem is not due to anything but the fact that the RTD function wanted a blank second parameter and not just omit it, unlike you would do if you were doing this in the function bar inside of Excel.
So, the functions should be something like:
getLast = Application.RTD("rTech.Quotes", "", ticker, "last")