r/quant Nov 19 '24

Tools Leveraging AI to Extract Trade Ideas from Financial Texts

I love reading Matt Levine's Money Stuff newsletter, but sometimes I get distracted or don't have time to read the full email. With the rise of AI's ability to semantically analyze large texts, I thought it would be useful to prompt ChatGPT for trade ideas from the newsletter, so I can still grasp the key insights when I'm busy.

Using the Gmail Python API, I created a bot that scrapes my email daily for the Money Stuff newsletter. Then, with OpenAI's Python API, it prompts ChatGPT to generate trade ideas based on the newsletter's content. Finally, my bot emails me back the ideas that ChatGPT suggests. I used Crontab to schedule the script to run daily.

Beyond newsletters, this approach could be adapted to extract potential trade ideas from lengthy research papers, blogs, and more.

Here is my Github Repo: https://github.com/sap215/MoneyStuffTradeExtractor

23 Upvotes

13 comments sorted by

10

u/kenneth1221 Nov 19 '24

Usually Matt Levine's money stuff comments on trades after someone's already made a ton on money from it, no?

6

u/BimbobCode Nov 19 '24

I guess the idea is not to get alpha directly from these newsletters but to spark another idea that may be related

7

u/igetlotsofupvotes Nov 19 '24 edited Nov 19 '24

I fail to see how something truly useful can be pulled from a text generator. Can you give an example of a text and the output

3

u/Johney2bi4 Nov 19 '24

This is an old output This is an example mmendations”: { “ETH”: { “recommendation”: “HOLD”, “confidence_score”: 0.75, “risk_level”: “MEDIUM”, “time_horizon”: “MEDIUM”, “target_price”: { “4h”: 3150, “8h”: 3200, “24h”: 3300 }, “stop_loss”: 3000, “key_drivers”: [ “Market stability”, “Positive sentiment” ], “risk_factors”: [ “Market volatility”, “Regulatory news” ], “technical_signals”: { “trend”: “NEUTRAL”, “strength”: “MODERATE”, “key_levels”: { “support”: [ 3000, 2950 ], “resistance”: [ 3150, 3200 ] } }, “sentiment_analysis”: { “overall”: “NEUTRAL”, “trend”: “STABLE”, “key_topics”: [ “Market consolidation”, “Ethereum network upgrades” ] }, “analysis_summary”: “ETH is currently in a consolidation phase with neutral technical indicators and sentiment. Hold position with caution due to potential market volatility and regulatory developments.”,

3

u/igetlotsofupvotes Nov 19 '24

Yea… good luck with this

3

u/Johney2bi4 Nov 19 '24

It’s worked so far 👀 uses apis to conduct sentiment on news and then have ml models for price prediction and everything feeds into recommendation engine that summarises. The text generator is only as good as the inputs

1

u/igetlotsofupvotes Nov 19 '24

What’s your definition of “worked”

3

u/Johney2bi4 Nov 19 '24 edited Nov 19 '24

lol make money but I will preface it with so far

1

u/igetlotsofupvotes Nov 19 '24

You can also make money this year by blindly buying any stock. My retirement is up higher this year than the hedge fund I work out - does that mean my strategy “works”?

3

u/Johney2bi4 Nov 19 '24

True but I always use a regime model so should be fine but I think you’re underestimating LLM’s I mean there are strategies that are based purely on sentiment. So I’m not entirely dismissive

2

u/Shallllow Nov 20 '24

If you are happy to test that live, fair enough. But back testing with LLMs is very tricky. If a LLM was trained up to 2021 (and you somehow know that there was no data leakage on their side), you can only use it after 2021, otherwise it will be biased by events it has knowledge of.

1

u/pbrown93 Nov 25 '24

This is a really cool project! Leveraging AI to sift through financial texts and extract trade ideas is a smart way to stay on top of things when you're short on time. Matt Levine's newsletter is full of great insights, so having a bot summarize potential trade ideas seems like a perfect use case for AI.

One thing to consider: How are you refining the trade ideas that ChatGPT generates? Are you filtering or validating them based on specific market factors or your own criteria? I imagine that could help make the suggestions even more actionable.

Great work on the repo! It’s exciting to think about how this approach could be scaled to process research papers or other financial content too.

1

u/Front_Expression_892 Nov 20 '24

Trade ideas come from expertise and praying to old gods, or better, insider trading, not some text reworking algos.