Open cmperal opened 3 years ago
@cmperal I'm having the same issue. Have you been able to solve it?
this probably is because your daily net positions are all zero, so during the function call the positions extract failed because there's no daily end positions.
I have the same issue. How to address it?
Ok, the root cause is that no trade is triggered in handle_data function. Try to low the trigger condition from RSI 90/10 to 80/20 to avoid the issue.
def handle_data(context, data):
price_hist = data.history(context.stock, ["open", "high", "low","close"], context.rolling_window, "1d")
stock=sdf.retype(price_hist)
rsi = stock.get('rsi_12')
if rsi[-1] > 90:
order_target_percent(context.stock, 0.0)
elif rsi[-1] < 10:
order_target_percent(context.stock, 1.0)
Problem Description
Dear,
I'm trying to parse my generated backtest object into 'returns', 'positions' and 'transactions' by using function 'pf.utils.extract_rets_pos_txn_from_zipline' however, when I call such function I get this error "Exception has occurred: AttributeError 'DataFrame' object has no attribute 'amount'". I have the pyfolio logic within the function "analyze" and it is called from the function "run_algorithm" (I follow the quantopian pipeline)
This is the location where I get the error:
This is how I call the above function:
Thank you.
Versions