Skip to content

a-dorgham/TradeMood

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TradeMood

Python Streamlit SQLite License TensorFlow Plotly

TradeMood is a Python-based, web-accessible dashboard for real-time financial market sentiment analysis and trading decision support. Built with Streamlit, it integrates sentiment analysis using a pre-trained RoBERTa model (finiteautomata/bertweet-base-sentiment-analysis), fetches market data and social media content, generates trading signals, and tracks trades for financial instruments like gold futures (GC=F). Still requires fine tuning.


πŸ”§ Features

  • πŸ–₯️ Interactive Web Dashboard powered by Streamlit.
  • πŸ“Š Real-Time Sentiment Analysis using a RoBERTa-based model.
  • πŸ“ˆ Trading Signal Generation based on sentiment trends (BUY, SELL, HOLD).
  • πŸ’° Trade Management with position tracking and P&L calculation.
  • πŸ“… Scheduled Sentiment Pipeline every 5 minutes during COMEX hours.
  • πŸ—„οΈ SQLite Database for caching and trade history.
  • πŸ” Detailed Trade History with styled P&L metrics.
  • ⚠️ Robust Error Handling and logging.
  • πŸ”„ Modular Architecture for easy extension.
  • πŸ“‰ Market Data Integration (e.g., Yahoo Finance GC=F).
  • πŸ§ͺ Unit Tests for key components.

πŸ“ Project Structure

TradeMood/
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ LICENSE
β”œβ”€β”€ trademood/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ database_handler.py
β”‚   β”‚   β”œβ”€β”€ error_handler.py
β”‚   β”‚   β”œβ”€β”€ trade_tracker.py
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ sentiment_result.py
β”‚   β”‚   β”‚   β”œβ”€β”€ trading_signal.py
β”‚   β”‚   β”‚   └── trend_signal.py
β”‚   β”‚   β”œβ”€β”€ sentiment/
β”‚   β”‚   β”‚   β”œβ”€β”€ analyzer.py
β”‚   β”‚   β”‚   β”œβ”€β”€ fetcher.py
β”‚   β”‚   β”‚   β”œβ”€β”€ pipeline.py
β”‚   β”‚   β”‚   β”œβ”€β”€ trend_generator.py
β”‚   β”‚   β”‚   └── signal_generator.py
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── sentiment_api.py
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   └── app.py
β”‚   └── tests/
β”‚       └── test_sentiment.py
β”œβ”€β”€ scripts/
β”‚   └── run_dashboard.py
β”œβ”€β”€ data/
β”‚   └── sentiment_cache.db
β”œβ”€β”€ examples/
β”‚   └── config.yaml
└── docs/
    └── screenshots/

πŸš€ Getting Started

Prerequisites

  • Python 3.10.5
  • Virtual environment (recommended)
  • SQLite database
  • API keys (Yahoo Finance, X API, etc.)

Install Dependencies

pip install -r requirements.txt

▢️ Installation

From the project root (where setup.py is):

pip install -e .

Run the App

streamlit run scripts/run_dashboard.py

Access the dashboard at: http://localhost:8501


πŸ“š Usage

  1. View Sentiment Trends for GC=F
  2. Check Trading Signals (BUY, SELL, HOLD)
  3. Manage Trades: Open/close positions, track P&L
  4. Review History in styled trade table
  5. Edit config.yaml for API and symbols

🧩 Supported Instruments

  • βœ… Gold Futures (GC=F)
  • 🚧 Add more via fetcher.py and trade_tracker.py

πŸ›  Developer Notes

  • Add new instruments in fetcher.py, trade_tracker.py
  • Change model in analyzer.py
  • Extend API in sentiment_api.py

πŸ§ͺ Testing

pytest trademood/tests/

πŸ“Έ Screenshots

Full Upper Dashboard
Price Action with Sentiment
Trade History
Database Tables

🌐 Roadmap

  • πŸ“ˆ More instruments (stocks, forex, crypto)
  • 🧠 Multi-language sentiment models
  • πŸ’Ό Live broker integration
  • βš™οΈ Config UI

🀝 Contributing

git clone https://github.com/your-username/TradeMood.git
cd TradeMood

πŸ“œ License

MIT License β€” see LICENSE.


πŸ“¬ Contact


⚠️ Limitations

  • No automated order execution
  • Limited offline functionality
  • SQLite not suited for large data
  • Sentiment model limitations

About

A Python-based system that analyzes market sentiment from news sources to generate trading signals. Combines NLP (VADER & BERT) with technical indicators to identify trends in commodities and indices (Gold, Oil, S&P 500, Nasdaq).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages