Back to Community
Pipeline, rebalancing and the code structure

Hi everyone,
As I am very new to this site, I would appreciate you sharing your approach when dealing with pipeline, rebalancing, and the code structure. Thanks in advance for any feedback to the following questions:

  • Pipeline - when you construct the pipeline, do you ever use technical indicators to refine the tradable universe. For example if you are building the strategy that operates at a simple DDS or MVA crossovers, do you filter our stocks based on the cross over in the pipeline constructor or use handle_data function?

  • Is there any detailed data about how the rebalancing works? From what I understand we pass paramemters and try to maximize alpha, but it seems like a black box if the orders have stop loss or not, for how manu days they are help etc. Can we influence any of this or it is meant to be the black box possibly for a reason to focus to the true alpha during the research instead of the fine tuned risk management?

  • are there any prebuild functions for a cross over of different indicators at the folrum?

Thanks everyone and happy coding!

3 responses
  1. If you specify factors (such as technical indicators) within Pipeline, then it will output a Pandas DataFrame of those factors. You could apply a mask to these factors and pass it into the screen parameter.
  2. Rebalancing works on a schedule. At the top of your algorithm you should have something like:
algo.schedule_function(  
        rebalance,  
        algo.date_rules.week_start(), # Schedules frequency of rebalance  
        algo.time_rules.market_open(), # Hours offset  
    )  

In this example, rebalance() is called weekly at the beginning of each week.
3. Yes, check the API Documentation under Help.

Take a look here. It might seem overwhelming at first, but this might help.

https://www.quantopian.com/posts/efficient-n-days-ago-factor-research-and-algo-templates

thanks a lot!