2018kguo / RobinhoodBot

Trading bot for Robinhood accounts
MIT License
209 stars 105 forks source link

NameError: name 'bollinger_mavg' is not defined #4

Closed jdservice42 closed 4 years ago

jdservice42 commented 5 years ago

My portfolio and watchlist are displayed and then I get this.

----- Scanning portfolio for stocks to sell -----

Traceback (most recent call last): File "main.py", line 258, in scan_stocks() File "main.py", line 240, in scan_stocks cross = golden_cross(symbol, n1=50, n2=200, days=30, direction="below") File "main.py", line 170, in golden_cross sma1 = bollinger_mavg(price, n=int(n1), fillna=False) NameError: name 'bollinger_mavg' is not defined jdubb@Latitude-D630:~/RobinhoodBot/robinhoodbot$

What could this be?

shafcodes commented 4 years ago

I am assuming the implementation of Bollinger Moving Averages is missing from the code provided. You can either write your own definition to implement it or wait for the authors to provide the code for it.

Here is a repo i found that might help you understand what Bollinger moving/rolling averages are - Umesh's Repo

UPDATE:

In case you are still looking for the answer, here is what i did -

your code is unable to detect the bollinger_mavg method from the 'ta' library.

I changed the code to fix this issue -

import ta as ta

and then replace

bollinger_mavg(.......) with ta.volatility.bollinger_mavg(.....)

Here is the link.