My previous post got error so I'm writing again. If you know both platforms Quantopian and QC already please let me know your experience with doing research and creating strategies. I believe your feedback can  also help to improve QC platform. 

I just started to learn Q and QC platform in the same time. I made my first simple monthly rebalance algo in Q. It was pretty easy to create the strategy in Q/Zipline. It took me 1h to learn the platform and 1h to create algo. After I moved to QC platform, were after few days of learning, I'm still failing to build the same alog. In the end I decided to use Q/Zipline/ platform as I found QC/Lean/Python very difficult to use, however I'm still interested to know if it is possible to build the same strategy in QC and how long it can takes. 

As the algo can be build in Q in 5-10 min once learn basics. I assume it should take no more than 10min in QC. If it takes too long please at least give me at least an estimate how long it can takes to build the similar algo in QC.

Indicators used:

    blend = m3 return% * 0.7 + m6 return% * 0.3

    sma_88 is simple moving average over 88 days


   The strategy rebalance portfolio on the first day in every month at market open based on next rules:

   1) Buy top 3 stocks, not included in portfolio, sorted by blend where close > sma_88(position size should be recalculated each time to be 100% invested in the step 1.

   2) For stocks in portfolio where close < sma_88 transfer stocks to cash. (In the step 2 there is no position size recalculation so cash will stay in portfolio for one month and will be invested next month)

Below is the strategy in Q/Zipline:

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
import quantopian.pipeline.filters as Filters
import quantopian.pipeline.factors as Factors
import pandas as pd
from import USEquityPricing
from quantopian.pipeline.factors import Returns, SimpleMovingAverage

def initialize(context):
attach_pipeline(pipe_definition(context), name='my_data')
schedule_function(rebalance, date_rules.month_start(), time_rules.market_open())

def pipe_definition(context):
context.stocks = symbols('DBA', 'DBC', 'DIA', 'EEM', 'EFA', 'EPP', 'EWA', 'EWJ', 'EWZ', 'FXF', 'FXI', 'GLD', 'IEV', 'ILF', 'IWM', 'IYR', 'MDY', 'QQQ', 'SPY', 'TLT', 'XLE', 'XLF')
universe = Filters.StaticAssets(context.stocks)
close_price = USEquityPricing.close.latest

m3 = Returns(inputs=[USEquityPricing.close], window_length=67)*100
m6 = Returns(inputs=[USEquityPricing.close], window_length=137)*100
blend = m3*0.7+m6*0.3
sma_88 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=89, mask=universe)

return Pipeline(
columns = {
'close_price' : close_price,
'blend': blend,
'sma_88': sma_88,
screen = universe,

def before_trading_start(context, data):
context.output = pipeline_output('my_data')

def rebalance(context, data):
buy_these = context.output.query('close_price > sma_88').sort_values(by='blend',ascending=False).iloc[:3].index.tolist()

new_order = []
for stock in buy_these:
if stock not in context.portfolio.positions and data.can_trade(stock):

WEIGHT = 1.00/ ( len(context.portfolio.positions) + len(new_order))

for stock in context.portfolio.positions:
order_target_percent(stock, WEIGHT)

for stock in new_order:
if stock not in context.portfolio.positions and data.can_trade(stock):
order_target_percent(stock, WEIGHT)

sell_these = context.output.query('close_price < sma_88').index.tolist()
for stock in sell_these:
if stock in context.portfolio.positions and data.can_trade(stock):
order_target_percent(stock, 0)