Git Product home page Git Product logo

robinhoodbot's Introduction

RobinhoodBot

Trading bot for Robinhood accounts

For more info: https://medium.com/@kev.guo123/building-a-robinhood-stock-trading-bot-8ee1b040ec6a

5/1/19: Since Robinhood has updated it's API, you now have to enter a 2 factor authentication code whenever you run the script. To do this, go to the Robinhood mobile app and enable two factor authentication in your settings. You will now receive an SMS code when you run the script, which you have to enter into the script.

2/23/21: Check out this documentation page for a possible workaround https://github.com/jmfernandes/robin_stocks/blob/master/Robinhood.rst

This project supports Python 3.7+

To Install:

git clone https://github.com/2018kguo/RobinhoodBot.git
cd RobinhoodBot/
pip install -r requirements.txt
cp config.py.sample config.py # add auth info after copying

To Run:

cd RobinboodBot/robinhoodbot (If outside of root directory)
python3 main.py

robinhoodbot's People

Contributors

2018kguo avatar andrewantar avatar daliu avatar jpstokes avatar matthewmacomber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robinhoodbot's Issues

scan_stocks() not working pls help?

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

----- Scanning watchlist for stocks to buy -----

Traceback (most recent call last):
File "main.py", line 259, in
scan_stocks()
File "main.py", line 248, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "main.py", line 159, in golden_cross
if(direction == "above" and not five_year_check(stockTicker)):
File "main.py", line 131, in five_year_check
if ((pd.Timestamp("now") - pd.to_datetime(list_date)) < pd.Timedelta("5 Y")):
TypeError: unsupported operand type(s) for -: 'Timestamp' and 'NoneType'

Division by zero error?

When I run the script I get a division by zero error when calculating the ideal_position_size:

Current Portfolio: []

Current Watchlist: ['AAPL', 'TSLA', 'AMD', 'NVDA', 'PLUG', 'TEUM', 'BIIB', 'WBA', 'VSLR', 'NOG', 'FCEL', 'GLUU', 'APPS', 'WIFI', 'BABA', 'AMZN', 'SQ', 'WORK', 'INTC', 'TCEHY', 'CRM', 'GOOGL', 'TWLO', 'SHOP', 'DBX', 'BIDU', 'IBM', 'ADBE', 'INSG', 'BB', 'CTL', 'FTR', 'MGI', 'RKUNY', 'UPWK', 'TRVG', 'SHCAY', 'ACB', 'DIS', 'HEXO', 'CHK', 'NFLX', 'BYND', 'NTDOY', 'MU', 'COST', 'SPWR', 'INFY', 'NET', 'PBFS', 'NOVA', 'LVGO', 'PING', 'HCAT', 'BLU', 'OPRT', 'PHR', 'BNTX', 'IPHA', 'IFS', 'ENPH', 'SNE', 'QCOM', 'AMAT', 'TSM', 'XLNX', 'AVGO', 'FLEX', 'PLAB', 'FJTSY', 'AEIS', 'MPWR']

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

----- Scanning watchlist for stocks to buy -----

PBFS: Short SMA crossed ABOVE Long SMA at 2020-01-07 00:00:00+00:00, which was 3 days 07:05:54.254984 ago , price at cross: 14.58, current price: 15.08
Traceback (most recent call last):
File "C:\Users\cryptic\Desktop\robinhoodbot\main.py", line 259, in
scan_stocks()
File "C:\Users\cryptic\Desktop\robinhoodbot\main.py", line 253, in scan_stocks
buy_holdings(potential_buys, profile_data, holdings_data)
File "C:\Users\cryptic\Desktop\robinhoodbot\main.py", line 205, in buy_holdings
ideal_position_size = (portfolio_value/len(holdings_data)+cash/len(potential_buys))/(2 * len(potential_buys))
ZeroDivisionError: float division by zero

No stocks returning for buy or sell.

I was able to get the script running with adjusting #4 ta.volatility.bollinger_mavg in the code.

However, when I run the script I was unable to get any results to generate. I threw a couple of stocks in the watchlist to get something to either generate a buy or sell, but nothing.

Current Watchlist: ['MSFT', 'SBUX', 'F', 'VOO', 'COST', 'DGAZ', 'VUG', 'VTI', 'WMT', 'DIS', 'SPY', 'UBER', 'VSLR', 'PLUG', 'HHR', 'AMZN', 'SNAP', 'CY', 'FIT', 'GPRO', 'AAPL', 'GE']

Does anyone have something that I can throw at the script to see it working?

Note: I do have #r.order_buy_market(potential_buys[i], num_shares) and #r.order_sell_market(symbol, shares_owned) commented out to prevent execution of the script.

Attribute Error

I have the latest version of robin_stocks; I'm not sure if that's the foremost issue, who knows.

