Unit testing ingestion of bundles logic

This commit is contained in:
fredfortier
2017-10-13 00:50:25 -04:00
parent e1c2f40ab9
commit c658d15fcb
3 changed files with 129 additions and 41 deletions
@@ -33,6 +33,13 @@ def initialize(context):
def _handle_data(context, data):
price = data.current(context.asset, 'close')
log.info('got price {price}'.format(price=price))
if price is None:
log.warn('no pricing data')
return
prices = data.history(
context.asset,
fields='price',
@@ -55,13 +62,6 @@ def _handle_data(context, data):
cash = context.portfolio.cash
log.info('base currency available: {cash}'.format(cash=cash))
price = data.current(context.asset, 'close')
log.info('got price {price}'.format(price=price))
if price is None:
log.warn('no pricing data')
return
record(price=price)
orders = get_open_orders(context.asset)