[ts-general] Historical data questions

David tshim at allone.org
Fri Oct 12 11:53:06 EDT 2012


Thanks Paul for reply, see below:

At 11:37 AM 10/12/2012, you wrote:
>On Fri, Oct 12, 2012 at 10:40:07AM -0400, David wrote:
> > Good day-
> >
> > In the cmds section for the shim we have the past command as one of
> > the reverse implications to SyncReq:
> >            | 'past' ConExpr History Semi          # 20, history data
> >
> > where History is:
> > History :- BarSize HtagUid BarSpan EndTime AllK
> >
> > where AllK is:
> > # AllK     <- bool finite domain w/members 'new' and 'all' (expired, also)
> >
> > samples:
> > req past STK:SMART:AAPL:USD d1 ht:1 2d now new;
> > req past STK:SMART:AAPL:USD d1 ht:1 2d now all;
> >
> > questions:
> > 1) What is AllK's affect in the 'past' request and in other requests?
>
>I know you need 'all' when getting historical data for expired contracts (like
>futures), e.g.:
>
>select past FUT:ECBOT:YM:USD:20101217 h1 ht:1 1d ymd_t(20101111 16:00:00) all;
>
>Using 'new' instead of 'all' won't work. For the current contract (not
>yet expired) we can use:
>
>select past FUT:ECBOT:YM:USD:20121221 h1 ht:1 1d now new;

That makes so much sense for options, and clarifies the: all' 
(expired, also) line


>
> > 2) When I look at the TWS API reference pdf manual, pages 249->251
> > describe the parameters to reqHistoricalData(). On page 251 there is
> > an option "useRTH" for signaling to TWS to return all day or just
> > regular session data. Does anyone know what code I would need to
> > change to be able to toggle "useRTH"? Or am I just missing a command
> > option when I make the past request in the Shim?
>
>I think "ht:1" in the above refers to the sql HistoryTag table
>which, amongst other things, includes the RTH parameter:
>
>mysql -u code
>mysql> use testing;
>mysql> select * from HistoryTag;
>+-----+----------+--------+---------------------------+
>| uid | rth_only | format | what                      |
>+-----+----------+--------+---------------------------+
>|   1 |        0 | ymdt   | TRADES                    |
>|   2 |        0 | ymdt   | MIDPOINT                  |
>|   3 |        0 | ymdt   | BID                       |
>|   4 |        0 | ymdt   | ASK                       |
>|   5 |        0 | ymdt   | BID_ASK                   |
>|   6 |        0 | ymdt   | HISTORICAL_VOLATILITY     |
>|   7 |        0 | ymdt   | OPTION_IMPLIED_VOLATILITY |
>|   8 |        0 | ymdt   | OPTION_VOLUME             |
>|   9 |        0 | epoch  | TRADES                    |
>|  10 |        0 | epoch  | MIDPOINT                  |
>|  11 |        0 | epoch  | BID                       |
>|  12 |        0 | epoch  | ASK                       |
>|  13 |        0 | epoch  | BID_ASK                   |
>|  14 |        0 | epoch  | HISTORICAL_VOLATILITY     |
>|  15 |        0 | epoch  | OPTION_IMPLIED_VOLATILITY |
>|  16 |        0 | epoch  | OPTION_VOLUME             |
>|  17 |        1 | ymdt   | TRADES                    |
>|  18 |        1 | ymdt   | MIDPOINT                  |
>|  19 |        1 | ymdt   | BID                       |
>|  20 |        1 | ymdt   | ASK                       |
>|  21 |        1 | ymdt   | BID_ASK                   |
>|  22 |        1 | ymdt   | HISTORICAL_VOLATILITY     |
>|  23 |        1 | ymdt   | OPTION_IMPLIED_VOLATILITY |
>|  24 |        1 | ymdt   | OPTION_VOLUME             |
>|  25 |        1 | epoch  | TRADES                    |
>|  26 |        1 | epoch  | MIDPOINT                  |
>|  27 |        1 | epoch  | BID                       |
>|  28 |        1 | epoch  | ASK                       |
>|  29 |        1 | epoch  | BID_ASK                   |
>|  30 |        1 | epoch  | HISTORICAL_VOLATILITY     |
>|  31 |        1 | epoch  | OPTION_IMPLIED_VOLATILITY |
>|  32 |        1 | epoch  | OPTION_VOLUME             |
>+-----+----------+--------+---------------------------+

Well take a look at that table :)


>e.g:
>    select past FUT:ECBOT:YM:USD:20121221 h1 ht:1  1d now all;
>versus
>    select past FUT:ECBOT:YM:USD:20121221 h1 ht:17 1d now all;
>The latter returning less data (RTH only)

OHH BINGO!!!! Thanks!!!

>Regards,
>
>Paul
>_______________________________________________
>ts-general mailing list
>ts-general at lists.trading-shim.org
>http://www.trading-shim.org/mailman/listinfo/ts-general

Have a GREAT day!



More information about the ts-general mailing list