
Untitled
By: a guest on
Jun 20th, 2012 | syntax:
Groovy | size: 0.81 KB | hits: 26 | expires: Never
String region='US'
String duration = "30 minutes"
int precedingRowsToKeep = 0;
if (args.length >= 1) {
region = args[0]
}
def timeZone = com.twosigma.marketcache.RegionFactory.getInstance(region).timeZone
if (args.length >= 2) {
duration = args[1]
}
if (args.length >= 3) {
precedingRowsToKeep = Integer.parseInt(args[2])
}
t = uri("tsdata:/clock/ts/trading-interval/"+region+"/30")
t = addPastWindows (table: t, windows: [ "prev" : Window.tradingTime(duration, region, precedingRowsToKeep) ])
t = addFutureWindows(table: t, windows: [ "next" : Window.tradingTime(duration, region, precedingRowsToKeep) ])
t = addColumns(t, {row -> ["prevstamp" : row.prev[ 0].getFinDateTime().toString(timeZone)] })
t = addColumns(t, {row -> ["nextstamp" : row.next[-1].getFinDateTime().toString(timeZone)] })