An ML-powered pipeline that analyzes YouTube videos for market insights and generates trading signals.
YTM4A processes YouTube videos in different categories (Finance, AI, Geopolitics) to extract insights and generate trading signals. It uses:
- Natural Language Processing (NLP) for sentiment analysis and entity extraction
- Technical analysis indicators (RSI, MACD, etc.)
- Category-specific trading strategies
- Automated audio transcription and analysis
-
Data Ingestion & Organization
- Automatic video downloading and categorization
- Audio transcription using AssemblyAI
- Structured storage of transcripts, metadata, and analysis
-
ML Pipeline
- Text cleaning and preprocessing
- Named Entity Recognition (NER)
- Sentiment analysis using multiple models
- Technical indicator integration
- Category-specific trading signals
-
Trading Strategies
- Finance: Short-term signals based on sentiment and technical indicators
- AI: Medium-term signals focusing on company mentions and sector trends
- Geopolitics: Long-term signals analyzing global events and impacts
-
Clone the repository:
git clone https://github.com/oliverbhull/ytm4a.git cd ytm4a -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r __python__/requirements.txt python -m spacy download en_core_web_sm
-
Set up environment variables:
- Copy
.env.exampleto.env - Add your AssemblyAI API key
ASSEMBLYAI_API_KEY=your_key_here
- Copy
-
Install system dependencies:
- ffmpeg (for audio processing)
- yt-dlp (for video downloading)
-
Install required system packages:
sudo apt-get update sudo apt-get install -y python3-pip git ffmpeg
-
Clone the repository:
git clone https://github.com/oliverbhull/ytm4a.git cd ytm4a -
Install Python dependencies:
pip3 install -r __python__/requirements.txt
-
Create .env file in the python directory:
cd __python__ nano .envAdd your AssemblyAI API key:
ASSEMBLYAI_API_KEY=your_key_here -
Run the server:
python3 server.py
-
Access the server from other devices using:
http://192.168.12.73:5555
-
Process a YouTube video:
python __python__/ytm4a_api.py <youtube_url> <category> [ticker_symbol]
Categories: Finance, AI, Geopolitics Example:
python __python__/ytm4a_api.py "https://youtube.com/watch?v=..." Finance AAPL -
Output:
- Transcribed audio
- Sentiment analysis
- Entity extraction
- Trading signals
- Price charts (if ticker provided)
For each processed video, YTM4A generates:
YYYYMMDD_video_title.m4a: Compressed audioYYYYMMDD_video_title.json: Video metadataYYYYMMDD_video_title_analysis.json: ML analysis resultsYYYYMMDD_video_title_price.png: Price chart (if ticker provided)
The analysis JSON includes:
{
"processed_data": {
"transcript": "...",
"cleaned_transcript": "...",
"entities": {
"ORG": ["Apple", "Microsoft"],
"PERSON": ["Tim Cook"],
"GPE": ["United States"]
},
"sentiment": {
"textblob": {
"polarity": 0.2,
"subjectivity": 0.5
},
"huggingface": {
"label": "POSITIVE",
"score": 0.85
}
},
"speakers": [...],
"chapters": [...]
},
"features": {
"sentiment_polarity": 0.2,
"org_mentions": 5,
"person_mentions": 3,
"rsi": 65.4,
"macd": 0.5
},
"signal": {
"direction": "BUY",
"confidence": 0.75,
"horizon": "SHORT_TERM",
"reasoning": [
"Strong positive sentiment with multiple company mentions",
"RSI indicates momentum"
]
}
}- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - see LICENSE file for details.
This software is for educational purposes only. Always do your own research and consult with financial professionals before making investment decisions. The creators of YTM4A are not responsible for any financial losses incurred while using this software.