Neural Stock Prophet
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
import neuralstockprophet as nsp
import pandas as pd
prophet = 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 file for details.
TODO
There are further improvements that can be made. Please have a look at the TODO.
Metadata
Release files for neuralstockprophet 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neuralstockprophet-0.0.3.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neuralstockprophet-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / neuralstockprophet-0.0.3.tar.gz
| Download URL | neuralstockprophet-0.0.3.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc179e07131c9d46f0861e2cdf33c1045f832f19acf11a6edd72f69a2250ddc0
|
|
BLAKE2b-256 checksum How to use checksums |
005d2ef1c9d25cddd68149ce54fe5a410e74614554c07bf411ef98d33a068ad8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / neuralstockprophet-0.0.3-py3-none-any.whl
| Download URL | neuralstockprophet-0.0.3-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f16d5ea2d7b82c7d17d9849239abe62a60d80190245781393a2ba7c01b05428
|
|
BLAKE2b-256 checksum How to use checksums |
40c09a693efa0251bf5fb3ad3e8b9bcfc2c230ef62a90381559f5327804b587b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|