IB API HOWTOs and Guidelines - For Beginners

Discussion in 'App Development' started by Butterfly, Nov 8, 2013.

  1. fact is you talk about IB here in this thread and have NO SINGLE IDEA how IB and TWS and its Gateway work, you made that apparently clear. Other users, such as vicirek pointed you in the right direction but you are ignorant. Then you made a tool out of yourself and your stupid OOP comments. Good luck with your Python IB execution module, written by someone who has no clue about how the IB interface works, has no clue about OOP languages, and suddenly claims to know the inside scoop of BNP and SocGen. You are just a fart, on ignore.

     
    #101     Sep 7, 2014
  2. Butterfly

    Butterfly

    what an angry little turd you make,

    where is your thread explaining how IB works ? oh wait, you didn't make one. And how user vicirek pointed me in the right direction ? wtf are you talking about ? I made pretty clear from the start that the purpose of this thread was to build a simple and functional Python module to use IB APIs. Somehow, you got offended when I pointed out that OOP wasn't necessary for building batch trading applications.

    You sound like an angry loser, sorry to say. Why don't you go play somewhere with C# on some Microsoft forums for miserable programmers like yourself. Put me on ignore if you are so offended by those truth, since you seem to be simply another coward.

    gee, who needs another angry developer :LOL:
     
    #102     Sep 7, 2014
  3. Butterfly, this is awesome. Thanks, unfortunately I had to move on to programming my app in Java. But I'm sure others will find this useful. Is the ft variable now just a string of the OrderStatus() message? I could just use string processing to get the filled=0 value (0) into a "filled" variable?
     
    #103     Sep 8, 2014
  4. Butterfly

    Butterfly

    don't pay attention to "ft", it's a file descriptor to handle an open file to write "logs" and "trades" in my code.

    the function can also be written like this:

    Code:
    # Define a function to catch "OrderStatus" and "OrderState" type messages from IB Server
    def status_orders(msg):
    print "Status: ", msg.typeName, msg.orderId, msg.status, msg.whyHeld, msg.avgFillPrice, msg.filled, msg.remaining
    
    the "msg" variable is an object and msg.filled is the attribute that contains the number of shares filled, so there is no string transformation or anything else to do. It's already assigned and it's numeric. Therefore you could use it like any other numeric variables. See below:

    Code:
    if msg.filled == 0:
        print "Trades not filled, still in progress"
    else:
       print "Trades Done, Average Fill Price = %s, Shares Remaining =  %s" % (msg.avgFillPrice, msg.remaining)
    
    Voila !!!
     
    #104     Sep 9, 2014
    GunsnMoney likes this.
  5. Butterfly, I ran across a short IBPy tutorial by sentdex on YouTube. Also, many videos he has uploaded on just about anything Python:
    https://www.youtube.com/user/sentdex/videos
     
    #105     Sep 10, 2014
  6. Butterfly

    Butterfly

    cool, thanks
     
    #106     Sep 12, 2014
  7. Zano

    Zano

    Hello,

    I'm trying to write simple gui for IB API. I have already connected to reqMktData without any problems. Now i'm trying to connect to reqMktDepth, but I don't obtain any data or errors. I'm working on demo IB API demo version. Any ideas why it happens? I call it this way.

    Code:
    reqMktDepth(requestReference, contract, 20,
                    new Vector<TagValue>());
    It's same like reqMktData.

    Thx for help!
     
    #107     Jul 16, 2015
  8. sam999

    sam999

    Can someone provide the code for bracket order (Stoploss/Profit Target)? Thank you.
     
    #108     Sep 24, 2015
  9. 2rosy

    2rosy

    you just set create a new order and set m_parentId to the initial order

    def createBracketOrder(origOrder, oID, tif, orderType,price):
    bracketoptOrder = Utils.makeOptOrder( Side.flipside(origOrder.m_action), oID, tif, orderType,price,origOrder.m_totalQuantity)
    bracketoptOrder.m_parentId = origOrder.m_orderId
    return bracketoptOrder
     
    #109     Sep 24, 2015
  10. sam999

    sam999

    #110     Sep 24, 2015