MarketPulse is an open source financial information analytics push service hosted on GitHub and developed by user T1mn. It is based on Google Gemini AI that automatically captures the latest financial news, analyzes market impact, and generates reports with investment recommendations, confidence indices, and source reliability. The analysis results are pushed to users' devices in real time via Bark and PushPlus. The project is developed in Python, supports multi-device push and automated de-duplication, and is suitable for investors and developers who pay attention to the stock market. The code is open and freely contributed to by the community, and the project is licensed under the MIT license, which allows for flexible modification and use.
Function List
- Get the latest financial news from Finnhub and other platforms automatically.
- Analyze news with Google Gemini AI for investment advice, confidence index and source reliability.
- Push analytics to your phone or computer via Bark and PushPlus.
- Support for user-defined stock codes to follow and trusted news feeds.
- Automatic de-duplication to avoid pushing the same news repeatedly.
- Provides daemon management, supporting background running, starting, stopping and restarting.
- The logging system records the operating status for easy debugging and monitoring.
- Support environment variable configuration to protect API key security.
Using Help
Installation process
MarketPulse is a Python project that requires basic programming knowledge to install. Here are the detailed steps:
- Installation of uv (recommended)
To efficiently manage your Python environment, it is recommended that you install the uv utility. Run the following command:curl -LsSf https://astral.sh/uv/install.sh | sh
uv optimizes dependency resolution and improves installation efficiency.
- Cloning Codebase
Use Git to clone your project locally:git clone https://github.com/T1mn/MarketPulse.git cd MarketPulse
- Create a virtual environment and install dependencies
Create a virtual environment to isolate project dependencies:uv venv source .venv/bin/activate # Linux/macOS # 或 .venv\Scripts\activate # Windows
Install project dependencies:
uv pip install -r requirements.txt uv pip install -e .
Dependencies include
google-generativeai
,python-dotenv
,schedule
cap (a poem)requests
etc. - Configuring Environment Variables
Copy the sample configuration file and rename it.env
::cp .env.example .env
compiler
.env
file, fill in the API key:FINNHUB_API_KEY=your_finnhub_api_key GEMINI_API_KEY=your_gemini_api_key BARK_KEY_1=your_first_bark_key PUSHPLUS_TOKEN=your_pushplus_token PUSHPLUS_TOPIC=your_topic_code
Get key method:
- Finnhub API key: Sign up for Finnhub to get it.
- Gemini API Key: Requested through the Google Cloud platform.
- Bark key: Obtained after installing the Bark application.
- PushPlus Token: Sign up at PushPlus to get it.
- Operational services
There are two ways to run it:- Front-end operation (for debugging) ::
python -m MarketPulse.main
- Running in the background (recommended) ::
python -m MarketPulse.daemon_manager start
The background operation supports process management, and the terminal can be shut down after the service is started.
Main Functions
- Get Financial News
MarketPulse gets the latest financial news every 30 minutes (by default) via the Finnhub API. Users can find the latest financial news in theconfig.py
modificationsNEWS_FETCH_INTERVAL
Adjust the frequency:NEWS_FETCH_INTERVAL = 30 # 分钟
Operational Steps:
- After starting the service, the program automatically gets news from Finnhub.
- available at
config.py
Configure trusted news feeds such as:TRUSTED_SOURCES = ["Reuters", "Bloomberg", "CNBC"]
- News data is saved locally for AI analysis.
- AI Analytics and Push
Google Gemini AI analyzes news and generates reports with investment advice, confidence index (in percent) and source reliability. Results are pushed via Bark or PushPlus.
Operational Steps:- assure
.env
file is configured with a Bark or PushPlus key. - Once the service is running, the analysis results are automatically pushed to the configured devices.
- Bark pushes show up as mobile notifications, PushPlus supports WeChat pushes (see GitHub repository).
img
(Examples in the folder).
- assure
- Customized Stock Monitoring
Users can configure the ticker symbols to follow to keep track of specific company news.
Operational Steps:- compiler
config.py
ModificationsUS_MARKET_SYMBOLS
::US_MARKET_SYMBOLS = ["AAPL", "TSLA", "MSFT"]
- After saving and restarting the service, the program will prioritize the analysis of news about these stocks.
- compiler
- daemon management
MarketPulse supports running in the background with the following management commands:python -m MarketPulse.daemon_manager start # 启动 python -m MarketPulse.daemon_manager stop # 停止 python -m MarketPulse.daemon_manager restart # 重启 python -m MarketPulse.daemon_manager status # 查看状态
The process ID is stored in the
market_pulse.pid
Documentation is managed automatically. - Log View
The logs are saved in thelogs
Catalog that contains:market_pulse.log
: Main program log, max. 10MB, keep 5 backups.daemon.log
: Daemon logs, up to 5MB, keep 3 backups.
View real-time logs:
tail -f logs/market_pulse.log
- Contribute code
As an open source project, users can submit improvements via GitHub.
Operational Steps:- Fork Warehouse to Personal Account.
- Modify the code and submit a Pull Request.
- consultation
CONTRIBUTING.md
(if present) or submit questions and suggestions directly.
caveat
- Make sure the API key is valid, Finnhub and Gemini have request limits and quotas need to be respected.
- The first run will execute the task once immediately, and thereafter at configured intervals.
- status file
app_state.json
Record processed news IDs to avoid duplicate pushes. - Use the uv management environment to improve the efficiency of dependency installations.
- Log files are rotated periodically to avoid taking up too much disk space.
application scenario
- Investors get real-time market insights
Investors use MarketPulse to receive AI-analyzed financial news, understand market dynamics, get investment advice, and aid in decision-making. - Developers learn AI and financial data processing
Developers can study the code and learn how to integrate Google Gemini AI, Finnhub APIs, and push services, suitable for practices in AI and finance. - Corporate Monitoring Specific Stock News
Companies can configure to follow stock symbols and get relevant news analysis for strategic planning or risk management.
QA
- What news feeds does MarketPulse support?
By default, Finnhub gets its news, with support for configuring trusted sources such as Reuters, Bloomberg, etc., as described in theconfig.py
Set in. - Do I need to pay for an API?
Yes, Finnhub and Gemini APIs require registration for keys, and some features may involve free quotas or paid plans. - How do I avoid duplicate pushes?
Project useapp_state.json
Records processed news IDs and automatically de-duplicates them. - Can it run on a cloud server?
Yes, it is recommended to run it in daemon mode, and it supports Linux, Windows and other systems. - How do I add a new feature?
Fork the repository, modify the code and submit a Pull Request. it is recommended to check the Issues page first to understand the community needs.