I'm a software engineer at Ramp
๐ป Check out my website at 2018kguo.github.io
Trading bot for Robinhood accounts
License: MIT License
I'm a software engineer at Ramp
๐ป Check out my website at 2018kguo.github.io
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
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'
Ran bot but after purchasing stock no transaction history saved.
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.
I keep getting this error when starting the script
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.
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?
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.
----- 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'
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
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!
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
Would this potentially trigger the "pattern day trader" in RH?
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.
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'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.