Search for multiple Symbols in Trading with Sentiment

Hi Team,


Using the cursor method to fetch the tweets using api.search method

cursor_result = tweepy.Cursor(api.search, q = '#APLAPOLLO -filter:retweets',

                                  tweet_mode='extended', 

                                  language='en', since=since_date, until=until_date, count = 100)



Is there a way, we can search for multiple symbols at once?



For ex: In the above code, the code is running only for APLAPOLLO, what if we have multiple symbols and want to include all those in the code and run in one go.

Hi Abhinav,



You can search for multiple symbols at once by modifying the 'q' parameter in the 'Cursor' method.

For example, to search for multiple symbols, you can concatenate them with a boolean operator such as 'OR' in the 'q' parameter. Here's an example:

 

cursor_result = tweepy.Cursor(api.search, q = '#APLAPOLLO OR #SYMBOL2 -filter:retweets',
tweet_mode='extended',
language='en', since=since_date, until=until_date, count = 100)

Hope this helps!



Thanks,

Akshay