I have created a sentiment analysis-based stock trading algorithm coded in Python. My algorithm adeptly scrapes influential online platforms like Twitter and Reddit via APIs, identifying people's emotions about specific stocks or the market overall.
The program involves pinpointing posts that mention company names or their ticker symbols. The sentiment analysis module assigns scores from -4 to +4, enabling nuanced interpretation of negative, positive, and neutral sentiments. Drawing on this analysis, I've developed a refined trading strategy focused on extreme sentiment scores. Outside the -2 to +2 neutral range, the algorithm triggers buying for scores above +2 and selling for scores below -2, informed by coherent market sentiment rather than single posts.
Thorough evaluation via historical backtesting refines the program's performance, ensuring it remains effective in evolving markets.
During the first quarter of 2022, the algorithm demonstrated exceptional performance with a growth of +6.34%. This impressive outcome significantly outpaced the market by +11.89%, notably during a period when the overall market experienced a decline of -5.55%. Looking ahead, the algorithm is projected to maintain its robust performance with an anticipated annual return of +28.31%. The program ranks in the 81st percentile on QuantConnect.