This project provides a C++ stock analysis tool that fetches real-time stock data, calculates various technical indicators like Moving Averages, RSI (Relative Strength Index), and Bollinger Bands, and logs buy/sell/hold signals based on these indicators. The project utilizes external APIs (like Alpha Vantage) for fetching market data and is designed to be extended for more complex trading strategies.
- Fetch real-time stock market data.
- Calculate technical indicators:
- Short and Long Simple Moving Averages (SMA).
- Relative Strength Index (RSI).
- Bollinger Bands.
- Log buy/sell/hold signals based on indicator values.
- Simple menu interface to select stocks and view analysis.
- C++: Core programming language.
- cURL: For making HTTP requests to the stock API.
- JSON for Modern C++: For parsing API responses.
- Alpha Vantage API: For fetching stock market data (can be replaced with other APIs if needed).
- Doxygen: Used for generating documentation.
- C++17 or higher.
- cURL library installed.
- JSON for Modern C++ header installed.
- Alpha Vantage API key or another stock market API that supports JSON responses.
-
Clone the repository:
git clone https://github.com/your-username/stock-analysis-tool.git cd stock-analysis-tool
-
Install dependencies:
- Ensure you have
libcurl
and the JSON library for C++ available. - Create a
.env
file in the root directory with your API key:API_KEY=your_api_key_here
- Ensure you have
-
Compile the project:
g++ -o market_data_fetcher src/main.cpp src/strategy.cpp src/utils.cpp -I"C:/curl/include" -I"C:/Users/katka/source/market_data_handler/json" -I"C:/Users/katka/source/trade_strategy_cpp/inc" -L"C:/curl/lib" -lcurl
-
Run the program:
./stock_analysis
-
Once the program is running, you can choose options from the menu:
- Option 1: Display available stocks.
- Option 2: Enter a stock symbol to fetch market data and display trading signals.
- Option 3: Exit the program.
-
The program will fetch stock data, calculate the chosen indicators (SMA, RSI, Bollinger Bands), and log the corresponding buy, sell, or hold signals based on the values.
The project currently uses the Alpha Vantage API to fetch market data. You can replace this API with another one that provides similar functionality. Make sure to adjust the API URL and data parsing logic accordingly.
Contributions are welcome! Feel free to open an issue or submit a pull request for any improvements, bug fixes, or new features. Please ensure that your code follows the existing code style and is well-documented using Doxygen.
This project is licensed under the MIT License.