Giter VIP home page Giter VIP logo

Comments (7)

2018kguo avatar 2018kguo commented on July 24, 2024

Robinhood has updated the way their watchlists work since the last time I touched this code. They often make these types of changes which is pretty annoying but what can you do. Somehow the old "Default" list doesn't show up on the app and is no longer updatable but is somehow still grabbable via the API. I just pushed a new commit that should get watchlists working again. You will have to update the robin-stocks module "pip install robin-stocks --upgrade" and get it to version 2.0.2.

Let me know if this works now!

from robinhoodbot.

2018kguo avatar 2018kguo commented on July 24, 2024

On a side note, since you mentioned on your last issue that none of the stocks were triggering, if you want to see what's going on in the golden cross calculations you can get rid of the if statement from

if(cross) and plot:
        show_plot(price, sma1, sma2, dates, symbol=stockTicker, label1=str(n1)+" day SMA", label2=str(n2)+" day SMA")

and it will display a nice little chart for each stock on the watchlists with the indicators. Admittedly the 50 and 200 day golden cross is pretty hard to trigger in the current market environment. Feel free to experiment with your own values like 30 - 90 or perhaps look into using exponential moving averages instead.

from robinhoodbot.

codeassassin007 avatar codeassassin007 commented on July 24, 2024

Thanks for this! It did work, however I see a few tickers in there I've never added to a list before. Strange, but it does show all the others that I do have in a list. With that said, I seem to be getting a slightly different error now:

File "RobinhoodBot-master\robinhoodbot\main.py", line 140, in five_year_check
list_date = instrument[0].get("list_date")
IndexError: list index out of range

It's almost there, and I appreciate the help on this. This is a great tool you've done here, and a few tweaks I feel confident about its use. Once it works, I'll give the if statement removal a try. Thanks!

from robinhoodbot.

2018kguo avatar 2018kguo commented on July 24, 2024

Hmm, this call

instrument = r.get_instruments_by_symbols(stockTicker)

usually returns something from Robinhood, but I've heard feedback that for certain stocks it doesn't. The five_year_check() is a bit of an arbitrary metric I threw in there anyway. I committed some code that will handle this specific case, so it should be working now. I'm curious, could you pinpoint which stock caused this?

from robinhoodbot.

codeassassin007 avatar codeassassin007 commented on July 24, 2024

I wonder if it may have been a crypto ticker that threw it off, because the complete transcript shows a warning when tracking Ethererum Classic (ETC). Not sure if this helps at all, but I can dig in further, if need be. See the transcript below:

..RobinhoodBot-master\robinhoodbot\main.py:169: FutureWarning: Units 'M', 'Y' and 'y' do not represent unambiguous timedelta values and will be removed in a future version
if(direction == "above" and not five_year_check(stockTicker)):
Warning: "ETC" is not a valid stock ticker. It is being ignored
Traceback (most recent call last):
File "..\RobinhoodBot-master\robinhoodbot\main.py", line 276, in
scan_stocks()
File "..\RobinhoodBot-master\robinhoodbot\main.py", line 264, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "..\RobinhoodBot-master\robinhoodbot\main.py", line 169, in golden_cross
if(direction == "above" and not five_year_check(stockTicker)):
File "..\RobinhoodBot-master\robinhoodbot\main.py", line 140, in five_year_check
list_date = instrument[0].get("list_date")
IndexError: list index out of range

I also tried the new code and the latest run is coming back with the following below. You'll notice the file says main_copy.py, but that was only because I made a copy to test the new run with:

..\RobinhoodBot-master\robinhoodbot\main_copy.py:162: FutureWarning: Units 'M', 'Y' and 'y' do not represent unambiguous timedelta values and will be removed in a future version
if(direction == "above" and not five_year_check(stockTicker)):
Warning: "ETC" is not a valid stock ticker. It is being ignored
404 Client Error: Not Found for url: https://api.robinhood.com/quotes/historicals/?symbols=ETC&interval=day&span=year&bounds=regular
Traceback (most recent call last):
File "..\RobinhoodBot-master\robinhoodbot\main_copy.py", line 264, in
scan_stocks()
File "..\RobinhoodBot-master\robinhoodbot\main_copy.py", line 252, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "..\RobinhoodBot-master\robinhoodbot\main_copy.py", line 168, in golden_cross
closingPrices.append(float(item['close_price']))
TypeError: 'NoneType' object is not subscriptable

from robinhoodbot.

2018kguo avatar 2018kguo commented on July 24, 2024

Alright, check out my latest commit. It turns out for cryptos you have to call r.get_crypto_historicals instead. I was able to add ETC to one of my watchlists and get it to run. You will still see this warning message:

Warning: "ETC" is not a valid stock ticker. It is being ignored 404 Client Error: Not Found for url: https://api.robinhood.com/quotes/historicals/?symbols=ETC&interval=day&span=year&bounds=regular

but that's because it tries to grab it as a stock first and then tries it as a crypto.

from robinhoodbot.

codeassassin007 avatar codeassassin007 commented on July 24, 2024

Ok it looks good now. I did get the warnings for all the crypto tickers, as expected. I also tried commenting out the if statement you mentioned earlier. It still didn't trigger anything at the 200-50day ratio, but I did get some charts for 100 days and even a 30:90 day ratio, so it does look like everything is working as expected. Really appreciate the time and effort in to this. Thanks again!

from robinhoodbot.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.