def zipline_magic(line, cell=None):
 load_extensions(default=True, extensions=[], strict=True, environ=os.environ)
 try:
  return run.main(((['--algotext', cell, '--output', os.devnull] + (['--algotext', '', '--local-namespace'] if (cell is None) else [])) + line.split()), ('%s%%zipline' % ((cell or '') and '%')), standalone_mode=False)
 except SystemExit as e:
  if e.code:
   raise ValueError(('main returned non-zero status code: %d' % e.code))

def zipline_magic ( line , cell = None ) : load_extensions ( default = True , extensions = [ ] , strict = True , environ = os . environ ) try : return run . main ( ( ( [ '--algotext' , cell , '--output' , os . devnull ] + ( [ '--algotext' , '' , '--local-namespace' ] if ( cell is None ) else [ ] ) ) + line . split ( ) ) , ( '%s%%zipline' % ( ( cell or '' ) and '%' ) ) , standalone_mode = False ) except SystemExit as e : if e . code : raise ValueError ( ( 'main returned non-zero status code: %d' % e . code ) )
the zipline ipython cell magic .