Acive X

Quote from ethos:

What is your question?

No question, my firm is releasing an ActiveX API and I wanted to provide the link to those that have some expertice in ActiveX
 
Could someone here help me w/ a timer event. I am writing a VB program which takes quotes from IB's server using ActiveX. i need to pause between my request data functions in order to give IB time to get the quotes. Is there a way to do that. I have been playing around with the timer function to no success. To simplify things, if I want to print "Hello" then "world" but need to print them 10 seconds apart. How can I do that? Thanks in advance.
 
Quote from GATrader:

Could someone here help me w/ a timer event. I am writing a VB program which takes quotes from IB's server using ActiveX. i need to pause between my request data functions in order to give IB time to get the quotes. Is there a way to do that. I have been playing around with the timer function to no success. To simplify things, if I want to print "Hello" then "world" but need to print them 10 seconds apart. How can I do that? Thanks in advance.
Go through this example of an alarm clock and you can see how to setup a timer control to check the system time (Time function) every 1/2 second or so. You don't want to bog things down by checking too fast, like every millisec, if you only want a resolution in seconds. Then you can easily count the seconds up to 10. To use this example just drop a Timer control on a form, enable and set the Interval to something like 500.



Option Explicit
Dim AlarmTime
Const conMinimized = 1


Private Sub Form_Click()
AlarmTime = InputBox("Enter alarm time", "VB Alarm", AlarmTime)
If AlarmTime = "" Then Exit Sub
If Not IsDate(AlarmTime) Then
MsgBox "The time you entered was not valid."
Else ' String returned from InputBox is a valid time,
AlarmTime = CDate(AlarmTime) ' so store it as a date/time value in AlarmTime.
End If
End Sub

Private Sub Form_Load()
AlarmTime = ""
End Sub

Private Sub Form_Resize()
If WindowState = conMinimized Then ' If form is minimized, display the time in a caption.
SetCaptionTime
Else
Caption = "Alarm Clock"
End If
End Sub

Private Sub SetCaptionTime()
Caption = Format(Time, "Medium Time") ' Display time using medium time format.
End Sub

Private Sub Timer1_Timer()
Static AlarmSounded As Integer
If lblTime.Caption <> CStr(Time) Then
' It's now a different second than the one displayed.
If Time >= AlarmTime And Not AlarmSounded Then
Beep
MsgBox "Alarm at " & Time
AlarmSounded = True
ElseIf Time < AlarmTime Then
AlarmSounded = False
End If
If WindowState = conMinimized Then
' If minimized, then update the form's Caption every minute.
If Minute(CDate(Caption)) <> Minute(Time) Then SetCaptionTime
Else
' Otherwise, update the label Caption in the form every second.
lblTime.Caption = Time
End If
End If
End Sub
 
Thanks for your response !

I have another ? for the TWS API experts out there.

My understanding is that there is a 40 ticker limit at any 1 time with Ib's Active X. I created a VB program which uses the reqdata function to get quotes for options. It goes thru an excel spreadsheet and fires off the requests. I have limited it to about 35-38 symbols Ex ibm May80 c and ibm may 80 p are counted as 2 tickers towards my 40. After requesting the set, I then call the cancelmktdata for each of the symbols, wait 10 seconds and fire off another set of 38 symbols. 60% of the time, I get this "You have exceeded maximum allowed amount" Why? Any suggestions? Thanks
 
In addition to the 40 symbol limit there is a maximum of something like 10,000 per day, otherwise I'm not sure why you would get the message. Maybe your Cancel request is not getting thru?

A fairly easy way around the whole limitation thing is to use the free program QuoteTracker. QT can get the quotes from a very large selection of venders. I use Money.Net "Screamer" snap quotes. You just send QT your list of symbols or portfolio commands "embedded" in a URL to the local server using the VB Inet control:

portidstr = Inet1.OpenURL("http://127.0.0.1:16239/req?EnumPorts")

Here is the QT help page that explains the interface:

http://www.quotetracker.com/help/qtserver.shtml
 
Back
Top