Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. Sub Login()
  2.  
  3. Dim userName As String
  4. Dim password As String
  5. Dim apiKey As String
  6.  
  7. userName = "username"
  8. password = "password"
  9. apiKey = "key123"
  10.  
  11. 'activityTextbox.Text = ""
  12. 'clearData
  13.  
  14. Dim authResult As Dictionary
  15. Set authResult = restClient.authenticateAccount(userName, password, apiKey)
  16. If Not authResult Is Nothing Then
  17. 'appendActivity "Connected"
  18. ' Configure Excel to pull streaming updates as often as possible
  19. Application.RTD.ThrottleInterval = 0
  20. ' Uncomment for real-time prices - this is very CPU intensive
  21. ' Buffer interval defaults to 500ms
  22. 'Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "bufferInterval", "0"
  23. ' Set manual refresh to true from very remote locations
  24. ' Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "manualRefresh", "true"
  25. ' This will require manually calling refresh to update lighstreamer subscriptions, i.e.
  26. ' Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "refresh"
  27. Dim maxPriceRequestsPerSecond As Double
  28. maxPriceRequestsPerSecond = 0 ' all available updates
  29. If restClient.streamingAuthentication(maxPriceRequestsPerSecond) Then
  30. m_loggedIn = True
  31. 'populateWatchlists
  32. 'populateAccounts
  33. 'manualStreamingRefresh
  34. 'Else
  35. ' appendActivity "Lightstreamer connection failure"
  36. End If
  37. Else
  38. MsgBox "Authentication failed"
  39. End If
  40.  
  41. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement