This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_last_crossing(df, days, symbol="", direction=""): | |
"""Searches for a crossing between two indicators for a given stock | |
Args: | |
df(pandas.core.frame.DataFrame): Pandas dataframe with columns containing the stock's prices, both indicators, and the dates | |
days(int): Specifies the maximum number of days that the cross can occur by | |
symbol(str): Symbol of the stock we're querying. Optional, used for printing purposes | |
direction(str): "above" if we are searching for an upwards cross, "below" if we are searching for a downwaords cross. Optional, used for printing purposes | |
Returns: | |
1 if the short-term indicator crosses above the long-term one | |
0 if there is no cross between the indicators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import robin_stocks as r | |
#Log in to Robinhood | |
#Put your username and password in a config.py file in the same directory (see sample file) | |
login = r.login(rh_username,rh_password) | |
def get_watchlist_symbols(): | |
""" | |
Returns: the symbol for each stock in your watchlist as a list of strings | |
""" |
NewerOlder