Blueshift/Zipline application

Course Name: Momentum Trading Strategies, Section No: 8, Unit No: 1, Unit type: Document



Hi there,



Have a couple of question regarding the use of Blueshift/Zipline.



During back testing in Blueshift, what is the benchmark that the portfolio is compared to?



In the initialize() function, I noticed that context can have different attributes e.g. context.lookback, context.currency_list etc. Are these attributes defined by the writer of the strategy code or are they predefined?



Also, the API methods document does not mention anything about the pipeline() api that was used in this strategy. Particularly, when I went through the code in  Blueshift for cross sectional momentum, I do not see the purpose of using a pipeline object? Are you able to provide a little more information/guidance on how to use this api?



Many thanks,

Ryan

the benchmark used depends on the dataset, for example NYSE dataset has S&P 500 (SPY ETF) as the benchmark. See here for more.



The context has some attributes that are provided and tracked automatically by blueshift. The major ones being context.portfolio and context.account. Type this on the code editor and you will get automatic suggestions on available builtin attributes. Apart from this, context variable works as a placeholder for user defined variables that can be passed around to different functions (by passing the context as an argument). Any variable you want to create and access in different parts of your algorithm, you can save them as attribute of context, e.g. context.lookback.



The major purpose of pipeline is to handle trading universe in an automated and clean manner - applying filters and factors in a very flexible way. For a light introduction to pipeline, go through this tutorial here.