I was actually looking at the list of functions for the latest version of robin_stocks; I realized that the function "get_historicals" doesn't exist. After replacing the initial function and amending it with "get_stock_historicals," an error popped up: "TypeError: 'NoneType' object is not subscriptable"

Are/is there any remedy for this?

Here's the full error:

  File "c:/Users/mouse/OneDrive/Desktop/RobinhoodBot/robinhoodbot/main.py", line 271, in <module>
    scan_stocks()
  File "c:/Users/mouse/OneDrive/Desktop/RobinhoodBot/robinhoodbot/main.py", line 251, in scan_stocks
    cross = golden_cross(symbol, n1=50, n2=200, days=30, direction="below")
  File "c:/Users/mouse/OneDrive/Desktop/RobinhoodBot/robinhoodbot/main.py", line 168, in golden_cross
    history = r.get_historicals(stockTicker,span='year',bounds='regular')
AttributeError: module 'robin_stocks' has no attribute 'get_historicals'

Unexpected keyword argument 'n' in function call

On lines 177 and 178, I have errors for the integer 'n' being unexpected when trying to run the script:

sma1 = ta.volatility.bollinger_mavg(price, n=int(n1), fillna=False)
sma2 = ta.volatility.bollinger_mavg(price, n=int(n2), fillna=False)

Below is what I receive from the console output:

sma1 = ta.volatility.bollinger_mavg(price, n=int(n1), fillna=False)
TypeError: bollinger_mavg() got an unexpected keyword argument 'n'

Any help would be greatly appreciated.

Thanks!

unsupported operant Timestamp and NoneType

After buy scan:
Traceback (most recent call last):
File "main.py", line 271, in
scan_stocks()
File "main.py", line 259, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "main.py", line 166, in golden_cross
if(direction == "above" and not five_year_check(stockTicker)):
File "main.py", line 138, in five_year_check
if ((pd.Timestamp("now") - pd.to_datetime(list_date)) < pd.Timedelta("5 Y")):
TypeError: unsupported operand type(s) for -: 'Timestamp' and 'NoneType'

Weird Login Issues

For some reason I can't change the account from a previous login ive run the script with even though the different credentials are coded into the file.

Login issue?

Hi,
The bot seems to log in, however it never asks me to enter the auth code from my email... and then it never buys or sells anything.

----- Starting scan... -----

Current Portfolio: ['GE']

Current Watchlist: ['AAL', 'OXY', 'EXPE', 'TSLA', 'NFLX', 'MSFT', 'SBUX', 'BABA', 'BAC', 'GE', 'OGZPY', 'MZDAY']

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

----- Scanning watchlist for stocks to buy -----

----- Scan over -----

Always just runs like this... doesn't take any actions.

positions_data error

the robin-stocks author pushed an update on github that says it's working for him with 2FA turned on. I got it going, but I get these errors now.

Traceback (most recent call last):
File "C:\RobinhoodBot\robinhoodbot\main.py", line 258, in
scan_stocks()
File "C:\RobinhoodBot\robinhoodbot\main.py", line 242, in scan_stocks
sell_holdings(symbol, holdings_data)
File "C:\RobinhoodBot\robinhoodbot\main.py", line 186, in sell_holdings
shares_owned = int(float(positions_data[symbol].get("quantity")))
NameError: name 'positions_data' is not defined

NameError: name 'bollinger_mavg' is not defined

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?

bollinger_mavg Error

Has anyone else been getting this error as of a few days ago? I modified the program slightly to run continuously but even redownloading it and not changing any of the code seems to generate this error now and I was hoping someone else has encountered this and knows a fix.

Traceback (most recent call last):
File "C:\Users\johnz\Downloads\RobinhoodBot-master\RobinhoodBot-master\robinhoodbot\main.py", line 258, in
scan_stocks()
File "C:\Users\johnz\Downloads\RobinhoodBot-master\RobinhoodBot-master\robinhoodbot\main.py", line 248, in scan_stocks
cross = golden_cross(symbol, n1=50, n2=200, days=10, direction="above")
File "C:\Users\johnz\Downloads\RobinhoodBot-master\RobinhoodBot-master\robinhoodbot\main.py", line 170, in golden_cross
sma1 = bollinger_mavg(price, n=int(n1), fillna=False)
NameError: name 'bollinger_mavg' is not defined

Bot not pulling complete watchlist data

Hi,

When running the bot, it appears that it isn't pulling in all stocks on my custom watchlists that I have within the Robinhood app. Furthermore, I do see some old tickers that get pulled, that I no longer have on my lists as being watched. I do see that the script pulls a "Default" list, from the API, and all subsequent lists look to be marked by a unique ID. Could those be the lists and if so is there any way to narrow down what the most 'up to date' set is?

Thank you in advance, for your time.

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.