From f9d3dbff47c7af8a5bf002235f8163b42ef3f074 Mon Sep 17 00:00:00 2001 From: warren-oneill Date: Wed, 3 Jun 2015 15:10:54 +0200 Subject: [PATCH] allow passing of data type from data source --- zipline/sources/data_source.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zipline/sources/data_source.py b/zipline/sources/data_source.py index 1b04734e..de91793a 100644 --- a/zipline/sources/data_source.py +++ b/zipline/sources/data_source.py @@ -45,11 +45,12 @@ class DataSource(with_metaclass(ABCMeta)): """ Override this to hand craft conversion of row. """ - row = {target: mapping_func(raw_row[source_key]) - for target, (mapping_func, source_key) - in self.mapping.items()} - row.update({'source_id': self.get_hash()}) + row = {} row.update({'type': self.event_type}) + row.update({target: mapping_func(raw_row[source_key]) + for target, (mapping_func, source_key) + in self.mapping.items()}) + row.update({'source_id': self.get_hash()}) return row @property