twitter – Twitter feed reference


class pyalgotrade.twitter.feed.TwitterFeed(consumerKey, consumerSecret, accessToken, accessTokenSecret, track=[], follow=[], languages=[])


Class responsible for connecting to Twitter’s public stream API and dispatching events. Check for more information.

  • consumerKey (string.) – Consumer key.
  • consumerSecret (string.) – Consumer secret.
  • accessToken (string.) – Access token.
  • accessTokenSecret (string.) – Access token secret.
  • track (list.) – A list of phrases which will be used to determine what Tweets will be delivered on the stream. A phrase may be one or more terms separated by spaces, and a phrase will match if all of the terms in the phrase are present in the Tweet, regardless of order and ignoring case.
  • follow (list.) – A list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported.
  • languages (list.) – A list of language IDs a defined in


  • Go to and create an app. The consumer key and secret will be generated for you after that.
  • Create an access token under the “Your access token” section.
  • At least track or follow have to be set.

Subscribe to Twitter events. The event handler will receive a dictionary with the data as defined in:

Table Of Contents

Previous topic

Twitter support

Next topic

Twitter Example

This Page