Пример #1
0
def get_margin_calls(login, symbol=None):
    """Returns either all margin calls or margin calls for a specific stock.
    :param symbol: Will determine which stock to get margin calls for.
    :type symbol: Optional[str]
    :returns: Returns a list of dictionaries of key/value pairs for each margin call.
    """
    url = urls.margin()
    if symbol:
        try:
            symbol = symbol.upper().strip()
        except AttributeError as message:
            print(message)
            return None
        payload = {'equity_instrument_id', helper.id_for_stock(login, symbol)}
        data = helper.request_get(login, url, 'results', payload)
    else:
        data = helper.request_get(login, url, 'results')

    return (data)
Пример #2
0
def get_events(login, symbol, info=None):
    """Returns the events related to a stock.
    :param symbol: The stock ticker.
    :type symbol: str
    :param info: Will filter the results to get a specific value.
    :type info: Optional[str]
    :returns: If the info parameter is provided, then the function will extract the value of the key \
    that matches the info parameter. Otherwise, the whole dictionary is returned.
    """
    try:
        symbol = symbol.upper().strip()
    except AttributeError as message:
        print(message)
        return None

    payload = {'equity_instrument_id': helper.id_for_stock(login, symbol)}
    url = urls.events()
    data = helper.request_get(login, url, 'results', payload)

    return (helper.filter(data, info))
Пример #3
0
def ratings(login, symbol):
    return ('https://api.robinhood.com/midlands/ratings/{}/'.format(
        helper.id_for_stock(login, symbol)))
Пример #4
0
def splits(login, symbol):
    return ('https://api.robinhood.com/instruments/{}/splits/'.format(
        helper.id_for_stock(login, symbol)))
Пример #5
0
def popularity(login, symbol):
    return ('https://api.robinhood.com/instruments/{}/popularity/'.format(
        helper.id_for_stock(login, symbol)))