neuralstockprophet


Nameneuralstockprophet JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryLSTM-ARIMA with attention mechanisms and multiplicative decomposition for sophisticated stock forecasting.
upload_time2024-09-06 08:34:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 LucasChan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords arima lstm attention forecasting multiplicative decomposition stock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Neural Stock Prophet

[![PyPI](https://img.shields.io/pypi/v/neuralstockprophet?label=pypi%20package&color)](https://pypi.org/project/neuralstockprophet/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/neuralstockprophet?color)](https://pypistats.org/packages/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 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](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).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "neuralstockprophet",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Lucas Chan <chanconan@gmail.com>",
    "keywords": "ARIMA, LSTM, attention, forecasting, multiplicative decomposition, stock",
    "author": null,
    "author_email": "Lucas Chan <chanconan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/00/5d/2ef1c9d25cddd68149ce54fe5a410e74614554c07bf411ef98d33a068ad8/neuralstockprophet-0.0.3.tar.gz",
    "platform": null,
    "description": "# Neural Stock Prophet\n\n[![PyPI](https://img.shields.io/pypi/v/neuralstockprophet?label=pypi%20package&color)](https://pypi.org/project/neuralstockprophet/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/neuralstockprophet?color)](https://pypistats.org/packages/neuralstockprophet)\n[![GitHub license badge](https://img.shields.io/github/license/lucaswychan/neural-stock-prophet?color=blue)](https://opensource.org/licenses/MIT)\n\n**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\u2014often neglecting the inherent variability within the data\u2014NeuralStockProphet addresses these challenges. Furthermore, it effectively mitigates issues related to overfitting and performance constraints that are commonly encountered in machine learning models.\n\nCombined techniques:\n\n-   LSTM model with attention mechanisms\n-   Multiplicative decomposition\n-   ARIMA model\n\n## Installation\n\n-   Stable version\n\n```\npip install neuralstockprophet\n```\n\n## Getting Started\n\n```python\nimport neuralstockprophet as nsp\nimport pandas as pd\n\nprophet = nsp.NeuralStockProphet(\n        stock_names=[\"AAPL\", \"GOOGL\"],\n        scaler_func=lambda: MinMaxScaler(feature_range=(0, 1)),\n        train_start_date=\"2010-01-01\",\n        train_end_date=\"2019-12-31\",\n        test_start_date=\"2020-01-01\",\n        test_end_date=\"2020-12-31\",\n    )\n\nforecasts, real_vals = prophet.forecast()\n\n# Use the forecasted results to design the portfolio and get the assets allocation\nportfolio = nsp.RiskParityPortfolio(prices=forecasts)\n\n# Evaluate the performance of the portfolio with the forecasted results and the true stock prices\nforecast_performance = portfolio.evaluate(forecasts)\nreal_performance = portfolio.evaluate(real_vals)\n\nanalyze_result_df = pd.concat([forecast_performance, real_performance], axis=0)\nanalyze_result_df.index = [\"Forecast portfolio\", \"True portfolio\"]\n```\n\nGet the historical data simply by inputting the stock codes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/lucaswychan/neural-stock-prophet/blob/main/LICENSE) file for details.\n\n## TODO\n\nThere are further improvements that can be made. Please have a look at the [TODO](https://github.com/lucaswychan/neural-stock-prophet/blob/main/TODO).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 LucasChan  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "LSTM-ARIMA with attention mechanisms and multiplicative decomposition for sophisticated stock forecasting.",
    "version": "0.0.3",
    "project_urls": {
        "Repository": "https://github.com/lucaswychan/neural-stock-prophet"
    },
    "split_keywords": [
        "arima",
        " lstm",
        " attention",
        " forecasting",
        " multiplicative decomposition",
        " stock"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "40c09a693efa0251bf5fb3ad3e8b9bcfc2c230ef62a90381559f5327804b587b",
                "md5": "31f45763bc72ecedd49911f86dfcca8f",
                "sha256": "0f16d5ea2d7b82c7d17d9849239abe62a60d80190245781393a2ba7c01b05428"
            },
            "downloads": -1,
            "filename": "neuralstockprophet-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "31f45763bc72ecedd49911f86dfcca8f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12968,
            "upload_time": "2024-09-06T08:34:37",
            "upload_time_iso_8601": "2024-09-06T08:34:37.482270Z",
            "url": "https://files.pythonhosted.org/packages/40/c0/9a693efa0251bf5fb3ad3e8b9bcfc2c230ef62a90381559f5327804b587b/neuralstockprophet-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "005d2ef1c9d25cddd68149ce54fe5a410e74614554c07bf411ef98d33a068ad8",
                "md5": "3bc8b4817b6d8d37a26377cba76905e6",
                "sha256": "cc179e07131c9d46f0861e2cdf33c1045f832f19acf11a6edd72f69a2250ddc0"
            },
            "downloads": -1,
            "filename": "neuralstockprophet-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3bc8b4817b6d8d37a26377cba76905e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11109,
            "upload_time": "2024-09-06T08:34:38",
            "upload_time_iso_8601": "2024-09-06T08:34:38.793051Z",
            "url": "https://files.pythonhosted.org/packages/00/5d/2ef1c9d25cddd68149ce54fe5a410e74614554c07bf411ef98d33a068ad8/neuralstockprophet-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 08:34:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lucaswychan",
    "github_project": "neural-stock-prophet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "neuralstockprophet"
}
        
Elapsed time: 2.35031s