Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
zipline API: order explained

Hey!
Thanks for the great library. I am new to quantopian and zipline. I am trying to understand with simple examples.

So assuming I have the following dummy example:

from zipline.api import order, symbol

price = 123  
number_of_stocks = 3  
stock = symbol('astockexample')  
sell_price_down = 120  
sell_price_up = 127  
order(stock, number_of_stocks, stop_price=sell_price_down, limit_price=sell_price_up)  

Does the above example mean:

  • I am buying 3 units of stock 'astockexample' right now
  • If the price goes below 120 then sell these units (stop_price)
  • if the price goes above 127 then sell these units (limit_price)

If thats not the case then how can I create the above critiria in an order? Do I need manually to do its time step?

thanks in advance.