Hi everybody!
I am new to coding and I really dont understand why and how "Runtime exception: ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()." is connected to my algo.
this is the code
import talib
import numpy as np
import pandas as pd
def initialize(context):
context.jpm = sid(25006)
context.xli = sid(19657)
def handle_data(context, data):
price_jpm = history(100, '1d', 'price')
price_xli = history(100, '1d', 'price')
diff_prices = price_jpm - price_xli
avg_diff_prices = np.mean(diff_prices)
if price_jpm > avg_diff_prices*1.01:
order(context.jpm, 10)
the error statement refers to the if line...
Thank you so much for your patience and help!