def get_watchlist_symbols(): """ Returns: Tickers for stocks on the watchlist """ watchlist_names = [] tickers = [] # diction = robin.get_all_watchlists(info=None) # specific WatchList to evaluate (can also do all if remove) watchlist = 'My First List' for name in robin.get_all_watchlists(info="results"): watchlist_names.append(name["display_name"]) # Can iterate through all watchlists, but this is set for a specific for name in watchlist_names: if name == watchlist: print("NAME", name, "------------------------------------------") lists = robin.account.get_watchlist_by_name(name)["results"] # print("Lists", lists) # print("TESTING", lists[1].get('instrument')) for item in lists: tickers.append(item.get('symbol')) # TODO why would I need to do it by url?? # instrument_data = robin.get_instrument_by_url( # item.get('instrument')) # symbol = instrument_data['symbol'] # tickers.append(symbol) return tickers
def get_watchlist_symbols(): """ Returns: the symbol for each stock in your watchlist as a list of strings """ my_list_names = [] symbols = [] for name in r.get_all_watchlists(info='name'): my_list_names.append(name) for name in my_list_names: list = r.get_watchlist_by_name(name) for item in list: instrument_data = r.get_instrument_by_url(item.get('instrument')) symbol = instrument_data['symbol'] symbols.append(symbol) return symbols
us_holidays = holidays.UnitedStates() ''' Robinhood includes dividends as part of your net gain. This script removes dividends from net gain to figure out how much your stocks/options have paid off. Note: load_portfolio_profile() contains some other useful breakdowns of equity. Print profileData and see what other values you can play around with. ''' #!!! Fill out username and password username = '******' password = '******' #!!! login = r.login(username, password) hey = r.get_all_watchlists() print() print(hey) stockList = r.build_holdings() stocksArray = [] stocknumber = 0 class trajectory: #print info to console debug = True #ideal slope for trajectory calculations #compositon of slope score (percentages)