mfoci


Namemfoci JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/Corrram/mfoci
SummaryNone
upload_time2024-08-10 09:27:15
maintainerNone
docs_urlNone
authorMarcus Rockel
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Factor selection with MFOCI

`mfoci` is a Python package designed for financial analysts and researchers who need to retrieve and analyze stock market data.
 This package implements the MFOCI algorithm for factor selection in financial data. Supported are also LASSO and k-FOCI factor selection methods as well as data retrieval from Fama-French and Yahoo Finance.

## Installation

Install `mfoci` using pip:

```bash
pip install mfoci
```


## Quick Usage

```python
from mfoci import get_fama_french_data, load_stock_returns
from mfoci import select_factors

# Fetch data
tickers = ["MSFT", "AAPL", "NVDA", "AMZN", "META", "GOOG"]
response_vars = load_stock_returns(tickers, start_date="2013-01-02", end_date="2024-01-01")
factors = get_fama_french_data("2013-01-03", end_date="2024-01-01")

# MFOCI factor selection
mfoci_selected, t_values = select_factors(factors, response_vars, "mfoci")
```


## Further usage

```python
from mfoci import get_fama_french_data, load_stock_returns, load_volatility_index
from mfoci import filter_for_common_indices, select_factors

# Fetch Fama-French factors
factors = get_fama_french_data("2004-01-01", end_date="2024-01-01")

# Load stock returns for specific tickers
tickers = ["MSFT", "AAPL", "NVDA", "AMZN", "META", "GOOG"]
response_vars = load_stock_returns(tickers, start_date="2013-01-01", end_date="2024-01-01")

# Load VIX data
response_vars = load_volatility_index("^VIX", start_date="2004-01-01", end_date="2024-01-01")

# Filter for common dates
factors, response_vars = filter_for_common_indices(factors, response_vars)

# Factor selection using LASSO
lasso_selected, coef = select_factors(factors, response_vars, "lasso")

# KFOCI factor selection (ensure Rscript is installed and path is set)
r_path = "C:/Program Files/R/R-4.3.3/bin/x64/Rscript"
kfoci_gauss_selected = select_factors(
    factors, response_vars, "kfoci", r_path=r_path, kernel="rbfdot"
)
kfoci_laplace_selected = select_factors(
    factors, response_vars, "kfoci", r_path=r_path, kernel="laplacedot"
)

# MFOCI factor selection
mfoci_selected, t_values = select_factors(factors, response_vars, "mfoci")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Corrram/mfoci",
    "name": "mfoci",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Marcus Rockel",
    "author_email": "corram@outlook.de",
    "download_url": "https://files.pythonhosted.org/packages/92/5c/b68226d82e34a55df24f0f197eba39312e2e3c6c692d8e4f83f1cb1c5517/mfoci-0.1.6.tar.gz",
    "platform": null,
    "description": "# Factor selection with MFOCI\n\n`mfoci` is a Python package designed for financial analysts and researchers who need to retrieve and analyze stock market data.\n This package implements the MFOCI algorithm for factor selection in financial data. Supported are also LASSO and k-FOCI factor selection methods as well as data retrieval from Fama-French and Yahoo Finance.\n\n## Installation\n\nInstall `mfoci` using pip:\n\n```bash\npip install mfoci\n```\n\n\n## Quick Usage\n\n```python\nfrom mfoci import get_fama_french_data, load_stock_returns\nfrom mfoci import select_factors\n\n# Fetch data\ntickers = [\"MSFT\", \"AAPL\", \"NVDA\", \"AMZN\", \"META\", \"GOOG\"]\nresponse_vars = load_stock_returns(tickers, start_date=\"2013-01-02\", end_date=\"2024-01-01\")\nfactors = get_fama_french_data(\"2013-01-03\", end_date=\"2024-01-01\")\n\n# MFOCI factor selection\nmfoci_selected, t_values = select_factors(factors, response_vars, \"mfoci\")\n```\n\n\n## Further usage\n\n```python\nfrom mfoci import get_fama_french_data, load_stock_returns, load_volatility_index\nfrom mfoci import filter_for_common_indices, select_factors\n\n# Fetch Fama-French factors\nfactors = get_fama_french_data(\"2004-01-01\", end_date=\"2024-01-01\")\n\n# Load stock returns for specific tickers\ntickers = [\"MSFT\", \"AAPL\", \"NVDA\", \"AMZN\", \"META\", \"GOOG\"]\nresponse_vars = load_stock_returns(tickers, start_date=\"2013-01-01\", end_date=\"2024-01-01\")\n\n# Load VIX data\nresponse_vars = load_volatility_index(\"^VIX\", start_date=\"2004-01-01\", end_date=\"2024-01-01\")\n\n# Filter for common dates\nfactors, response_vars = filter_for_common_indices(factors, response_vars)\n\n# Factor selection using LASSO\nlasso_selected, coef = select_factors(factors, response_vars, \"lasso\")\n\n# KFOCI factor selection (ensure Rscript is installed and path is set)\nr_path = \"C:/Program Files/R/R-4.3.3/bin/x64/Rscript\"\nkfoci_gauss_selected = select_factors(\n    factors, response_vars, \"kfoci\", r_path=r_path, kernel=\"rbfdot\"\n)\nkfoci_laplace_selected = select_factors(\n    factors, response_vars, \"kfoci\", r_path=r_path, kernel=\"laplacedot\"\n)\n\n# MFOCI factor selection\nmfoci_selected, t_values = select_factors(factors, response_vars, \"mfoci\")\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.1.6",
    "project_urls": {
        "Documentation": "https://mfoci.readthedocs.io",
        "Homepage": "https://github.com/Corrram/mfoci",
        "Issue Tracker": "https://github.com/Corrram/mfoci/issues",
        "Repository": "https://github.com/Corrram/mfoci"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f02937973e6c99141060dc16548771fafb0d3f9c4bd9825bc287f78b7c1ad665",
                "md5": "3ddee140c00223a5245e9470b814ce3f",
                "sha256": "d4a82ebde9a70849bde8eca856c43bb5fd0ba0062696c429e6f3e65698c3688c"
            },
            "downloads": -1,
            "filename": "mfoci-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3ddee140c00223a5245e9470b814ce3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 17594,
            "upload_time": "2024-08-10T09:27:14",
            "upload_time_iso_8601": "2024-08-10T09:27:14.212925Z",
            "url": "https://files.pythonhosted.org/packages/f0/29/37973e6c99141060dc16548771fafb0d3f9c4bd9825bc287f78b7c1ad665/mfoci-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "925cb68226d82e34a55df24f0f197eba39312e2e3c6c692d8e4f83f1cb1c5517",
                "md5": "f0b8afdc63060222dd1fe409597a4937",
                "sha256": "3ded3e112a7011d146998c6b25d4ce88d0053e6291474745c183babaa3fad888"
            },
            "downloads": -1,
            "filename": "mfoci-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "f0b8afdc63060222dd1fe409597a4937",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 31884,
            "upload_time": "2024-08-10T09:27:15",
            "upload_time_iso_8601": "2024-08-10T09:27:15.724780Z",
            "url": "https://files.pythonhosted.org/packages/92/5c/b68226d82e34a55df24f0f197eba39312e2e3c6c692d8e4f83f1cb1c5517/mfoci-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-10 09:27:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Corrram",
    "github_project": "mfoci",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mfoci"
}
        
Elapsed time: 0.54735s