diff --git a/duka/app/app.py b/duka/app/app.py index ea21f5c..404c670 100644 --- a/duka/app/app.py +++ b/duka/app/app.py @@ -67,7 +67,7 @@ def name(symbol, timeframe, start, end): return name + ext -def app(symbols, start, end, threads, timeframe, folder): +def app(symbols, start, end, threads, timeframe, folder, header): if start > end: return lock = threading.Lock() @@ -98,7 +98,7 @@ def do_work(symbol, day, csv): with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor: - files = {symbol: CSVDumper(symbol, timeframe, start, end, folder) for symbol in symbols} + files = {symbol: CSVDumper(symbol, timeframe, start, end, folder, header) for symbol in symbols} for symbol in symbols: for day in days(start, end): diff --git a/duka/core/csv_dumper.py b/duka/core/csv_dumper.py index d7f5391..08294ae 100644 --- a/duka/core/csv_dumper.py +++ b/duka/core/csv_dumper.py @@ -39,13 +39,13 @@ def write_candle(writer, candle): class CSVDumper: - def __init__(self, symbol, timeframe, start, end, folder): + def __init__(self, symbol, timeframe, start, end, folder, header=False): self.symbol = symbol self.timeframe = timeframe self.start = start self.end = end self.folder = folder - self.include_header = True + self.include_header = header self.buffer = {} def get_header(self): diff --git a/duka/main.py b/duka/main.py index 38c7b33..3a18585 100644 --- a/duka/main.py +++ b/duka/main.py @@ -25,6 +25,7 @@ def main(): parser.add_argument('-c', '--candle', type=valid_timeframe, help='use candles instead of ticks. Accepted values 1M 5M 10M 15M 30M 1H 4H', default=TimeFrame.TICK) + parser.add_argument('--header', action='store_true', help='include CSV header (default false)', default=False) args = parser.parse_args() if args.startdate is not None: @@ -38,7 +39,7 @@ def main(): end = args.day set_up_signals() - app(args.symbols, start, end, args.thread, args.candle, args.folder) + app(args.symbols, start, end, args.thread, args.candle, args.folder, args.header) if __name__ == '__main__':