Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to run zipline in a class

I am creating a genetic algorithm using zipline as the trading platform but for the genetic algorithm I need to setup zipline in a class which I thought I did correctly but my implementation gives different data than running it the standard way in the tutorial. Returning a sortino ratio of 102.397 with a ending portfolio value of -80000

While if i run the same logic in the standard way it gives a sortino ratio -0.84 of and portfolio value of 98000.

So my question is how is the correct way to setup zipline in a python class?

Zipline with class attempt: https://pastebin.com/pKXqzUjA

Zipline without class but same logic: https://pastebin.com/CNVbw29Q