Use LLM for stock sentiment
dennyzhang
:HUGO_URL: https://quantcodedenny.com/posts/llm-tools/
0 Intro
This tool empowers engineers to automate stock sentiment analysis with precision and speed.
It combines two core capabilities: parsing recent news headlines to extract market sentiment and insights, and parsing SEC filings to surface key financial and risk information. Both streams are fed into a configurable LLM pipeline, allowing you to run fast local tests with lightweight models or perform high-accuracy production analysis. Designed for modularity and reuse, it integrates seamlessly into your workflows—turning raw data into actionable insights without manual reading.
Github repo: dennyzhang/quantcodedenny.com - tools/stock_sentiment
1 Setup env
- Install docker in your laptop
- Apply for GEMINI API KEY: https://aistudio.google.com/apikey
2 Run for real
# Use your own key
export GEMINI_API_KEYS="sk-xxx"
# Set stock code to evaluate
export STOCK_TICKER="RKLB"
# Use a powerful-yet-expensive model. Default is gemini-1.5-flash
export GEMINI_MODEL="gemini-2.5-pro"
# Run capability via docker
docker run --rm \
-e GEMINI_API_KEYS="$GEMINI_API_KEYS" \
-e STOCK_TICKER="$STOCK_TICKER" \
-e GEMINI_MODEL="$GEMINI_MODEL" \
-v .:/app/ \
denny/llm-stock-prompt
2025-08-30 07:34:03,849 [INFO] llm_utils.py:19 - Using Gemini model: gemini-2.5-pro
2025-08-30 07:34:04,258 [INFO] sec_utils.py:65 - Fetching filing from https://www.sec.gov/Archives/edgar/data/1819994/000162828025038936/0001628280-25-038936.txt
2025-08-30 07:34:04,533 [INFO] sec_utils.py:68 - Successfully fetched filing for RKLB.
2025-08-30 07:34:04,539 [INFO] main.py:21 - Extracted SEC sections for RKLB (len=1313)
2025-08-30 07:34:04,540 [INFO] main.py:28 - Generating SEC sentiment for RKLB...
2025-08-30 07:34:29,914 [INFO] main.py:32 - Generating headlines sentiment for RKLB...
2025-08-30 07:34:51,624 [INFO] main.py:52 - === RKLB ===
Based on an analysis of public discussions and the nature of SEC 10-Q filings for Rocket Lab (RKLB), here is a sentiment summary:
* **Overall Market Sentiment: Cautiously Bullish**
The market is generally positive on Rocket Lab's long-term potential, recognizing its proven execution and diversified business model. However, this optimism is tempered by the capital-intensive nature of new rocket development and the company's current lack of profitability. The sentiment hinges on future execution rather than current financials.
* **Top 3 Sentiment Drivers:**
1. **Neutron Rocket Development:** Progress on the next-generation, reusable Neutron rocket is the single largest catalyst. Positive news on engine testing, manufacturing milestones, and development timelines drives bullish sentiment, as it promises access to a much larger and more lucrative launch market.
2. **Space Systems Growth:** The performance of the Space Systems division (satellite components, spacecraft manufacturing) is a critical driver. Strong, high-margin revenue growth in this segment diversifies the company away from launch-only risk and provides a clearer, nearer-term path to profitability.
3. **Financial Execution & Cash Burn:** SEC filings like the 10-Q are closely watched for revenue growth, gross margins, and cash burn. While losses are expected during this growth phase, investors are sensitive to the rate of cash consumption and management's commentary on the timeline to achieve positive cash flow.
* **Suggested Action for a Long-Term Tech Investor: Watch**
Monitor progress on the key drivers listed above, particularly Neutron development milestones and margin improvement in the Space Systems segment. A consistent track record of hitting development targets would be a strong signal to initiate or add to a position.
Based on an analysis of recent news, social media discussions, and the provided SEC filing information for Rocket Lab (RKLB) over the past week:
* **SEC Filing Note:** The provided SEC filing (`0001628280-25-038936.txt`) is a 10-Q for the period ending June 30, **2025**. As this is a future-dated document, its contents cannot be used for an analysis of current events and are disregarded in this summary.
***
### **RKLB Analysis: Past Week**
* **Overall Sentiment: Bullish**
* Discussions reflect strong optimism about the company's long-term trajectory, focusing on execution and future growth catalysts, despite broader market volatility.
* **Top 3 Reasons Driving Sentiment:**
1. **Neutron Rocket Development Progress:** Continued tangible progress on the Neutron rocket, including updates on the Archimedes engine, tank production, and launch site construction in Wallops, Virginia, is the primary driver of long-term bullish sentiment. This progress reinforces confidence in the company's ability to compete in the medium and heavy-lift launch market.
2. **Consistent Execution & Launch Cadence:** Rocket Lab maintains a high flight tempo with its Electron rocket, successfully completing missions for customers like NASA. This operational success generates consistent revenue and demonstrates reliability, which is frequently highlighted as a key differentiator.
3. **Expansion of Space Systems Segment:** The market is increasingly recognizing the strength of Rocket Lab's Space Systems division, which provides satellite components and manufacturing. Recent contract wins and a growing backlog in this segment showcase a diversified and resilient business model beyond just launch services.
* **Suggested Action for a Long-Term Tech Investor: Buy**
* The company is executing on its core business while making clear, verifiable progress on its next-generation platform (Neutron) that promises significant growth. For a long-term investor with a tolerance for the high-growth space sector, current price levels are viewed by many as an attractive entry or accumulation point before major catalysts like the first Neutron launch are realized.
3 [Optional] Local CI/CD
# Run unit test
make test
# Function test: sec filing parse only
make run-sec
# Function test: llm prompt only
make run-llm
# Function test: all
make run-all