jquants-pairs-trading


Namejquants-pairs-trading JSON
Version 0.1.2 PyPI version JSON
download
home_page
Summaryjquants-pairs-trading is a python library for backtest with japanese stock pairs trading using kalman filter, J-Quants on Python 3.8 and above.
upload_time2023-10-30 14:27:53
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords pairs trading backtest kalman filter python japanese stock j-quants jquants
VCS
bugtrack_url
requirements certifi charset-normalizer contourpy coverage cycler exceptiongroup fonttools idna importlib-resources iniconfig jquants-api-client kiwisolver matplotlib numpy packaging pandas patsy Pillow pluggy pykalman-bardo pyparsing pytest pytest-cov pytest-mock python-dateutil pytz requests scipy seaborn six statsmodels tenacity tomli types-python-dateutil types-requests types-urllib3 tzdata urllib3 zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jquants-pairs-trading

[![PyPI](https://img.shields.io/pypi/v/jquants-pairs-trading)](https://pypi.org/project/jquants-pairs-trading/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/gh/10mohi6/jquants-pairs-trading-python/graph/badge.svg?token=X8QKKFK6AL)](https://codecov.io/gh/10mohi6/jquants-pairs-trading-python)
[![Python package](https://github.com/10mohi6/jquants-pairs-trading-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/10mohi6/jquants-pairs-trading-python/actions/workflows/python-package.yml)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jquants-pairs-trading)](https://pypi.org/project/jquants-pairs-trading/)
[![Downloads](https://pepy.tech/badge/jquants-pairs-trading)](https://pepy.tech/project/jquants-pairs-trading)

jquants-pairs-trading is a python library for backtest with japanese stock pairs trading using kalman filter, J-Quants on Python 3.8 and above.


## Installation

    $ pip install jquants-pairs-trading

## Usage

### find pairs

```python
from jquants_pairs_trading import JquantsPairsTrading
import pprint

jpt = JquantsPairsTrading(
    mail_address="<your J-Quants mail address>",
    password="<your J-Quants password>",
)
pprint.pprint(jpt.find_pairs([3382, 4063, 4502]))
```

![pairs.png](https://raw.githubusercontent.com/10mohi6/jquants-pairs-trading-python/main/tests/pairs.png)

```python
[('3382', '4502')]
```

### backtest

```python
from jquants_pairs_trading import JquantsPairsTrading
import pprint

jpt = JquantsPairsTrading(
    mail_address="<your J-Quants mail address>",
    password="<your J-Quants password>",
)
pprint.pprint(jpt.backtest((3382, 4502)))
```

![performance.png](https://raw.githubusercontent.com/10mohi6/jquants-pairs-trading-python/main/tests/performance.png)

```python
{'cointegration': '0.016',
 'correlation': '0.814',
 'maximum_drawdown': '443.000',
 'profit_factor': '1.654',
 'riskreward_ratio': '1.081',
 'sharpe_ratio': '0.183',
 'total_profit': '2184.000',
 'total_trades': '86.000',
 'win_rate': '0.605'}
```

### latest signal

```python
from jquants_pairs_trading import JquantsPairsTrading
import pprint

jpt = JquantsPairsTrading(
    mail_address="<your J-Quants mail address>",
    password="<your J-Quants password>",
)
pprint.pprint(jpt.latest_signal((6954, 6981)))
```

```python
{'6954 buy': True,
 '6954 close': '4348.000',
 '6954 long': False,
 '6954 sell': False,
 '6954 short': False,
 '6981 buy': False,
 '6981 close': '2775.000',
 '6981 long': False,
 '6981 sell': True,
 '6981 short': False,
 'date': '2023-07-31'}
```

### advanced

```python
from jquants_pairs_trading import JquantsPairsTrading
import pprint

jpt = JquantsPairsTrading(
    mail_address="<your J-Quants mail address>",
    password="<your J-Quants password>",
    window=1,
    transition_covariance=0.01,
    pvalues=0.05,
    zscore=0.5,
)
pprint.pprint(jpt.find_pairs([3382, 4063, 4502]))
pprint.pprint(jpt.backtest((3382, 4502)))
pprint.pprint(jpt.latest_signal((6954, 6981)))
```

## Getting started

For help getting started with J-Quants, view our online [documentation](https://jpx-jquants.com/).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jquants-pairs-trading",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pairs trading,backtest,kalman filter,python,japanese stock,J-Quants,jquants",
    "author": "",
    "author_email": "10mohi6 <10.mohi.6.y@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/35/8d/f20b79856306793d53107e6bf93594c698e32b0be9100a295edfa4d22a82/jquants-pairs-trading-0.1.2.tar.gz",
    "platform": null,
    "description": "# jquants-pairs-trading\n\n[![PyPI](https://img.shields.io/pypi/v/jquants-pairs-trading)](https://pypi.org/project/jquants-pairs-trading/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![codecov](https://codecov.io/gh/10mohi6/jquants-pairs-trading-python/graph/badge.svg?token=X8QKKFK6AL)](https://codecov.io/gh/10mohi6/jquants-pairs-trading-python)\n[![Python package](https://github.com/10mohi6/jquants-pairs-trading-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/10mohi6/jquants-pairs-trading-python/actions/workflows/python-package.yml)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jquants-pairs-trading)](https://pypi.org/project/jquants-pairs-trading/)\n[![Downloads](https://pepy.tech/badge/jquants-pairs-trading)](https://pepy.tech/project/jquants-pairs-trading)\n\njquants-pairs-trading is a python library for backtest with japanese stock pairs trading using kalman filter, J-Quants on Python 3.8 and above.\n\n\n## Installation\n\n    $ pip install jquants-pairs-trading\n\n## Usage\n\n### find pairs\n\n```python\nfrom jquants_pairs_trading import JquantsPairsTrading\nimport pprint\n\njpt = JquantsPairsTrading(\n    mail_address=\"<your J-Quants mail address>\",\n    password=\"<your J-Quants password>\",\n)\npprint.pprint(jpt.find_pairs([3382, 4063, 4502]))\n```\n\n![pairs.png](https://raw.githubusercontent.com/10mohi6/jquants-pairs-trading-python/main/tests/pairs.png)\n\n```python\n[('3382', '4502')]\n```\n\n### backtest\n\n```python\nfrom jquants_pairs_trading import JquantsPairsTrading\nimport pprint\n\njpt = JquantsPairsTrading(\n    mail_address=\"<your J-Quants mail address>\",\n    password=\"<your J-Quants password>\",\n)\npprint.pprint(jpt.backtest((3382, 4502)))\n```\n\n![performance.png](https://raw.githubusercontent.com/10mohi6/jquants-pairs-trading-python/main/tests/performance.png)\n\n```python\n{'cointegration': '0.016',\n 'correlation': '0.814',\n 'maximum_drawdown': '443.000',\n 'profit_factor': '1.654',\n 'riskreward_ratio': '1.081',\n 'sharpe_ratio': '0.183',\n 'total_profit': '2184.000',\n 'total_trades': '86.000',\n 'win_rate': '0.605'}\n```\n\n### latest signal\n\n```python\nfrom jquants_pairs_trading import JquantsPairsTrading\nimport pprint\n\njpt = JquantsPairsTrading(\n    mail_address=\"<your J-Quants mail address>\",\n    password=\"<your J-Quants password>\",\n)\npprint.pprint(jpt.latest_signal((6954, 6981)))\n```\n\n```python\n{'6954 buy': True,\n '6954 close': '4348.000',\n '6954 long': False,\n '6954 sell': False,\n '6954 short': False,\n '6981 buy': False,\n '6981 close': '2775.000',\n '6981 long': False,\n '6981 sell': True,\n '6981 short': False,\n 'date': '2023-07-31'}\n```\n\n### advanced\n\n```python\nfrom jquants_pairs_trading import JquantsPairsTrading\nimport pprint\n\njpt = JquantsPairsTrading(\n    mail_address=\"<your J-Quants mail address>\",\n    password=\"<your J-Quants password>\",\n    window=1,\n    transition_covariance=0.01,\n    pvalues=0.05,\n    zscore=0.5,\n)\npprint.pprint(jpt.find_pairs([3382, 4063, 4502]))\npprint.pprint(jpt.backtest((3382, 4502)))\npprint.pprint(jpt.latest_signal((6954, 6981)))\n```\n\n## Getting started\n\nFor help getting started with J-Quants, view our online [documentation](https://jpx-jquants.com/).\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "jquants-pairs-trading is a python library for backtest with japanese stock pairs trading using kalman filter, J-Quants on Python 3.8 and above.",
    "version": "0.1.2",
    "project_urls": {
        "Documentation": "https://github.com/10mohi6/jquants-pairs-trading-python",
        "Homepage": "https://github.com/10mohi6/jquants-pairs-trading-python",
        "Repository": "https://github.com/10mohi6/jquants-pairs-trading-python.git"
    },
    "split_keywords": [
        "pairs trading",
        "backtest",
        "kalman filter",
        "python",
        "japanese stock",
        "j-quants",
        "jquants"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "942afce3b87950c388ceb3646a70fe534ab14d8b5303d4f66f953826d5662ca5",
                "md5": "47b4e0e16e77057e9551e481d33a5bf2",
                "sha256": "6775748295ecc16c489f2829bd9b171e85afc87820eb076b5862c0cebc3a221a"
            },
            "downloads": -1,
            "filename": "jquants_pairs_trading-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "47b4e0e16e77057e9551e481d33a5bf2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6331,
            "upload_time": "2023-10-30T14:27:50",
            "upload_time_iso_8601": "2023-10-30T14:27:50.361581Z",
            "url": "https://files.pythonhosted.org/packages/94/2a/fce3b87950c388ceb3646a70fe534ab14d8b5303d4f66f953826d5662ca5/jquants_pairs_trading-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "358df20b79856306793d53107e6bf93594c698e32b0be9100a295edfa4d22a82",
                "md5": "f1b21e1d924660a45b6f4ab4bccb41d1",
                "sha256": "c92e79baf1931b9642ce93ebb16c5e4ecd16624ed2530cec0afdd248d8e11723"
            },
            "downloads": -1,
            "filename": "jquants-pairs-trading-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f1b21e1d924660a45b6f4ab4bccb41d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6274,
            "upload_time": "2023-10-30T14:27:53",
            "upload_time_iso_8601": "2023-10-30T14:27:53.216459Z",
            "url": "https://files.pythonhosted.org/packages/35/8d/f20b79856306793d53107e6bf93594c698e32b0be9100a295edfa4d22a82/jquants-pairs-trading-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 14:27:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "10mohi6",
    "github_project": "jquants-pairs-trading-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2023.7.22"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.0"
                ]
            ]
        },
        {
            "name": "contourpy",
            "specs": [
                [
                    "==",
                    "1.1.1"
                ]
            ]
        },
        {
            "name": "coverage",
            "specs": [
                [
                    "==",
                    "7.3.2"
                ]
            ]
        },
        {
            "name": "cycler",
            "specs": [
                [
                    "==",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "exceptiongroup",
            "specs": [
                [
                    "==",
                    "1.1.3"
                ]
            ]
        },
        {
            "name": "fonttools",
            "specs": [
                [
                    "==",
                    "4.43.1"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.4"
                ]
            ]
        },
        {
            "name": "importlib-resources",
            "specs": [
                [
                    "==",
                    "6.1.0"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "jquants-api-client",
            "specs": [
                [
                    "==",
                    "1.5.0"
                ]
            ]
        },
        {
            "name": "kiwisolver",
            "specs": [
                [
                    "==",
                    "1.4.5"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.7.3"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.24.4"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "23.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.5.3"
                ]
            ]
        },
        {
            "name": "patsy",
            "specs": [
                [
                    "==",
                    "0.5.3"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "10.0.1"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.3.0"
                ]
            ]
        },
        {
            "name": "pykalman-bardo",
            "specs": [
                [
                    "==",
                    "0.9.7"
                ]
            ]
        },
        {
            "name": "pyparsing",
            "specs": [
                [
                    "==",
                    "3.1.1"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "7.4.2"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    "==",
                    "4.1.0"
                ]
            ]
        },
        {
            "name": "pytest-mock",
            "specs": [
                [
                    "==",
                    "3.11.1"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2023.3.post1"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.10.1"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    "==",
                    "0.13.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "statsmodels",
            "specs": [
                [
                    "==",
                    "0.14.0"
                ]
            ]
        },
        {
            "name": "tenacity",
            "specs": [
                [
                    "==",
                    "8.2.3"
                ]
            ]
        },
        {
            "name": "tomli",
            "specs": [
                [
                    "==",
                    "2.0.1"
                ]
            ]
        },
        {
            "name": "types-python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.19.14"
                ]
            ]
        },
        {
            "name": "types-requests",
            "specs": [
                [
                    "==",
                    "2.31.0.6"
                ]
            ]
        },
        {
            "name": "types-urllib3",
            "specs": [
                [
                    "==",
                    "1.26.25.14"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2023.3"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "1.26.17"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.17.0"
                ]
            ]
        }
    ],
    "lcname": "jquants-pairs-trading"
}
        
Elapsed time: 0.14985s