[ts-gen] sample code for obtaining daily Close, Open, High, Low, Volume
R P Herrold
herrold at owlriver.com
Mon Dec 17 14:46:32 EST 2007
I posted a bit into the Yahoo TWS list a EOD floowup example
to the second by second one I posted last week.
-- Russ Herrold
---------- Forwarded message ----------
Date: Mon, 17 Dec 2007 13:55:51 -0500 (EST)
From: orcwcbe at owlriver.com
Reply-To: TWSAPI at yahoogroups.com
To: TWSAPI at yahoogroups.com
Subject: twsapi] sample code for obtaining daily Close, Open, High, Low, Volume
On Mon, 17 Dec 2007, orcwcbe at owlriver.com wrote:
> I posted a one second granularity retrieval example last week
> to its mailing list:
> http://www.trading-shim.org/pipermail/ts-general/2007-December/000127.html
> 'Retrieving a day's second by second price action'
The EOD example, which retrieves a week at a time, is a one
liner with the shim:
[herrold at centos-4 shim_071217]$ ./shim --data logd
The trading shim has finished program initialization, including the
construction of successful connections to the database and IB tws.
past add 15 25 Ymd_T(20071214 16:00:00);
quit;
[herrold at centos-4 shim_071217]$
which yields in the logfile and the database:
Dec 17 13:46:29 centos-4 : 18194|49589| 276505955|1|19| 0|past add 15 25 Ymd_T;|
Dec 17 13:46:29 centos-4 : 18194|49589| 276525598|2|20| 3|3|15|25|Ymd_T|
Dec 17 13:46:30 centos-4 : 18194|49590| 277100308|3|17| 3| 15|5|
Dec 17 13:46:30 centos-4 : 18194|49590| 277100208|3| 1| 1|
20071210|61.45|62.07|60.77|61.59|120110|61.45|false|STK.SMART.AIG.
Dec 17 13:46:30 centos-4 : 18194|49590| 277100230|3| 1| 1|
20071211|61.48|62.24|58.96|59.29|199871|60.59|false|STK.SMART.AIG.
Dec 17 13:46:30 centos-4 : 18194|49590| 277100250|3| 1| 1|
20071212|60.83|61.22|56.82|58.33|213549|58.76|false|STK.SMART.AIG.
Dec 17 13:46:30 centos-4 : 18194|49590| 277100271|3| 1| 1|
20071213|57.21|58.0|55.72|57.1|175030|56.55|false|STK.SMART.AIG.
Dec 17 13:46:30 centos-4 : 18194|49590| 277100300|3| 1| 1|
20071214|56.32|57.04|55.2|55.67|183180|56.16|false|STK.SMART.AIG.
Dec 17 13:46:30 centos-4 : 18194|49590| 277109265|4|110| 0|
# |4|110|0|event: history insert|(15, 11, 20071210 -- 20071214)|
=================================
I first did a lookup of the Synbol's Contract ID:
[herrold at centos-4 dcop]$ ./luCID.sh STK AIG
15 STK.SMART.AIG
and examined the PastFilter for the week timeframe:
mysql> select * from PastFilter where unit = 'w';
+-----+-----+--------+------+----------+------+--------+
| uid | tid | period | reps | duration | unit | script |
+-----+-----+--------+------+----------+------+--------+
| 25 | 121 | NULL | 0 | 1 | w | |
It is obviously trivial to wrap this up in a loop to pull the
desired symbol numbers and end of weeks wanted.
-- Russ Herrold
More information about the ts-general
mailing list