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
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]))
[('3382', '4502')]
backtest
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)))
{'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
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)))
{'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
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.
Metadata
Release files for jquants-pairs-trading 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jquants-pairs-trading-0.1.2.tar.gz | 6.3 kB | Without provenance | Details for jquants-pairs-trading-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jquants_pairs_trading-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for jquants_pairs_trading-0.1.2-py3-none-any.whl |
Total release size: 12.6 kB
Release files / jquants-pairs-trading-0.1.2.tar.gz
| Download URL | jquants-pairs-trading-0.1.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c92e79baf1931b9642ce93ebb16c5e4ecd16624ed2530cec0afdd248d8e11723
|
|
BLAKE2b-256 checksum How to use checksums |
358df20b79856306793d53107e6bf93594c698e32b0be9100a295edfa4d22a82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / jquants_pairs_trading-0.1.2-py3-none-any.whl
| Download URL | jquants_pairs_trading-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6775748295ecc16c489f2829bd9b171e85afc87820eb076b5862c0cebc3a221a
|
|
BLAKE2b-256 checksum How to use checksums |
942afce3b87950c388ceb3646a70fe534ab14d8b5303d4f66f953826d5662ca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Security for jquants-pairs-trading 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.