Giter Club home page Giter Club logo

robinhoodshell's People

Contributors

anilshanbhag avatar fccmac avatar ploch 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robinhoodshell's Issues

Exceptions.nameerror object has no attribute upper

raise NameError('Invalid Symbols: ' + ",".join(stocks)).upper() #TODO: custom exception

AttributeError: 'exceptions.NameError' object has no attribute 'upper'

Saw where this was an issue previously. Am still running into it though any suggestions? Occurs when I try to view my portfolio

list portfolio fails

Welcome to the Robinhood shell. Type help or ? to list commands.

l
┌Account──────────┬─────────────────┬──────────────┐
│ Portfolio Value │ Change │ Buying Power │
├─────────────────┼─────────────────┼──────────────┤
redactedredactedredacted
└─────────────────┴─────────────────┴──────────────┘
Traceback (most recent call last):
File "./shell.py", line 627, in
RobinhoodShell().cmdloop()
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
return func(arg)
File "./shell.py", line 150, in do_l
price = market_data[i]['last_trade_price']
TypeError: 'NoneType' object is not subscriptable

Cannot list my portfolio.

version: Python 3.7.7

Unable to login using Windows7 64bit

Any ideas what this means? I receive the sms code on my device, I then type it in the command prompt, but I then I get a login error after pressing enter. I am a Windows expert, but unfortunately not in Python. Whatever help you can provide would be greatly appreciated.

RobinhoodLoginError

error with install

I've previously installed everything without issue. My machine got a clean wipe and now as I try to reinstall this I get this error.

`squinton-ml:RobinhoodShell shaunquinton$ sudo pip install -r requirements.txt
Password:
The directory '/Users/shaunquinton/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/shaunquinton/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting beautifultable==0.3.0 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/74/a8/1b183b85dfe7434f4a99477b8c8a6b2bf6f2cdd6b4b113267d25a4ba036e/beautifultable-0.3.0.tar.gz
Collecting enum==0.4.6 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/0c/4e/1ea357e7783c756bb579333c1e4a026fb331371ee771f616ffedc781e531/enum-0.4.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/init.py", line 6, in
import distutils.core
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 16, in
from distutils.dist import Distribution
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 9, in
import re
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py", line 143, in
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-ox7486a5/enum/`

I've tried the suggestions in the error messaging, but have not been able to resolve the issue. Is anyone else getting this error?

Include more parameters in list table

Currently the list table includes symbol, current price, quantity, and total equity. It would be very useful if you could also include things like % change, today's return, and total return, as this helps me better gauge how well every pick is going. I'm not sure how difficult this would be, depending on if the data is included in the request you make, but I think it's worth putting it in.

I might be able to help with this if you'd like. I'd just need to know where I could find the data I'm looking for within the API.

Thanks!

RobinhoodShell

I get this when I try to execute ./shell.py

:~/RobinhoodShell$ ./shell.py
File "./shell.py", line 123
change = f"{change:.3f}"
^
SyntaxError: invalid syntax

please kindly look at this please
am using python 3

All Logins Fail As Of Today

Reset a few devices I had this afternoon and all at once they were unable to log back in... several accounts... credentials are all correct.

$ ./Shell/shell.py
Traceback (most recent call last):
File "./Shell/shell.py", line 564, in
RobinhoodShell().cmdloop()
File "./Shell/shell.py", line 37, in init
self.trader.login(username=USERNAME, password=PASSWORD)
File "/home/Z8/ETF/Shell/Robinhood.py", line 136, in login
raise RH_exception.LoginFailed()
AttributeError: 'module' object has no attribute 'LoginFailed'

Buy command orders wrong stock

Buy command orders the wrong stock symbol.

Buy command examples:
b NX 1 17.10
b LIVE 1 12.85

Resulting orders:
NXPI
LYV

The first example results in ordering of stocks with a different symbol that contains letters from the first symbol, but the second example is a stock that has a completely different symbol but the company has the same name. The RH API URLs in instrument.data appear to be correct. Interestingly, the resulting orders are the first search results on the list of stocks that appear when using the original app interface.

