TrendCaster is a stock market prediction system that uses Markov Chains and machine learning to forecast market trends based on historical data. The system analyzes past stock price movements to identify transition probabilities and generate predictive insights, helping traders make more informed decisions.
- Market Trend Forecasting: Predicts stock market trends using Markov Chains.
- Real-Time Data Analysis: Analyzes historical and real-time data to identify market trends.
- Risk Assessment: Provides risk metrics and confidence intervals to aid in decision-making.
- Multiple Simulation Paths: Generates multiple future price simulation paths to assess market movement.
- Directional Accuracy: Achieved 55% directional accuracy, providing insights for better trading strategies.
- Python
- Markov Chains
- scikit-learn
- yfinance
- NumPy
- Pandas
- Matplotlib
To get started with TrendCaster, follow the steps below:
- Clone the repository:
git clone https://github.com/your-username/TrendCaster.git
- Navigate to the project directory:
cd TrendCaster - Run the code file:
StockPred.ipynb
-
Download Historical Stock Data: The system uses the yfinance library to fetch historical stock price data (e.g., AAPL). Adjust the start and end dates as required.
-
Simulate Market Trends: TrendCaster uses a Markov Chain model to simulate future stock price movements based on historical price transitions.
-
Visualize Results: The system generates a graphical representation of the simulated stock prices to visualize potential market trends.
import yfinance as yf
import matplotlib.pyplot as plt
from trendcaster import TrendCaster
# Download historical stock data for Apple (AAPL)
stock_data = yf.download('AAPL', start='2023-11-01', end='2023-12-01')
# Initialize TrendCaster with historical data
trendcaster = TrendCaster(stock_data)
# Simulate stock price for the next 30 days
simulated_dates, simulated_prices = trendcaster.simulate_stock_price(days=30)
# Plot simulated prices
plt.plot(simulated_dates, simulated_prices, label='Simulated Prices')
plt.xlabel('Days')
plt.ylabel('Price')
plt.title('Simulated Stock Price Movement')
plt.legend()
plt.show()We welcome contributions to improve TrendCaster! If you have ideas, improvements, or bug fixes, feel free to fork the repository, create a new branch, and submit a pull request.
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-name). - Create a new pull request.
This project is licensed under the GNU v3.0 License - see the LICENSE file for details.