python-rsi icon indicating copy to clipboard operation
python-rsi copied to clipboard

Error graphing data: x and y must have same first dimension, but have shapes (151,) and (132,)

Open guijames opened this issue 4 years ago • 6 comments

Dir Sir,

When I run python-psi (main.py) the graph does not generate. here is the error graphing:

Error graphing data: x and y must have same first dimension, but have shapes (151,) and (132,)

Thought I would try with different stocks but the error persists.

guijames avatar Feb 01 '21 16:02 guijames

I will try and recreate this issue. What stocks are you using?

corncobb avatar Feb 02 '21 20:02 corncobb

Pulling data for API Error graphing data: x and y must have same first dimension, but have shapes (152,) and (133,) Stock Price 20 MA 200 MA RSI chart


API 74.87 48.2448 33.8375 84.86 🔥 https://finance.yahoo.com/quote/API/chart?p=API [Finished in 2.9s]

#plt.plot(x,y) #x and y must have same first dimension, but have shapes (152,) and (133,)

Also, if I tried the original stocks (as you have in stocks.txt). The script runs fine but no graph is popping out. Below is the output:

Pulling data for baba Pulling data for roku Pulling data for msft Pulling data for amzn Pulling data for tqqq Pulling data for nvda Pulling data for vgt Pulling data for twtr Pulling data for dis Pulling data for t Pulling data for snap Pulling data for tsla Stock Price 20 MA 200 MA RSI chart


BABA 254.5 248.145 252.778 51.05 https://finance.yahoo.com/quote/baba/chart?p=baba ROKU 418.75 403.988 206.683 61.95 https://finance.yahoo.com/quote/roku/chart?p=roku MSFT 239.51 223.95 206.747 67.39 https://finance.yahoo.com/quote/msft/chart?p=msft AMZN 3380 3216.86 3001.96 62.57 https://finance.yahoo.com/quote/amzn/chart?p=amzn TQQQ 101.82 94.789 64.4357 60.03 https://finance.yahoo.com/quote/tqqq/chart?p=tqqq NVDA 542.27 532.299 461.981 54.45 https://finance.yahoo.com/quote/nvda/chart?p=nvda VGT 365.86 357.187 304.48 59.94 https://finance.yahoo.com/quote/vgt/chart?p=vgt TWTR 54 49.3765 40.7024 62.74 https://finance.yahoo.com/quote/twtr/chart?p=twtr DIS 176.96 173.666 132.892 57.78 https://finance.yahoo.com/quote/dis/chart?p=dis T 28.54 29.05 29.3692 43.31 https://finance.yahoo.com/quote/t/chart?p=t SNAP 58.87 52.857 31.1143 64.11 https://finance.yahoo.com/quote/snap/chart?p=snap TSLA 872.79 836.479 408.4 62.56 https://finance.yahoo.com/quote/tsla/chart?p=tsla [Finished in 8.4s]

NOTE: I am using Python 3.7.4 and MacOS

guijames avatar Feb 02 '21 23:02 guijames

I made it so the graph only shows if RSI is less than 30 or greater than 70 on lines 74 - 77. If you remove that conditional statement, it will show on every symbol.

     # Shows chart only if current RSI is greater than or less than 70 or 30 respectively
     if currentRsi < 30 or currentRsi > 70:
          stock.graph(MAarr)

I will look into the #plt.plot(x,y) #x and y must have same first dimension, but have shapes (152,) and (133,) issue tonight. That should not happen.

corncobb avatar Feb 03 '21 00:02 corncobb

I tried commenting out lines 74 through 77:

 # Shows chart only if current RSI is greater than or less than 70 or 30 respectively
 if currentRsi < 30 or currentRsi > 70:
      stock.graph(MAarr)

Run the script again, but still no graph showing. I will try later on as it is 2am here.
Thanks

guijames avatar Feb 03 '21 01:02 guijames

I will take a look at it this weekend. Very sorry. Working at a startup can be time consuming

corncobb avatar Feb 04 '21 07:02 corncobb