algorithmic-trading-python icon indicating copy to clipboard operation
algorithmic-trading-python copied to clipboard

Number of Shares to Buy is extremely low on my recommended_trades.xlsx

Open dekacypher opened this issue 4 years ago • 0 comments

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: Screen Shot 2022-01-26 at 18 44 03

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: Screen Shot 2022-01-26 at 19 00 32

The Algorithmic Trading in Python video by nickmcullum: Screen Shot 2022-01-26 at 18 45 09

dekacypher avatar Jan 26 '22 18:01 dekacypher