Options orders with command 'o'

Am I missing something, or are Option Orders not yet displayed with the 'o' command?
('l' shows both stocks and options positions, great!)

new

My name is Luis, I'm a big-data machine-learning developer, I'm a fan of your work, and I usually check your updates.

I was afraid that my savings would be eaten by inflation. I have created a powerful tool that based on past technical patterns (volatility, moving averages, statistics, trends, candlesticks, support and resistance, stock index indicators).
All the ones you know (RSI, MACD, STOCH, Bolinger Bands, SMA, DEMARK, Japanese candlesticks, ichimoku, fibonacci, williansR, balance of power, murrey math, etc) and more than 200 others.

The tool creates prediction models of correct trading points (buy signal and sell signal, every stock is good traded in time and direction).
For this I have used big data tools like pandas python, stock market libraries like: tablib, TAcharts ,pandas_ta... For data collection and calculation.
And powerful machine-learning libraries such as: Sklearn.RandomForest , Sklearn.GradientBoosting, XGBoost, Google TensorFlow and Google TensorFlow LSTM.

With the models trained with the selection of the best technical indicators, the tool is able to predict trading points (where to buy, where to sell) and send real-time alerts to Telegram or Mail. The points are calculated based on the learning of the correct trading points of the last 2 years (including the change to bear market after the rate hike).

I think it could be useful to you, to improve, I would like to share it with you, and if you are interested in improving and collaborating I am also willing, and if not file it in the box.

If tou want, Please read the readme , and in case of any problem you can contact me ,
If you are convinced try to install it with the documentation.
https://github.com/Leci37/LecTrade/tree/develop I appreciate the feedback

Closes when using l

When I use "l," the program returns errors after listing my portfolio value and closes the application.

Unauthorized for url: https://api.robinhood.com/

Login works as intended, but unable to trade or get portfolio data since Robinhood maintenance cycle last night.

$./shell.py 
Welcome to the Robinhood shell. Type help or ? to list commands.

> l
Traceback (most recent call last):
  File "./shell.py", line 564, in <module>
    RobinhoodShell().cmdloop()
  File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "./shell.py", line 60, in do_l
    portfolio = self.trader.portfolios()
  File "/home/Z8/ETF/Shell/Robinhood.py", line 826, in portfolios
    req.raise_for_status()
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.robinhood.com/portfolios/


$ ./shell.py 
Welcome to the Robinhood shell. Type help or ? to list commands.

> b SPY 1 300.00
Traceback (most recent call last):
  File "./shell.py", line 564, in <module>
    RobinhoodShell().cmdloop()
  File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "./shell.py", line 227, in do_b
    res = self.trader.place_buy_order(stock_instrument, quantity, price)
  File "/home/Z8/ETF/Shell/Robinhood.py", line 1586, in place_buy_order
    return self.place_order(instrument, quantity, ask_price, transaction)
  File "/home/Z8/ETF/Shell/Robinhood.py", line 1538, in place_order
    'account': self.get_account()['url'],
  File "/home/Z8/ETF/Shell/Robinhood.py", line 701, in get_account
    res.raise_for_status()  # auth required
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.robinhood.com/accounts/

Work with cryptocurrency trading

Hello was wondering if this works with cryptocurrency trading in RH? RH doesnt offer stop loss or stop buys for cryptocurrencies

Bad order

hello. getting Bad Order when placing a sell order. I've tried limit, and market. any ideas?
Buy orders go throug perfectly, both limit and market.

Thanks

object has no attribute 'upper'

this error has begun occurring when using the 'l' list all option:

Traceback (most recent call last):
File "./shell.py", line 565, in
RobinhoodShell().cmdloop()
File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "./shell.py", line 86, in do_l
raw_data = self.trader.quotes_data(symbols)
File "/home/HMSS013/.dropbox-shared/Dropbox/Public/Market Service/Shell/Robinhood.py", line 257, in quotes_data
raise NameError('Invalid Symbols: ' + ",".join(stocks)).upper() #TODO: custom exception
AttributeError: 'exceptions.NameError' object has no attribute 'upper'

