Matlab Trader Group

Discussion in 'Automated Trading' started by Trader922, Feb 25, 2009.

  1. ej420

    ej420

    In order to create OHLC bars in realtime, you need to use reqMktData to subscribe to each contract's data, so that won't be iterative, but you will receive "tick" events and can build up bars from those. I also use reqRealtimeBars() to get 5-second bars and aggregate those into the desired duration bars. I believe those are supposed to be more accurate, especially w.r.t. volume, since IB doesn't deliver all ticks. 5- second bars are not vailable on some contracts such as indeces such as VIX/TRIN/TICK, etc. however.
     
    #21     Feb 27, 2009
  2. ej420

    ej420

    Regarding time synchronization, I believe your bars should be able to tolerate some slight discrepancies, so you can just subscribe to both time and data events and just use the last received time whenever there is a data event.
     
    #22     Feb 28, 2009
  3. The 5-second bar method is a newer method in the API, as far as I'm aware...

    The question is, do the update times of each bar remain synchronized with exchange / server time? i.e. for NYSE sessions, does the first bar start a 09:30:00 and the last bar end at 16:14:59?

    If you have any example code to share, it'd be great!

    rt
     
    #23     Feb 28, 2009
  4. I also forgot to ask, is there a built-in API method to receive these tick events?

    rt
     
    #24     Feb 28, 2009
  5. 377OHMS

    377OHMS

    You could use the CPU high accuracy counter and trigger initially off the IB server time. There is a mex file on the ML FEX called hat.mexW32 that hits the high accuracy counter with extreme accuracy (nanoseconds) for inter-sample deltas. You could periodically check the IB server time and rehack to absolute time.

    Oh, lets see. I'm Scott. I used to write ML for Ken Griffin lol.

    I trade mean reversion bots on a ML cluster but have been in t-bills since september. I'm kind of rooting around the literature during my sabattical and plan on reentering this summer. I would like to participate.

    I'm astonished by this thread because for years I thought I was the only one who could connect ML to TWS directly (java) other than those austrian guys over at Gloriosia. Then one day a guy starts a thread on ET and there are lots of you! Very cool.

    If a few of us got together I'll bet some very nice shared architectures and infrastructures would emerge. Great thread.
     
    #25     Feb 28, 2009
  6. 377OHMS

    377OHMS

    Example of accurate time-tags using HAT:

    tags = 0
    itime = hat;
    time = hat;
    for j = 1:9
    while (itime + (0.1*j)) > time
    time = hat;
    end
    tags = time-itime
    end

    which gives some really nice time-tags:

    tags =
    0
    tags =
    0.100003771425691
    tags =
    0.200007263490988
    tags =
    0.300007403173367
    tags =
    0.400006425399624
    tags =
    0.500002653971023
    tags =
    0.600001955557673
    tags =
    0.700006565079093
    tags =
    0.800000558730972
    tags =
    0.900003492060932

    I tend to use this is to free-run between server time updates so I basically trigger from the IB time server update and then generate these inter-sample tics.

    Scott
     
    #26     Feb 28, 2009
  7. I consider myself a pretty technical guy, but this is way over my head....

    But thanks for the input!

    rt
     
    #27     Feb 28, 2009
  8. ok, it looks like the void tickPrice() method is used to obtain prices. IB's API documentation is really confusing though...
    It says: "This function is called when the market data changes. Prices are updated immediately with no delay." What I don't understand is, is this method called once and an object is constantly updated when price changes? Or does the method need to be iteratively called at even time intervals?

    rt
     
    #28     Feb 28, 2009
  9. hello all....

    I am back from vacation and have gotten started on the site that will be used to facilitate the Matlab Traders Group.

    The site is currently being built. It shouldn't take too long to get an initial version up & running (a few days or so). The site will be changing a lot during the development process.

    The site is going to be located at:
    www.matlab-algo-trading.com

    I will update everyone when the site is more functional and is able to be used. Until then, please don't use the site as any information entered may get wiped out during the development process.

    Please send any questions or ideas ro me in this thread or via PM.

    Regards,
    Eric
     
    #29     Mar 8, 2009
  10. I have tinkered with Matlab and would like to see some more relevant exercises then what I have found so far. Great idea.
     
    #30     Mar 8, 2009