Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucaswychan/neural-stock-prophet
LSTM-ARIMA with attention mechanism and multiplicative decomposition for sophisticated stock forecasting.
https://github.com/lucaswychan/neural-stock-prophet
arima-forecasting arima-model attention-mechanism keras lstm-neural-networks multiplicative-decomposition risk-analysis risk-parity stock-analysis stock-price-prediction tensorflow
Last synced: 3 days ago
JSON representation
LSTM-ARIMA with attention mechanism and multiplicative decomposition for sophisticated stock forecasting.
- Host: GitHub
- URL: https://github.com/lucaswychan/neural-stock-prophet
- Owner: lucaswychan
- License: mit
- Created: 2024-05-07T15:24:30.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T07:42:05.000Z (about 2 months ago)
- Last Synced: 2024-09-16T09:14:28.533Z (about 2 months ago)
- Topics: arima-forecasting, arima-model, attention-mechanism, keras, lstm-neural-networks, multiplicative-decomposition, risk-analysis, risk-parity, stock-analysis, stock-price-prediction, tensorflow
- Language: Python
- Homepage:
- Size: 6.1 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Neural Stock Prophet
[![PyPI](https://img.shields.io/pypi/v/neuralstockprophet?label=pypi%20package&color)](https://pypi.org/project/neuralstockprophet/)
[![Downloads](https://pepy.tech/badge/neuralstockprophet)](https://www.pepy.tech/projects/neuralstockprophet)
[![GitHub license badge](https://img.shields.io/github/license/lucaswychan/neural-stock-prophet?color=blue)](https://opensource.org/licenses/MIT)**neuralstockprophet** integrates a variety of advanced techniques and algorithms to enhance the robustness, stability, and interoperability of stock price prediction methodologies. By leveraging machine learning, this package aims to accurately forecast the future values of company stocks and other financial assets traded on exchanges. Unlike existing approaches that predominantly focus on model configuration and tuning—often neglecting the inherent variability within the data—NeuralStockProphet addresses these challenges. Furthermore, it effectively mitigates issues related to overfitting and performance constraints that are commonly encountered in machine learning models.
Combined techniques:
- LSTM model with attention mechanisms
- Multiplicative decomposition
- ARIMA model## Installation
- Stable version
```
pip install neuralstockprophet
```## Getting Started
```python
import neuralstockprophet as nsp
import pandas as pdprophet = nsp.NeuralStockProphet(
stock_names=["AAPL", "GOOGL"],
scaler_func=lambda: MinMaxScaler(feature_range=(0, 1)),
train_start_date="2010-01-01",
train_end_date="2019-12-31",
test_start_date="2020-01-01",
test_end_date="2020-12-31",
)forecasts, real_vals = prophet.forecast()
# Use the forecasted results to design the portfolio and get the assets allocation
portfolio = nsp.RiskParityPortfolio(prices=forecasts)# Evaluate the performance of the portfolio with the forecasted results and the true stock prices
forecast_performance = portfolio.evaluate(forecasts)
real_performance = portfolio.evaluate(real_vals)analyze_result_df = pd.concat([forecast_performance, real_performance], axis=0)
analyze_result_df.index = ["Forecast portfolio", "True portfolio"]
```Get the historical data simply by inputting the stock codes.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/lucaswychan/neural-stock-prophet/blob/main/LICENSE) file for details.
## TODO
There are further improvements that can be made. Please have a look at the [TODO](https://github.com/lucaswychan/neural-stock-prophet/blob/main/TODO).