Fractional Share Support?

Hi! Ultimately I'd like to use this to set up a $5 buy of a stock every day, but didn't see anywhere in the documentation mentioning fractional shares.

Is it possible or are there plans for future support?

Thanks!

AttributeError: 'module' object has no attribute 'LoginFailed'

$ ./shell.py
Traceback (most recent call last):
File "./shell.py", line 383, in
RobinhoodShell().cmdloop()
File "./shell.py", line 33, in init
self.trader.login(username=USERNAME, password=PASSWORD)
File "/Users/jason/Documents/repo/RobinhoodShell/Robinhood.py", line 136, in login
raise RH_exception.LoginFailed()
AttributeError: 'module' object has no attribute 'LoginFailed'

Cannot get the quotes of any tick

My authentication is successful and l is listing the portfolio value but it doesn't show the individual positions. Moreover when I tried to get the quote using q command, it also errors out.

Please help.

> l
┌Account───────────────┐
│ Portfolio Value │ Change │ Buying Power │
├────────┼────────┤
│ 2217.66 │ -8.0 (-2.38%) │ 9.6600 │
└────┴──────────────┘

Traceback (most recent call last):
File "shell.py", line 613, in
RobinhoodShell().cmdloop()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
return func(arg)
File "shell.py", line 136, in do_l
market_data = self.trader.get_stock_marketdata(instruments)
File "/Users/skumar/Project/OptionChanakya/RobinhoodShell/Robinhood/Robinhood.py", line 465, in get_stock_marketdata
return info['results']
KeyError: 'results'

> q spy
Traceback (most recent call last):
File "shell.py", line 613, in

RobinhoodShell().cmdloop()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
return func(arg)
File "shell.py", line 481, in do_q
raw_data = self.trader.get_stock_marketdata(instruments)
File "/Users/skumar/Project/OptionChanakya/RobinhoodShell/Robinhood/Robinhood.py", line 465, in get_stock_marketdata
return info['results']
KeyError: 'results'

Bad order

hello. getting Bad Order when placing a sell order. I've tried limit, and market. any ideas?
Buy orders go throug perfectly, both limit and market.

Thanks

Store access_token into json file and reuse later

Following our discussions in #22 and
b9ec538#commitcomment-33584861

we have a functioning solution for automation again. However, it generates tons of email. For every single invocation of shell.py, even to do no more than lookup my account balances--which I might do many times per day--it goes through time-delaying stages of generating yet another verification code, followed by a second mail "We’re emailing to confirm your recent login to Robinhood."

I was thinking, again in Robinhood/Robinhood.py, maybe around the lines

                #gets access token for final response to stay logged in
                res3 = self.session.post(endpoints.login(), data=payload, timeout=15)
                res3.raise_for_status()
                data = res3.json()

                if 'access_token' in data.keys() and 'refresh_token' in data.keys():
                    self.auth_token = data['access_token']
                    self.refresh_token = data['refresh_token']
                    self.headers['Authorization'] = 'Bearer ' + self.auth_token
                    
                    # How about export this into a file, and reuse later?
                    # Serialize this access_token, and deserialize it next run, instead of going thru login hack
                    
                    
                    return True

  • What parts of the data structure are essential to keep the login session alive (for the ~24hrs at least)?

  • How about saving/exporting that into a .json or xml file,

  • Finally, attempting to read and import that file if exists next time RobinhoodShell is run, failing over to the regular existing login routine which regenerates a valid session?

I might try to hack it up, but it won't be pretty; I tend to resort to subshells and languages I'm more familiar with.

Buy command cannot find stock but quote command can

Buy command returns stock not found but the price is accessible through q command and stock is purchasible via app interface.

Buy command examples:
b AUTO 1 15.00
Stock not found

