plutus-pairtrading


Nameplutus-pairtrading JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2025-01-10 00:10:15
maintainerNone
docs_urlNone
authorFOX Techniques
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PLUTUS: Pair-Trading Toolkit

[![Python](https://img.shields.io/badge/Python-3.10%2B-darkcyan)](https://pypi.org/project/irene-sankey/)
[![PyPI - Version](https://img.shields.io/pypi/v/plutus-pairtrading?label=PyPI%20Version&color=green)](https://pypi.org/project/plutus-pairtrading/)
[![PyPI Downloads](https://static.pepy.tech/badge/plutus-pairtrading)](https://pepy.tech/projects/plutus-pairtrading)
[![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)](https://github.com/fox-techniques/plutus-pairtrading/blob/main/LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-plutus--pairtrading-181717?logo=github)](https://github.com/fox-techniques/plutus-pairtrading)

PLUTUS is a Python-based toolkit for performing pair-trading analysis. This project is designed for educational purposes and provides tools for:

- Fetching and processing financial data.
- Conducting statistical tests (stationarity and cointegration).
- Performing feature engineering.
- Visualizing financial time-series data.


## Table of Contents

- [PLUTUS: Pair-Trading Toolkit](#plutus-pair-trading-toolkit)
  - [Table of Contents](#table-of-contents)
  - [Documentation](#documentation)
  - [Key Features](#key-features)
  - [Installation](#installation)
  - [Quick Start](#quick-start)
  - [Contribution](#contribution)
  - [License](#license)
  
## Documentation

The full documentation is available on **[GitHub Pages](https://fox-techniques.github.io/plutus-pairtrading/)**.

## Key Features

**1. Data Acquisition**

   - Fetch historical financial data using Yahoo Finance API.
   - Store and manage time-series data in a structured format.
   - Combine and preprocess data for analysis.

**2. Statistical Tests**
   - Stationarity Tests

     - Augmented Dickey-Fuller Test (ADF): Tests whether a time series is stationary.
     - Phillips-Perron Test (PP): Handles autocorrelations and heteroskedasticity.
     - KPSS Test: Tests for trend stationarity.

   - Cointegration Tests

       - Engle-Granger Test: Identifies long-term equilibrium relationships.
       - Phillips-Ouliaris Test: Handles residual-based cointegration testing.
       - Johansen Test: Detects multiple cointegration vectors.

**3. Feature Engineering**

  - Compute periodic returns (daily, weekly, monthly).
  - Apply logarithmic and exponential transformations.
  - Calculate correlation matrices and filter securities based on thresholds.
  - Identify cointegrated pairs for pair trading.

**4. Data Visualization**

  - Plot financial time-series data.
  - Generate dual-axis plots for comparing securities.
  - Visualize correlation matrices.
  - Plot autocorrelation and partial autocorrelation.


## Installation

Install **Plutus Pair-Trading Toolkit** using pip:

```bash
pip install plutus-pairtrading
```

> **Note**: Requires Python 3.10 or above.


## Quick Start

Here’s a quick example to use **PLUTUS** pair-trading tookit.

```python
  import plutus_pairtrading.data_acquisitions as dacq
  import plutus_pairtrading.data_generations as dgen
  import plutus_pairtrading.data_visualizations as dviz

  # Fetch stock data for multiple securities
  AAPL_df = dacq.fetch_yahoo_finance_data("AAPL", start_date="2015-01-01", end_date="2021-01-01")
  MSFT_df = dacq.fetch_yahoo_finance_data("MSFT", start_date="2015-01-01", end_date="2021-01-01")
  GOOG_df = dacq.fetch_yahoo_finance_data("GOOG", start_date="2015-01-01", end_date="2021-01-01")
  TSLA_df = dacq.fetch_yahoo_finance_data("TSLA", start_date="2015-01-01", end_date="2021-01-01")

  # Combine the data into a single DataFrame
  stock_df = dacq.combine_dataframes([AAPL_df, MSFT_df, GOOG_df, TSLA_df])

  # Perform pair identification
  pairs_df = dgen.pairs_identification(
      data=stock_df,
      stationarity_method="ADF",
      cointegration_method="phillips-ouliaris",
      stationarity_significance_level=0.05,
      coint_significance_level=0.05,
  )

  # Display the identified pairs
  print(pairs_df)
```

## Contribution

We welcome contributions! Visit our [Github](https://github.com/fox-techniques/plutus-pairtrading) repository, and to contribute:

1. Fork the repository.
2. Create a branch (`git checkout -b feature/NewFeature`).
3. Commit your changes (`git commit -m 'Add NewFeature'`).
4. Push to the branch (`git push origin feature/NewFeature`).
5. Open a Pull Request.


## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/fox-techniques/plutus-pairtrading/blob/main/LICENSE) file for details.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "plutus-pairtrading",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "FOX Techniques",
    "author_email": "ali.nabbi@fox-techniques.com",
    "download_url": "https://files.pythonhosted.org/packages/12/29/792bb024a5600a60dc640bc64da9e5a504a14dac30dcae3917e46a7bc320/plutus_pairtrading-1.1.1.tar.gz",
    "platform": null,
    "description": "# PLUTUS: Pair-Trading Toolkit\n\n[![Python](https://img.shields.io/badge/Python-3.10%2B-darkcyan)](https://pypi.org/project/irene-sankey/)\n[![PyPI - Version](https://img.shields.io/pypi/v/plutus-pairtrading?label=PyPI%20Version&color=green)](https://pypi.org/project/plutus-pairtrading/)\n[![PyPI Downloads](https://static.pepy.tech/badge/plutus-pairtrading)](https://pepy.tech/projects/plutus-pairtrading)\n[![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)](https://github.com/fox-techniques/plutus-pairtrading/blob/main/LICENSE)\n[![GitHub](https://img.shields.io/badge/GitHub-plutus--pairtrading-181717?logo=github)](https://github.com/fox-techniques/plutus-pairtrading)\n\nPLUTUS is a Python-based toolkit for performing pair-trading analysis. This project is designed for educational purposes and provides tools for:\n\n- Fetching and processing financial data.\n- Conducting statistical tests (stationarity and cointegration).\n- Performing feature engineering.\n- Visualizing financial time-series data.\n\n\n## Table of Contents\n\n- [PLUTUS: Pair-Trading Toolkit](#plutus-pair-trading-toolkit)\n  - [Table of Contents](#table-of-contents)\n  - [Documentation](#documentation)\n  - [Key Features](#key-features)\n  - [Installation](#installation)\n  - [Quick Start](#quick-start)\n  - [Contribution](#contribution)\n  - [License](#license)\n  \n## Documentation\n\nThe full documentation is available on **[GitHub Pages](https://fox-techniques.github.io/plutus-pairtrading/)**.\n\n## Key Features\n\n**1. Data Acquisition**\n\n   - Fetch historical financial data using Yahoo Finance API.\n   - Store and manage time-series data in a structured format.\n   - Combine and preprocess data for analysis.\n\n**2. Statistical Tests**\n   - Stationarity Tests\n\n     - Augmented Dickey-Fuller Test (ADF): Tests whether a time series is stationary.\n     - Phillips-Perron Test (PP): Handles autocorrelations and heteroskedasticity.\n     - KPSS Test: Tests for trend stationarity.\n\n   - Cointegration Tests\n\n       - Engle-Granger Test: Identifies long-term equilibrium relationships.\n       - Phillips-Ouliaris Test: Handles residual-based cointegration testing.\n       - Johansen Test: Detects multiple cointegration vectors.\n\n**3. Feature Engineering**\n\n  - Compute periodic returns (daily, weekly, monthly).\n  - Apply logarithmic and exponential transformations.\n  - Calculate correlation matrices and filter securities based on thresholds.\n  - Identify cointegrated pairs for pair trading.\n\n**4. Data Visualization**\n\n  - Plot financial time-series data.\n  - Generate dual-axis plots for comparing securities.\n  - Visualize correlation matrices.\n  - Plot autocorrelation and partial autocorrelation.\n\n\n## Installation\n\nInstall **Plutus Pair-Trading Toolkit** using pip:\n\n```bash\npip install plutus-pairtrading\n```\n\n> **Note**: Requires Python 3.10 or above.\n\n\n## Quick Start\n\nHere\u2019s a quick example to use **PLUTUS** pair-trading tookit.\n\n```python\n  import plutus_pairtrading.data_acquisitions as dacq\n  import plutus_pairtrading.data_generations as dgen\n  import plutus_pairtrading.data_visualizations as dviz\n\n  # Fetch stock data for multiple securities\n  AAPL_df = dacq.fetch_yahoo_finance_data(\"AAPL\", start_date=\"2015-01-01\", end_date=\"2021-01-01\")\n  MSFT_df = dacq.fetch_yahoo_finance_data(\"MSFT\", start_date=\"2015-01-01\", end_date=\"2021-01-01\")\n  GOOG_df = dacq.fetch_yahoo_finance_data(\"GOOG\", start_date=\"2015-01-01\", end_date=\"2021-01-01\")\n  TSLA_df = dacq.fetch_yahoo_finance_data(\"TSLA\", start_date=\"2015-01-01\", end_date=\"2021-01-01\")\n\n  # Combine the data into a single DataFrame\n  stock_df = dacq.combine_dataframes([AAPL_df, MSFT_df, GOOG_df, TSLA_df])\n\n  # Perform pair identification\n  pairs_df = dgen.pairs_identification(\n      data=stock_df,\n      stationarity_method=\"ADF\",\n      cointegration_method=\"phillips-ouliaris\",\n      stationarity_significance_level=0.05,\n      coint_significance_level=0.05,\n  )\n\n  # Display the identified pairs\n  print(pairs_df)\n```\n\n## Contribution\n\nWe welcome contributions! Visit our [Github](https://github.com/fox-techniques/plutus-pairtrading) repository, and to contribute:\n\n1. Fork the repository.\n2. Create a branch (`git checkout -b feature/NewFeature`).\n3. Commit your changes (`git commit -m 'Add NewFeature'`).\n4. Push to the branch (`git push origin feature/NewFeature`).\n5. Open a Pull Request.\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/fox-techniques/plutus-pairtrading/blob/main/LICENSE) file for details.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "1.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33b5588080fd81bb028952c5e8a09e97e36605ae311f99dd251fad4fd535d69b",
                "md5": "9fbfb0c3bfeb684f941ce0671a00a860",
                "sha256": "205d36207411e950f1b43933456587597feafd4d04650180d762a153603b3780"
            },
            "downloads": -1,
            "filename": "plutus_pairtrading-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9fbfb0c3bfeb684f941ce0671a00a860",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 21520,
            "upload_time": "2025-01-10T00:10:12",
            "upload_time_iso_8601": "2025-01-10T00:10:12.712626Z",
            "url": "https://files.pythonhosted.org/packages/33/b5/588080fd81bb028952c5e8a09e97e36605ae311f99dd251fad4fd535d69b/plutus_pairtrading-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1229792bb024a5600a60dc640bc64da9e5a504a14dac30dcae3917e46a7bc320",
                "md5": "54809f0fe127cf89fcf76750eea5d50c",
                "sha256": "91698391950cee05e8fdc99ca8d1f0e70c0cdee06d04dc202eb5db93a11f460d"
            },
            "downloads": -1,
            "filename": "plutus_pairtrading-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "54809f0fe127cf89fcf76750eea5d50c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 17617,
            "upload_time": "2025-01-10T00:10:15",
            "upload_time_iso_8601": "2025-01-10T00:10:15.078791Z",
            "url": "https://files.pythonhosted.org/packages/12/29/792bb024a5600a60dc640bc64da9e5a504a14dac30dcae3917e46a7bc320/plutus_pairtrading-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-10 00:10:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "plutus-pairtrading"
}
        
Elapsed time: 0.38522s