The Number of Shares to Buy i get when my code has run is extremely low compared to what is displayed on the algorithmic trading video. I dont understand why?
My recommended_trades.xlsx file:
And my code:
`portfolio_size = input("Enter the value of your portfolio:")
try:
val = float(portfolio_size)
print(val)
except ValueError:
print("That's not a number \nPlease try again:")
portfolio_size = input("Enter the value of your portfolio:")
val = float(portfolio_size)
position_size = val/len(final_dataframe.index)
for i in range(0, len(final_dataframe.index)):
final_dataframe.loc[i,'Number of Shares to Buy'] = math.floor(position_size/final_dataframe.loc[i,"Stock Price"])
final_dataframe`
My output:
The Algorithmic Trading in Python video by nickmcullum:
The Number of Shares to Buy i get when my code has run is extremely low compared to what is displayed on the algorithmic trading video. I dont understand why?
My recommended_trades.xlsx file:
And my code: `portfolio_size = input("Enter the value of your portfolio:") try: val = float(portfolio_size)
print(val)
except ValueError: print("That's not a number \nPlease try again:") portfolio_size = input("Enter the value of your portfolio:") val = float(portfolio_size)
for i in range(0, len(final_dataframe.index)): final_dataframe.loc[i,'Number of Shares to Buy'] = math.floor(position_size/final_dataframe.loc[i,"Stock Price"]) final_dataframe`
My output:
The Algorithmic Trading in Python video by nickmcullum: