How can I pass a command line argument to a Zipline algo?

71 views
Skip to first unread message

Mike Ellertson

unread,
Jun 10, 2017, 10:05:52 PM6/10/17
to Zipline Python Opensource Backtester
Does anyone know of an easy way to pass a command line argument (or equivalent) to a Zipline algorithm? I have a genetic algorithm, which spawns many different process, and each one needs to use Zipline for its "fitness" function, to see how well it performed.

I've tried passing an argument on the command line, before and after the "run" command. But, both seem to make Zipline halt. Any ideas?

Mike Ellertson

Ed Bartosh

unread,
Jun 11, 2017, 8:22:06 AM6/11/17
to Mike Ellertson, Zipline Python Opensource Backtester
Hi Mike,

Something like this should work:

import sys
from zipline.__main__ import main

sys.argv.append('--help')

main()

Regards,
Ed

--
You received this message because you are subscribed to the Google Groups "Zipline Python Opensource Backtester" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
BR,
Ed

Mike Ellertson

unread,
Jun 12, 2017, 11:30:31 PM6/12/17
to Ed Bartosh, Zipline Python Opensource Backtester
Thanks Ed! I'm such a knuckle-head, I can't believe I didn't think of that.  +1 for the simple solution!

In the mean time I found a reference in the Zipline docs saying we can also use the Zipline.run_algorithm() function. I was able to get that to work and coded up an example on Github.  

Best regards,

Mike Ellertson
--

Best regards,

Mike Ellertson
Email: mdell...@gmail.com
Reply all
Reply to author
Forward
0 new messages