SentimentGPT utilizes natural language processing and machine learning techniques to determine the sentiment behind text data, whether positive, negative, or neutral. It provides valuable insights into how traders and investors feel about certain assets, which can influence their decision-making process.
Collect relevant text data from various sources, such as news articles, social media, and financial reports, to understand market sentiment.
Prepare the collected data for analysis by cleaning, tokenizing, and transforming it into a suitable format for sentiment analysis.
Apply natural language processing and machine learning techniques to determine the sentiment behind the preprocessed text data.
Integrate the sentiment analysis results into trading strategies to gauge market sentiment, identify trends, and make informed trading decisions.
1. (Recommended) Create a new virtual environment
conda create --name sentimentgpt python=3.10
conda activate sentimentgpt
2. Download the SentimentGPT repository
git clone https://github.com/YourUsername/SentimentGPT.git
cd SentimentGPT
3. Install SentimentGPT & dependencies from source or PyPI
pip install -U sentimentgpt
or
pip install -e .
4. Configure API keys
1. Rename `OAI_CONFIG_LIST_sample` to `OAI_CONFIG_LIST` and add your OpenAI API key.
2. Rename `config_api_keys_sample` to `config_api_keys` and add your financial data API keys.
To collect relevant text data:
from sentimentgpt.data_collection import DataCollector
collector = DataCollector(config)
data = collector.collect()
To preprocess the collected data:
from sentimentgpt.data_preprocessing import DataPreprocessor
preprocessor = DataPreprocessor(config)
processed_data = preprocessor.preprocess(data)
To perform sentiment analysis:
from sentimentgpt.sentiment_analysis import SentimentAnalyzer
analyzer = SentimentAnalyzer(config)
sentiment = analyzer.analyze(processed_data)
To integrate sentiment analysis into trading strategies:
from sentimentgpt.trading_strategy import StrategyIntegrator
integrator = StrategyIntegrator(config)
integrated_strategy = integrator.integrate(sentiment)
The main folder sentimentgpt has four subfolders data_collection, data_preprocessing, sentiment_analysis, trading_strategy.
SentimentGPT
├── sentimentgpt (main folder)
│ ├── data_collection
│ ├── data_collector.py
│ ├── data_preprocessing
│ ├── data_preprocessor.py
│ ├── sentiment_analysis
│ ├── sentiment_analyzer.py
│ ├── trading_strategy
│ ├── strategy_integrator.py
│ ├── utils.py
│
├── configs
├── experiments
├── tutorials (hands-on tutorial)
│ ├── data_collection_tutorial.ipynb
│ ├── data_preprocessing_tutorial.ipynb
│ └── sentiment_analysis_tutorial.ipynb
├── setup.py
├── config_api_keys_sample
├── requirements.txt
└── README.md
This project is licensed under the Apache-2.0 License. See the LICENSE file for more details.
Disclaimer: The information provided in this repository is for educational purposes only and should not be construed as financial advice. Always consult with a qualified financial advisor before making any investment decisions.