Hi community,
I am trying to calculate the highest and lowest price of stocks in my portfolio for the period it has been held. Below is my code, but there is always an error message that says :"ValueError: Shape of passed values is (1, 1), indices imply (1, 0)" on the last two lines below:
context.date_bought[long_stock] = get_datetime()
Holding_Period = (get_datetime() - context.date_bought[Current_Positions]).days
High_Price = data.history([Current_Positions],"high",bar_count = Holding_Period,frequency = "1d")
Low_Price = data.history([Current_Positions],"low",bar_count = Holding_Period,frequency = "1d")
I logged the "Holding_Period" and it is indeed a number, can I be missing something here? It will be much appreciated if someone can shed a light on what might be going wrong in this code.
Thanks in advance.
Mengche (Remy) Chen