IB API - Visual Basic

Quote from timmyz:

okay great. i got it to work, but i have a question about reqmktdata.

GATrader: In your example, reqmktdata has 10 arguments. However, in the IB User Guide, it says that there are only 9. Below is what it says in the IB user's guide.

void reqMktData(long id, String symbol, String secType, String expiry, double strike, String right, String multiplier String exchange, String currency)

It looks like 10 is correct because if I use the 9 like the User's guide says, I get an error that says "argument not optional." If the User's guide is incorrect, then how did you know what the 10th one is?


Welcome to the world of programming .....

API specifications / user guides often have error or usage conditions that are either completely missing from the documentation or just plain wrong.

Why is this ? Well ... it probably started off being a budget thing - no money for testing and proofreading. Nowadays its a cultural thing - people simply expect errors and expect that working out these errors is part of their "expertise" and represents a hidden advantage they have over others ....

Now if these products were being used in situations where peoples lives would be lost due to the error you can bet that these errors / omissions would never occur .....Or if people simply boycotted the products due to the omission/errors then the companies would be out of business .... but programmers/users dont do this ....and often for the reasons I mentioned ....
 
I think it is 10, the exchange is passed twice, one for SMARt the other for defalt exchange. I use both SMART.How did I know? By looking at the example which works.

Like earlier poster said, u need to check real working code agaisnt documentation . Just a lot of head banging, help from other users .
 
Quote from timmyz:

sam123, whoa that looks easy! thanks.

while i have your attention, do you mind explaining in plain english what "property get" and "enumerations" do for you? why not just use simple variables and constants?
You certainly can use variables and constants, but enumerations offer the programmer a nice way to organize related constants into an enumeration type. For example:

Code:
Public Enum PriceTypes
    Bid
    Ask
    Trade
End Enum
Then, in a subroutine, you can do this:

Code:
Private Sub ProcessMyPriceValues(SymbolName as String, Price as Double, PriceType as PriceTypes)

.
.
.

End Sub

“Property Get” is just a function that returns a value. It has more meaning in VB.NET, but in VB6 you can do the same thing using standard functions.

Quote from timmyz:

i have tried googling but the explanations seem to always be kind of theoretical and wordy, so i don't understand when you would need to use them. the sample code from ib uses them.

When you are on your own writing a short program, you will find there are a lot of things that can be done differently, and you would naturally accomplish your goals by writing code in the way you know how to write it. Using Enumerations is considered to be "good programming practice," yet you can certainly accomplish your goals without using them. However, as your applications get to be large and complex, and if you are collaborating with other programmers on a large project, you'll understand why IB writes the code the way it does.

Quote from timmyz:

lastly, i'm sure you can tell by now that i've taught myself some vb6, but still have lots to learn. as far as i can tell, there is still a huge community of vb6 developers out there and they bitch about vb.net. are there any clear advantages of using vb.net or anything you can't do with vb6 that you can do with vb.net? i'm not talking about saving .0000000000000002 milliseconds or something trivial like that. :D

You really need to stop what you are doing and get a copy of Visual Studio.NET. I can't emphasize this more, especially now while you are in the early stages of learning VB6. Rather than getting into all the advantages and few disadvantages, you need to realize that the Industry is moving to VB.NET, so you need to do the same, especially when you will be dependent on components provided by someone else, like IB.

The reason why vb6 developers hate vb.net is because they put in blood sweat and tears developing their pet vb6 projects. Then, VB.NET comes along as the logical upgrade to VB6, and they discover they have to almost completely re-develop their projects, which is no easy task. It’s bad enough being threatened by the fact that the industry has been moving to vb.net, let alone being forced to unlearn old vb6 coding habits.

There are two products out there: Visual Basic.NET Standard, and Visual Studio.NET. Visual Studio is ideal, but expensive, unless you can get the student rate. Visual Studio allows you to create a project with components written in Visual Basic, C++, and Java, and you can create DLL’s.
 
whenever it connects, TWS shows a pop up box that says "allow incoming connection?" and then i have to click yes. is there any way to have them connect without having to deal with this step?

here's the code for my connect button:

Private Sub cmdConnect_Click()
Dim host As String
Dim port As Long
Dim clientId As Long

port = 7496
clientId = 0
Call Tws1.Connect(host, port, clientId)
End Sub
 
Back
Top