diff --git a/gamestonk_terminal/portfolio/README.md b/gamestonk_terminal/portfolio/README.md index de0511d4e42..52eb70cf214 100644 --- a/gamestonk_terminal/portfolio/README.md +++ b/gamestonk_terminal/portfolio/README.md @@ -2,12 +2,26 @@ This page shows the available brokers for loading in data. If yours is not listed, please submit a new issue and we will look at adding it. +Current brokers: +* Robinhood + Once this screen is accessed, the first command to be run is ```` -login +login [brokers] ```` -Which will use your login information, which should be stored as environment variables in [config file](/gamestonk_terminal/config_terminal.py) + +The brokers should just be your brokers from the list shown on the first menu. To login to Robinhood, the command is +```` +login rh +```` +When td is added, the command will be +```` +login rh td +```` +After logging in, the help menu will display which brokers you logged into. + +Your login information should be stored as environment variables in [config file](/gamestonk_terminal/config_terminal.py) Robinhood has Two Factor Authentication, so you will likely be prompted to enter a code that is texted/emailed to you. ###NOTE THAT LOGGING IN WILL SAVE A TOKEN TO `os.path.expanduser("~")/.tokens` WHICH CAN BE USED TO LOGIN EVEN IF USER CREDENTIALS ARE INCORRECT. diff --git a/gamestonk_terminal/portfolio/port_controller.py b/gamestonk_terminal/portfolio/port_controller.py index 055b22e69ff..41ae63b0879 100644 --- a/gamestonk_terminal/portfolio/port_controller.py +++ b/gamestonk_terminal/portfolio/port_controller.py @@ -9,6 +9,7 @@ from gamestonk_terminal.helper_funcs import get_flair from gamestonk_terminal.menu import session from gamestonk_terminal.portfolio import rh_api + class PortfolioController: CHOICES = [ @@ -18,7 +19,7 @@ class PortfolioController: "login", "hold", "rhhist", - ] + ] BROKERS = [ "rh", @@ -26,19 +27,17 @@ class PortfolioController: def __init__(self): self.port_parser = argparse.ArgumentParser(add_help=False, prog="port") - self.port_parser.add_argument("cmd", - choices = self.CHOICES) + self.port_parser.add_argument("cmd", choices=self.CHOICES) self.brokers_list = set() - @staticmethod def print_help(broker_list): if not broker_list: print_broke = " None" if broker_list: - print_broke=" " + print_broke = " " for broker in broker_list: - print_broke += broker+" " + print_broke += broker + " " """ Print help """ print("\nPortfolio:") @@ -52,7 +51,6 @@ class PortfolioController: print(" rh Robinhood - fuck these guys") print("") - def print_portfolio_menu(self): print_broke = " " @@ -64,7 +62,6 @@ class PortfolioController: print(" rhhist plot historical RH portfolio") print("") - def switch(self, an_input: str): """Process and dispatch input @@ -103,7 +100,7 @@ class PortfolioController: api = broker + "_api" self.brokers_list.add(broker) try: - eval(api+".login()") + eval(api + ".login()") except Exception as e: print("") print(f"Error at broker : {broker}") @@ -116,13 +113,14 @@ class PortfolioController: def call_rhhist(self, other_args: List[str]): rh_api.plot_historical(other_args) - def call_hold(self,_): + def call_hold(self, _): try: rh_api.show_holdings() except Exception as e: print(e) print("") + def menu(): """Portfolio Analysis Menu""" diff --git a/requirements.txt b/requirements.txt index 06971cc844c..2a0bc3abb1f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ aiohttp==3.7.4.post0; python_version >= "3.6" +alpaca-trade-api==1.0.1 alpha-vantage==2.3.1 ansiwrap==0.8.4; python_version >= "3.6" appdirs==1.4.4; python_version >= "3.6" @@ -103,6 +104,7 @@ rapidfuzz==1.2.1; python_version >= "2.7" regex==2020.11.13; python_version >= "3.6" requests==2.25.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0") retrying==1.3.3 +robin-stocks==2.0.3 scipy==1.5.4; python_version >= "3.6" seaborn==0.11.1; python_version >= "3.6" send2trash==1.5.0; python_version >= "3.5"