Hi, I'm one of the Quantopian users who switched to QuantConnect after it closed.
Quantopian has been a part of my life for the last 6 years, where I created over 3,000 algorithms.
So far I have successfully migrated about 3 dozens of my latest algorithms to QuantConnect.
A week ago, I asked QuantConnect Support to help me with a simple "Returns Rank head" strategy.
I'm still waiting for an answer.
So I decided to open this thread where former Quantopian users can get an answers on the peculiarities
of QuantConnect dialect of the Python.
Can somebody help me to port this 19 lines algorithm to QuantConnect API?
# talib Aroon portfolio
import talib
# --------------------------------------------------------
assets, bond = symbols('SPY', 'QQQ', 'TLT'), symbol('IEF')
period, lev = 21, 1.0
# --------------------------------------------------------
def initialize(context):
schedule_function(trade, date_rules.every_day(), time_rules.market_open(minutes = 65))
def trade(context, data):
wt_a = 0; wt = lev/len(assets);
for asset in assets:
H = data.history(asset, 'high', period + 1, '1d')
L = data.history(asset, 'low', period + 1, '1d')
AroonDown, AroonUp = talib.AROON(H, L, period)
if AroonUp[-1] > AroonDown[-1]:
order_target_percent(asset, wt)
wt_a += wt
else:
order_target_percent(asset, 0)
wt_b = lev - wt_a
order_target_percent(bond, wt_b)
record(lev = context.account.leverage)
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!