Sorry for the noob question but I am very new to Python.
I have a function which takes creates a numpy array and adds to it:
def prices(open, index):
gap_amount = 100
prices_array = np.array([])
index = index.vbt.to_ns()
day = 0
target_price = 10000
first_bar_of_day = 0
for i in range(open.shape[0]):
first_bar_of_day = 0
day_changed = vbt.utils.datetime_nb.day_changed_nb(index[i - 1], index[i])
# if we have a new day
if (day_changed):
first_bar_of_day = i
fist_open_price_of_day = open[first_bar_of_day]
target_price = increaseByPercentage(fist_open_price_of_day, gap_amount)
prices_array.append(target_price)
return prices_array
And when I append prices_array.append(target_price)
I get the following error:
AttributeError: 'numpy.ndarray' object has no attribute 'append'
What am I doing wrong here?