 var barsize = "5 mins"
 var unixts = 1
 var duration = "10800 S" // 3 hours
+var sleepInterval = 10.0
 var outputDir: String = NSFileManager.defaultManager().currentDirectoryPath
 
 let now = NSDate(timeIntervalSinceNow: 0)

            }
            file.synchronizeFile()
        }
        println("(sleep for 10 secs)...")
        NSThread.sleepForTimeInterval(NSTimeInterval(10.0))
    }
    if lf != nil {
        lf?.closeFile()

    var lf = NSFileHandle(forWritingAtPath: fname)
    currentTicker = tickers[i]
    while currentStart > sinceTS {
        let begin = NSDate().timeIntervalSinceReferenceDate
        reqComplete = false
        let localStart = currentStart
        currentStart = -1
