Skip to content

Commit

Permalink
Add header
Browse files Browse the repository at this point in the history
  • Loading branch information
giuse88 committed Jun 4, 2016
1 parent 79630fd commit 1ffa859
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions duka/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions duka/core/csv_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion duka/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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__':
Expand Down

0 comments on commit 1ffa859

Please sign in to comment.