IB API - Visual Basic

Discussion in 'Automated Trading' started by timmyz, Aug 12, 2005.


  1. 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 ....
     
    #11     Aug 13, 2005
  2. #12     Aug 13, 2005
  3. 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 .
     
    #13     Aug 13, 2005
  4. Sam123

    Sam123 Guest

    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.

    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.

    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.
     
    #14     Aug 13, 2005
  5. timmyz

    timmyz

    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
     
    #15     Aug 13, 2005