Writing a GUI in C# part 2

Discussion in 'Automated Trading' started by Fredrik99, May 2, 2006.

  1. Thank´s for all the useful answers I got!. I am now able to connect to TWS, via a control supplied by IB. Visual Studio lets me
    see a whole list of methods.

    As a my next step I attempt to call the mehod 'reqMktData()
    Unfortunately I don't know what values to put in the parameter list. Are there any descriptions, other than general things such as int, string etc.

    I found two overloaded methods

    reqMktData(int id, string symbol, string secType, string expiry, double strike, string right, string multiplier,
    string exchange, string primaryExchange, string curency);

    reqMktData2(int id, string localSymbol, string secType, string exchange, string primaryExchange, string curency);

    id, - what does it refer to? just sending an int with the value zero
    won´t work.
    symbol - here I put DAX (which works in the IB trader work station)
    secType - I have no idea what this refers to
    strike, right, multiplier, - I have no idea what this refer to either
    exchange - here I put DTB (which works in the IB trader work station)
    Primary Exchange - I have no idea what this refer to either
    Local account - I have no idea what this refer to either
  2. 4XIS4U


    If you download the TWS API you will se a sample in VB.NET... if you prefer a C# sample look here:
  3. I already use that vb sample as a model for the app I am trying to create in C#. Although I can study the methods, I cannot
    use them properly.

    Even running the VB-app produces errors, since I don´t know what to enter in the boxes.This is one of the error messages I get: 'No security definition has been found for the request: Invalid destination exchange specified.'

    Is there an explanation of these properties somewhere?


  4. For DAX:

    secType = "FUT" // "STK" for a stock
    strike = empty string // Applies to options only
    right = empty string // Applies to options only
    multiplier = empty string // not needed
    primaryExchange = "DTB"
    currency = "EUR"
    expiry = "200606"

    id is a unique integer that you must assign to uniquely identify the instrument for which you are requesting market data. Any *unique* value except perhaps zero will do. When you get a tickPrice event, you use this integer value to identify the instrument that the tick applies to. Your code must handle this mapping.

    I use Java, it will be the same in C#.

    There is a reasonable level of API doc in the online TWS users guide. In general, methods and properties are all documented, though some of it is a little bit terse.
  5. Thank's a lot DCraig! I´ll try these values.

  6. When I put these values into the VB-app,things started to
    work.Now I'll move on to the C# code. Thank´s a lot.

    Id: 1
    Symbol: DAX
    Type: FUT
    Exchange: DTB
    Exchange: DTB
    currency = "EUR"
  7. GTG


    Here is a simple C# Windows Forms app that demonstrates connecting to the TWS API, and retrieving market data. This might help you out. It should connect to TWS and request market data for "SPY", and then print out price and size tick events into your Debug console window. I just converted this from another simple program I use. It seems to compile, but I cannot test it during market hours. If you try to use it and it doesn't work, let me know and I will fix it after market hours.
  8. neophyte321

    neophyte321 Guest

    Does IB provide a web service for real-time stock and option quotes?

    I built a gui in java using yahoo data and INET for real-time quotes. Run sql, display results in tables ... INET only provide prices on the orders they fill, so often times that are large gaps...
  9. GTG


    Not that I know of. Does INET provide a webservice for real-time quotes?
  10. neophyte321

    neophyte321 Guest

    Indeed they do ... its fricking awesome!!!

    the MAJOR draw-back is it only provides prices on orders they fill...
    So, at times you don't know what have the stocks are trading at...

    I have fifteen threads running, grabbing 100 at a time (max per request). Store in a DB .. query em against historical stats ...

    You need to apply for a token ... Its Free!

    url: http://xml.island.com/ws/xml/quote.xml?token= [put your token here] &symbol=IBM+MSFT


    You can thank me later ;)
    #10     May 2, 2006