GETRTD for Kite and Upstox

Sreenath
Is it possible for me to use GetRTD for Kite as well as Upstox in Kitexl it self by providing proper parameter for both like
for Kite : ProgId : Kite.RTD and Exchange = NSE and Field
For Upstox ProgId: Upstox.Rtd and Exchange = NSE_EQ and Filed
  • HowUTrade
    For Kite, ProgId is KiteNet.Rtd
  • Sreenath
    i am using KiteXL and subscribed quote for Both Kite as well Uptox..
    I could able to Get LTP values whenever i pass the parameters for Kite but the same is not true in case of Upstox. GETRTD will be 0 and even it will not throw any errors also..
    I have modified GETRTD function by adding Num as Integer ( Additional parameter to identify whether the call is from Kite or Upstox, 1 is for Kite and 2 is for Upstox).

    below is the code snippet, could you help me out where is the issue?
    Declaration:

    Public Const Rtd_server As String = "KiteNet.Rtd" 'Change as Required
    Public Const Rtd_Server_Upstox As String = "Upstox.Rtd"

    Public Function GetRTD(ByVal Exch As String, ByVal TrdSymbol As String, ByVal Field As String, ByVal Num As Integer) As Variant
    On Error GoTo ErrHandler:
    Dim Prfx As String
    If Num = 1 Then
    If Exch = "" Or TrdSymbol = "" Or Field = "" Then
    GetRTD = 0
    Exit Function
    End If

    Prfx = TrdSymbol & "." & Exch
    GetRTD = WorksheetFunction.RTD(Rtd_server, "", Prfx, Field)

    Exit Function
    ElseIf Num = 2 Then
    If Exch = "" Or TrdSymbol = "" Or Field = "" Then
    GetRTD = 0
    Exit Function
    End If

    Prfx = TrdSymbol & "." & Exch
    GetRTD = WorksheetFunction.RTD(Rtd_Server_Upstox, "", Prfx, Field)

    Exit Function
    End If

    ErrHandler:
    ' MsgBox Err.Description
    GetRTD = 0
    End Function
Sign In or Register to comment.