Using the COM API

QuoteLink offers COM based interfaces to request and access internal data.

You may want to try and experiment at the same time read this notes:

Using Visual Basic

Requesting quotes synchronously

Let's start with a simple example and ilustrate the main points

The communication with QuoteLinks starts with a Link object. The link object represents the all infrastructure and everything will happen through its methods. QuoteLink applications need to have at least one (and one is enough for most cases).With the New operator we create the Link Object and we can then start requesting data.

The Request method takes a symbol and a feed as arguments and returns when the data is received. The return value is a Node containing all fields. To access the LAST field we simply index the Node with the file name it.

We could instead 'dump' all the fields contained in the returned Node:

Module Module1
 
   Sub Main()
 
      Dim l As QLClient.Link
      Dim n As QLClient.Node
      Dim fld As QLClient.Node
 
      l = New QLClient.Link
 
      n = l.Request("IBM", "MSN")
 
      Dim s As String
 
      For Each fld In n
 
         s = fld.Value.ToString()
         Console.WriteLine(fld.Name & " Value = " & s)
      Next
 
   End Sub
 
End Module

Requesting quotes asynchronously

Requesting quotes asynchronously requires the use of events

Module Module1
    Dim WithEvents n As QLClient.Node
 
 
    Sub Main()
 
        Dim l As QLClient.Link
 
        l = New QLClient.Link
 
        n = l.Listen("IBM", "MSN")
 
        l.Commit()
 
        Console.Read() ' this makes program hold until a key is pressed

    End Sub
 
    Private Sub n_Update(ByVal Node As QLClient.Node, ByVal Update As QLClient.Node) Handles n.Update
 
        For Each Update In n
            Console.WriteLine(Update.Name & " Value = " & Update.Value)
        Next
 
    End Sub
 
End Module