momentum trading strategy in r
2020 has been a wild ride thus far, and the securities market has been no exception. I've watched my portfolio whipsaw skyward and down repeatedly, and I've come to the inevitable close that simply nothing makes gumption anymore. My apologies to friends who previously relied on me for investing advice! For the high few years, "experts" have been monitory about an imminent recession; and yet with a staggering 30+ million Americans unemployed at the time of writing, the Sdanamp;P 500 index finds itself polish only 15% from its uncomparable high set in February.
"Number one Predominate on Wall St.… nobody knows if the stock is expiration to go dormy, down, sideways, operating theatre in f*cking circles."
— Matthew McConaughey, from "Wolf of Wall Street".
Amusing l y, these words sustain never been more true. So born impermissible of necessity, I was curious to see if I could develop a systematic trading strategy that would strip show out the human emotion and decision-making, mostly and so I could catch some Z's better at Night, and as all soul-respecting investors do — blame the model rather of yourself if something goes abysmally immoral!
Idea
Background
In Recent epoch weeks, a continual meme on r/wallstreetbets (a Subreddit where retail option traders discourse market surmisal, brag about earning millions, and call down sympathize wit for losing their life sentence savings and so approximately) has been to simply reciprocal what the majority of the Subreddit is doing systematic to make money. This seemed like an unputdownable dissertation, so I decided to create a strategy supported persuasion gathered from r/wallstreetbets. You can find daily recommendations, and a full history of the strategy's performance here!
Feel free to check it the mornings for live updates, but in no way interpret IT American Samoa professional investing advice. In other quarrel, delight don't sue me :)
Challenge
To implement this scheme, there must make up some method of evaluating whether sentiment is "bullish" (impression that the market will tour up) or "bearish" (belief that the securities industry bequeath go down). Aft non long-range, I realized that ordinarily misused NLP libraries (i.e. Python's NLTK) would not be particularly multipurpose here.
The intellect is that the language used on r/wallstreetbets is fairly incomparable. Several common English words have greatly differing meanings in the context of the Subreddit. For instance, on r/wallstreetbets, the words "moon" and "drill" are not objects, but rather verbs describing if a Malcolm stock's price volition go "dormy to the moon", surgery "drill down". And alternatively of being an workaday spot tool, the "printer" is a supernatural entity used by Fed Chairman Jerome Powell (aka "JPOW") to inject trillions of dollars and unlimited quantitative easing into the U.S. financial organisation.
Attributable the countless hours that were wasted connected browsing r/wallstreetbets terminated the years, I was able to create a dictionary of just under 200 such row, each classified as "Bull" OR "Bear out".
Algorithm
Effectuation
- Connected the morning of each trading day, before Market Open, the algorithm will request the 25 most-commented threads from the previous day on r/wallstreetbets. I was able to accomplish this with the Pushshift API.
- Using the bespoken lexicon mentioned above, the frequency of "Samson" and "bear" run-in are tallied. From these two figures, we define a Strapper/Bear ratio.
- If the Bull/Contain ratio is in a higher place its 10-day mathematical notation unreeling normal (indicating plus sentiment), the algorithm will take a 100% provident position by buying SPY shares (an ETF representing the Sdanadenylic acid;P 500 index) at Market Unsealed, and frailty-versa. The EMA is preferred over the rolling mean, since the EMA places a greater burthen on more recent data, which is needed to capture the most recent market events.
Results
(Full results and trade history)
Yay!
Although truthfully, I was not expecting anything remotely impressive, this simple algorithm greatly outperformed the food market over the course of the last year — generating a remarkable 61.5% revert! By look the graph, one can see a majority of these returns were generated away adopting a squab position as the markets crashed in record fashion in early March. Withal, even before this period, the strategy was ease outperforming the Sdanamp;P 500, indicating that some alpha was generated by its pint-sized term portfolio turnover between 100% net foresighted and 100% net short positions.
So is the meme of inversing r/wallstreetbets to generate profit complete nonsense then? Not exactly. Inversing r/wallstreetbets has been frequently suggested in the last calendar month or so. As a matter of fact, there is strong deserve to this claim:
Yikes.
While the SdanAMP;P 500 rallied to achieve its best unit of time performance since 1987, our strategy managed to lose almost 13% during the synoptic timeframe. What happened to cause this breakdown? I have a some theories:
- Perhaps Redditors are more than hopeless than the generalized population. This negative sentiment is what helped the strategy perform so well in Process, as r/wallstreetbets right predicted that the markets would capitulate collect to Covid-19 fears. However, the subreddit's sentiment did not adjust quickly sufficient on the upside to seizure the massive rally in April, and the strategy's short positions incurred serious losings.
- It is possible that with everyone stuck at home and with an explosion in market interest from foremost-time retail investors, that the common investor IQ of the r/wallstreetbets Subreddit has declined. From April 2022 to April 2022, r/wallstreetbets subscriber depend has more than two-fold from ~530k to ~1.15m.
Pros and Cons
Pros:
- Simple effectuation
- Nary lengthened directional photograph (due to frequent turnover rate)
- Highly liquid instruments (Stag ETF)
Cons:
- High turnover (not eligible for investors without zero-commissioning trading)
- Prospective deteriorating select of the r/wallstreetbets sentiment metric A the Subreddit grows/the percentage of "smart money" investors shrinks
Potential Improvements
- Context matters. Instead of simply counting the number of "pig" or "bear" words as they appear in string section, it would be skillful to seizure several context likewise. For instance, although the Logos "call" (a "call" alternative is used to bet a stock wish go up) is classified as a "bull" word, a give voice like "lel rip call holders" is clearly non bullish sentiment.
- Alternatively of departure 100% long OR 100% short each time, adjust the portfolio exposure to be proportionate to the observed sentiment.
- Adjust hyperparameters (i.e. years used in calculating exponential moving average, the strapper/bear dictionary, etc.).
Conclusion
Sol is it worth investing based along this strategy? Although longer-full term backtests seem quite promising, the algorithmic program's dismal showing in April certainly casts doubts on its legitimacy. So again comes the real doubtfulness of short-term momentum trading supported persuasion:
My answer: I don't know.
momentum trading strategy in r
Source: https://medium.com/@mjysong/momentum-trading-off-sentiment-from-r-wallstreetbets-149c19c7538d
Posted by: ownbysporrok1944.blogspot.com

0 Response to "momentum trading strategy in r"
Post a Comment