News Searching

class ally.Ally(params=None, timeout: float = 1.0)

The ally.Ally.Ally class.

This is the main class for this library.

lookupNews(articleId, dataframe=True, block: bool = True)

Looks up the news text for a given article.

Calls the ‘market/news/{}.json’ endpoint to the news story with a given id.

Parameters
  • articleId – Specify the articleID requested

  • dataframe – whether to return results as dataframe

  • block – Specify whether to block thread if request exceeds rate limit

Returns

Dataframe, or dict

Raises

RateLimitException – If block=False, rate limit problems will be raised

Example

a.lookupNews( '2938-A2231367-5OLLNQGI9S29FR694AB4IM0OQ' )
searchNews(symbols, limit=None, startdate: str = '', enddate: str = '', dataframe=True, block: bool = True)

Searches for news on a set of symbols.

Calls the ‘market/news/search.json’ endpoint to search for news articles related to some set of symbols.

Parameters
  • symbols – Specify the stock symbols for which to search

  • limit – (int) maximum number of hits (10 default)

  • startdate – Earliest date to include in search

  • enddate – Last date to include in search

  • dataframe – whether to return results as dataframe

  • block – Specify whether to block thread if request exceeds rate limit

Returns

Dataframe, or list

Raises

RateLimitException – If block=False, rate limit problems will be raised

Example

df = a.searchNews('spy')

df.columns
# Index(['date', 'headline', 'story'], dtype='object')

df.index
# Index([...], dtype='object', name='id')