q AUTO
AUTO: $15.00

=======

EDIT: Symbol not visible through app interface, please delete this issue. Sorry about that.

Outputs only 100 orders with command 'o'

I might have missed something, but when trying to list existing open orders it only prints out max 100 for the same ticker. Even though I have 5 times more..

"sl" Stop-Loss order gets executed as Stop-Limit order

When I use the parameter sl to place a stop loss it actually gets executed as a stop-limit.
So, "sl MSFT 1 50" translates to a stop-limit order of MSFT at $50.
I've tried adding in: "order = 'market'" into where "place_stop_loss_order" is defined in Robinhood.py but still get the same result. Seems to me like this should have overriden the default value of "limit" order with "market" order and thus be translated to a stop-loss order. Maybe this is why stop-loss is not currently supported with RobinhoodShell yet? Not sure
This would be really helpful to get worked out

Way to pass parameters?

Are parameters currently supported in any fashion? (Aside from simply changing the shell code)
Would be really nice to call this from another script and work in my own automation from there
Ex:
./shell.py -l

Crashes because I have options purchased

It works fine when my account has stocks, but when I have options in my account it crashes and burns:

(I get that options aren't 'supported', but it shouldn't die should it? )

Traceback (most recent call last):
File "shell.py", line 627, in
RobinhoodShell().cmdloop()
File "/usr/lib64/python3.8/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/lib64/python3.8/cmd.py", line 217, in onecmd
return func(arg)
File "shell.py", line 141, in do_l
market_data = self.trader.get_stock_marketdata(instruments)
File "/home/bcrockett/Downloads/RobinhoodShell/Robinhood/Robinhood.py", line 474, in get_stock_marketdata
return info['results']
KeyError: 'results'

error when listing watchlist

I get the following error when using the W and L command.

w
Traceback (most recent call last):
File "./shell.py", line 300, in
RobinhoodShell().cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "./shell.py", line 99, in do_w
table.column_headers = ["symbol", "current price"]
File "/usr/local/lib/python2.7/dist-packages/beautifultable/beautifultable.py", line 167, in setattr
super(BeautifulTable, self).setattr(name, value)
File "/usr/local/lib/python2.7/dist-packages/beautifultable/beautifultable.py", line 299, in column_headers
header = self._validate_row(value)
File "/usr/local/lib/python2.7/dist-packages/beautifultable/beautifultable.py", line 378, in _validate_row
self._initialize_table(len(row))
File "/usr/local/lib/python2.7/dist-packages/beautifultable/beautifultable.py", line 364, in _initialize_table
self._column_alignments = AlignmentMetaData(self, [self.default_alignment] * column_count)
File "/usr/local/lib/python2.7/dist-packages/beautifultable/meta.py", line 8, in init
self.validate(i)
File "/usr/local/lib/python2.7/dist-packages/beautifultable/meta.py", line 24, in validate
+ ', was {}'.format(value))
TypeError: 'type' object is not iterable

can't get quotes for Goog

yes same here pls fix

q goog
Traceback (most recent call last):
File "./shell.py", line 613, in
RobinhoodShell().cmdloop()
File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
return func(arg)
File "./shell.py", line 481, in do_q
raw_data = self.trader.get_stock_marketdata(instruments)
File "/Users/sk/RobinhoodShell/Robinhood/Robinhood.py", line 465, in get_stock_marketdata
return info['results']
KeyError: 'results'
(RobinhoodShell) mark@marks-Air RobinhoodShell (master)*$ ./shell.py
Welcome to the Robinhood shell. Type help or ? to list commands.

Question: not an issue

Can I have the shell script look for buy/sell stocks in a csv, then process automatically?

Thanks.

Challenge-Type Issue

I do not understand the Challenge-Type in the config.py. If I do not have 2FA, what do I put there? Or, if I have 2FA for sms, I have sms in the field, and it still gives email as the challenge type when I run shell.py. I do not get a sms code and so I do not know what to input. Thanks for any help.

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.