jquants-api-client


Namejquants-api-client JSON
Version 1.6.1 PyPI version JSON
download
home_pagehttps://github.com/J-Quants/jquants-api-client-python
SummaryJ-Quants API Client Library
upload_time2024-01-16 11:50:16
maintainer
docs_urlNone
authorJ-Quants Project Contributors
requires_python>=3.7.1,<4.0.0
licenseApache-2.0
keywords jquants api client j-quants
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jquants-api-client

[![PyPI version](https://badge.fury.io/py/jquants-api-client.svg)](https://badge.fury.io/py/jquants-api-client)

個人投資家向けデータ API 配信サービス「 [J-Quants API](https://jpx-jquants.com/#jquants-api) 」の Python クライアントライブラリです。
J-Quants や API 仕様についての詳細を知りたい方は [公式ウェブサイト](https://jpx-jquants.com/) をご参照ください。
現在、J-Quants API は有償版サービスとして提供されています。

## 使用方法

pip 経由でインストールします。

```shell
pip install jquants-api-client
```

### J-Quants API の利用

To use J-Quants API, you need to "Applications for J-Quants API" from [J-Quants API Web site](https://jpx-jquants.com/?lang=en) and to select a plan.

J-Quants API を利用するためには[J-Quants API の Web サイト](https://jpx-jquants.com/) から「J-Quants API 申し込み」及び利用プランの選択が必要になります。

jquants-api-client-python を使用するためには「J-Quants API ログインページで使用するメールアドレスおよびパスワード」または「J-Quants API メニューページから取得したリフレッシュトークン」が必要になります。必要に応じて下記の Web サイトより取得してください。

[J-Quants API ログインページ](https://jpx-jquants.com/auth/signin/)

### サンプルコード

```python
from datetime import datetime
from dateutil import tz
import jquantsapi

my_mail_address:str = "*****"
my_password: str = "*****"
cli = jquantsapi.Client(mail_address=my_mail_address, password=my_password)
df = cli.get_price_range(
    start_dt=datetime(2022, 7, 25, tzinfo=tz.gettz("Asia/Tokyo")),
    end_dt=datetime(2022, 7, 26, tzinfo=tz.gettz("Asia/Tokyo")),
)
print(df)
```

API レスポンスが Dataframe の形式で取得できます。

```shell
       Code       Date  ...  AdjustmentClose  AdjustmentVolume
0     13010 2022-07-25  ...           3630.0            8100.0
1     13050 2022-07-25  ...           2023.0           54410.0
2     13060 2022-07-25  ...           2001.0          943830.0
3     13080 2022-07-25  ...           1977.5          121300.0
4     13090 2022-07-25  ...          43300.0             391.0
...     ...        ...  ...              ...               ...
4189  99930 2022-07-26  ...           1426.0            5600.0
4190  99940 2022-07-26  ...           2605.0            7300.0
4191  99950 2022-07-26  ...            404.0           13000.0
4192  99960 2022-07-26  ...           1255.0            4000.0
4193  99970 2022-07-26  ...            825.0          133600.0

[8388 rows x 14 columns]
```

より具体的な使用例は [サンプルノートブック(/examples)](examples) をご参照ください。

## 対応 API

### ラッパー群 

J-Quants API の各 API エンドポイントに対応しています。

------------------ Free plan or higher is required ------------------

- get_refresh_token
- get_id_token
- get_listed_info
- get_prices_daily_quotes
- get_fins_statements
- get_fins_announcement

------------------ Light plan or higher is required ------------------

- get_markets_trades_spec
- get_indices_topix

------------------ Standard plan or higher is required ------------------

- get_option_index_option
- get_markets_weekly_margin_interest
- get_markets_short_selling

------------------ Premium plan or higher is required ------------------

- get_markets_breakdown
- get_prices_prices_am
- get_fins_dividend

### ユーティリティ群

業種や市場区分一覧などを返します。

- get_market_segments
- get_17_sectors
- get_33_sectors

日付範囲を指定して一括でデータ取得して、取得したデータを結合して返すようなユーティリティが用意されています。

------------------ Free plan or higher is required ------------------

- get_list
- get_price_range
- get_statements_range

------------------ Standard plan or higher is required ------------------

- get_weekly_margin_range
- get_short_selling_range
- get_index_option_range

------------------ Premium plan or higher is required ------------------

- get_breakdown_range
- get_dividend_range

## 設定

認証用のメールアドレス/パスワードおよびリフレッシュトークンは設定ファイルおよび環境変数を使用して指定することも可能です。
設定は下記の順に読み込まれ、設定項目が重複している場合は後に読み込まれた値で上書きされます。

1. `/content/drive/MyDrive/drive_ws/secret/jquants-api.toml` (Google Colab のみ)
2. `${HOME}/.jquants-api/jquants-api.toml`
3. `jquants-api.toml`
4. `os.environ["JQUANTS_API_CLIENT_CONFIG_FILE"]`
5. `${JQUANTS_API_MAIL_ADDRESS}`, `${JQUANTS_API_PASSWORD}`, `${JQUANTS_API_REFRESH_TOKEN}`

### 設定ファイル例

`jquants-api.toml` は下記のように設定します。

```toml
[jquants-api-client]
mail_address = "*****"
password = "*****"
refresh_token = "*****"
```

## 動作確認

Google Colab および Python 3.11 で動作確認を行っています。
J-Quants API は有償版で継続開発されているため、本ライブラリも今後仕様が変更となる可能性があります。
Python 3.7 サポートは廃止予定です。将来のバージョンではサポート対象外となります。
Please note Python 3.7 support is deprecated.

## 開発

J-Quants API Client の開発に是非ご協力ください。
Github 上で Issue や Pull Request をお待ちしております。

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/J-Quants/jquants-api-client-python",
    "name": "jquants-api-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "jquants,api,client,J-Quants",
    "author": "J-Quants Project Contributors",
    "author_email": "j-quants@jpx.co.jp",
    "download_url": "https://files.pythonhosted.org/packages/87/7e/96cd8abe8e2f313500dd63952fd854441851746142c5fc91d237f50fe04c/jquants_api_client-1.6.1.tar.gz",
    "platform": null,
    "description": "# jquants-api-client\n\n[![PyPI version](https://badge.fury.io/py/jquants-api-client.svg)](https://badge.fury.io/py/jquants-api-client)\n\n\u500b\u4eba\u6295\u8cc7\u5bb6\u5411\u3051\u30c7\u30fc\u30bf API \u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u300c [J-Quants API](https://jpx-jquants.com/#jquants-api) \u300d\u306e Python \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\nJ-Quants \u3084 API \u4ed5\u69d8\u306b\u3064\u3044\u3066\u306e\u8a73\u7d30\u3092\u77e5\u308a\u305f\u3044\u65b9\u306f [\u516c\u5f0f\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8](https://jpx-jquants.com/) \u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002\n\u73fe\u5728\u3001J-Quants API \u306f\u6709\u511f\u7248\u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n\n## \u4f7f\u7528\u65b9\u6cd5\n\npip \u7d4c\u7531\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\n\n```shell\npip install jquants-api-client\n```\n\n### J-Quants API \u306e\u5229\u7528\n\nTo use J-Quants API, you need to \"Applications for J-Quants API\" from [J-Quants API Web site](https://jpx-jquants.com/?lang=en) and to select a plan.\n\nJ-Quants API \u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u306f[J-Quants API \u306e Web \u30b5\u30a4\u30c8](https://jpx-jquants.com/) \u304b\u3089\u300cJ-Quants API \u7533\u3057\u8fbc\u307f\u300d\u53ca\u3073\u5229\u7528\u30d7\u30e9\u30f3\u306e\u9078\u629e\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\n\njquants-api-client-python \u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306f\u300cJ-Quants API \u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8\u3067\u4f7f\u7528\u3059\u308b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304a\u3088\u3073\u30d1\u30b9\u30ef\u30fc\u30c9\u300d\u307e\u305f\u306f\u300cJ-Quants API \u30e1\u30cb\u30e5\u30fc\u30da\u30fc\u30b8\u304b\u3089\u53d6\u5f97\u3057\u305f\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u30c8\u30fc\u30af\u30f3\u300d\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u4e0b\u8a18\u306e Web \u30b5\u30a4\u30c8\u3088\u308a\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n[J-Quants API \u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8](https://jpx-jquants.com/auth/signin/)\n\n### \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\n\n```python\nfrom datetime import datetime\nfrom dateutil import tz\nimport jquantsapi\n\nmy_mail_address:str = \"*****\"\nmy_password: str = \"*****\"\ncli = jquantsapi.Client(mail_address=my_mail_address, password=my_password)\ndf = cli.get_price_range(\n    start_dt=datetime(2022, 7, 25, tzinfo=tz.gettz(\"Asia/Tokyo\")),\n    end_dt=datetime(2022, 7, 26, tzinfo=tz.gettz(\"Asia/Tokyo\")),\n)\nprint(df)\n```\n\nAPI \u30ec\u30b9\u30dd\u30f3\u30b9\u304c Dataframe \u306e\u5f62\u5f0f\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\n\n```shell\n       Code       Date  ...  AdjustmentClose  AdjustmentVolume\n0     13010 2022-07-25  ...           3630.0            8100.0\n1     13050 2022-07-25  ...           2023.0           54410.0\n2     13060 2022-07-25  ...           2001.0          943830.0\n3     13080 2022-07-25  ...           1977.5          121300.0\n4     13090 2022-07-25  ...          43300.0             391.0\n...     ...        ...  ...              ...               ...\n4189  99930 2022-07-26  ...           1426.0            5600.0\n4190  99940 2022-07-26  ...           2605.0            7300.0\n4191  99950 2022-07-26  ...            404.0           13000.0\n4192  99960 2022-07-26  ...           1255.0            4000.0\n4193  99970 2022-07-26  ...            825.0          133600.0\n\n[8388 rows x 14 columns]\n```\n\n\u3088\u308a\u5177\u4f53\u7684\u306a\u4f7f\u7528\u4f8b\u306f [\u30b5\u30f3\u30d7\u30eb\u30ce\u30fc\u30c8\u30d6\u30c3\u30af(/examples)](examples) \u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002\n\n## \u5bfe\u5fdc API\n\n### \u30e9\u30c3\u30d1\u30fc\u7fa4\u3000\n\nJ-Quants API \u306e\u5404 API \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\n\n------------------ Free plan or higher is required ------------------\n\n- get_refresh_token\n- get_id_token\n- get_listed_info\n- get_prices_daily_quotes\n- get_fins_statements\n- get_fins_announcement\n\n------------------ Light plan or higher is required ------------------\n\n- get_markets_trades_spec\n- get_indices_topix\n\n------------------ Standard plan or higher is required ------------------\n\n- get_option_index_option\n- get_markets_weekly_margin_interest\n- get_markets_short_selling\n\n------------------ Premium plan or higher is required ------------------\n\n- get_markets_breakdown\n- get_prices_prices_am\n- get_fins_dividend\n\n### \u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u7fa4\n\n\u696d\u7a2e\u3084\u5e02\u5834\u533a\u5206\u4e00\u89a7\u306a\u3069\u3092\u8fd4\u3057\u307e\u3059\u3002\n\n- get_market_segments\n- get_17_sectors\n- get_33_sectors\n\n\u65e5\u4ed8\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u3066\u4e00\u62ec\u3067\u30c7\u30fc\u30bf\u53d6\u5f97\u3057\u3066\u3001\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3057\u3066\u8fd4\u3059\u3088\u3046\u306a\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n\n------------------ Free plan or higher is required ------------------\n\n- get_list\n- get_price_range\n- get_statements_range\n\n------------------ Standard plan or higher is required ------------------\n\n- get_weekly_margin_range\n- get_short_selling_range\n- get_index_option_range\n\n------------------ Premium plan or higher is required ------------------\n\n- get_breakdown_range\n- get_dividend_range\n\n## \u8a2d\u5b9a\n\n\u8a8d\u8a3c\u7528\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9/\u30d1\u30b9\u30ef\u30fc\u30c9\u304a\u3088\u3073\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u30c8\u30fc\u30af\u30f3\u306f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u74b0\u5883\u5909\u6570\u3092\u4f7f\u7528\u3057\u3066\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\n\u8a2d\u5b9a\u306f\u4e0b\u8a18\u306e\u9806\u306b\u8aad\u307f\u8fbc\u307e\u308c\u3001\u8a2d\u5b9a\u9805\u76ee\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u5f8c\u306b\u8aad\u307f\u8fbc\u307e\u308c\u305f\u5024\u3067\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u3002\n\n1. `/content/drive/MyDrive/drive_ws/secret/jquants-api.toml` (Google Colab \u306e\u307f)\n2. `${HOME}/.jquants-api/jquants-api.toml`\n3. `jquants-api.toml`\n4. `os.environ[\"JQUANTS_API_CLIENT_CONFIG_FILE\"]`\n5. `${JQUANTS_API_MAIL_ADDRESS}`, `${JQUANTS_API_PASSWORD}`, `${JQUANTS_API_REFRESH_TOKEN}`\n\n### \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u4f8b\n\n`jquants-api.toml` \u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002\n\n```toml\n[jquants-api-client]\nmail_address = \"*****\"\npassword = \"*****\"\nrefresh_token = \"*****\"\n```\n\n## \u52d5\u4f5c\u78ba\u8a8d\n\nGoogle Colab \u304a\u3088\u3073 Python 3.11 \u3067\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\nJ-Quants API \u306f\u6709\u511f\u7248\u3067\u7d99\u7d9a\u958b\u767a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u672c\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u4eca\u5f8c\u4ed5\u69d8\u304c\u5909\u66f4\u3068\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\nPython 3.7 \u30b5\u30dd\u30fc\u30c8\u306f\u5ec3\u6b62\u4e88\u5b9a\u3067\u3059\u3002\u5c06\u6765\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u5bfe\u8c61\u5916\u3068\u306a\u308a\u307e\u3059\u3002\nPlease note Python 3.7 support is deprecated.\n\n## \u958b\u767a\n\nJ-Quants API Client \u306e\u958b\u767a\u306b\u662f\u975e\u3054\u5354\u529b\u304f\u3060\u3055\u3044\u3002\nGithub \u4e0a\u3067 Issue \u3084 Pull Request \u3092\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "J-Quants API Client Library",
    "version": "1.6.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/J-Quants/jquants-api-client-python/issues",
        "Homepage": "https://github.com/J-Quants/jquants-api-client-python"
    },
    "split_keywords": [
        "jquants",
        "api",
        "client",
        "j-quants"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8c0f608701a029f18011384d0b3eda1e9adc6360e496f8423c6ccfc70458713",
                "md5": "70e7f84fe3eef17b48bf3e90bd76fdaf",
                "sha256": "e6c956c8f91783c1dadffabf9be4dbfe3cc9ab006df20ede9647ec71909a56f4"
            },
            "downloads": -1,
            "filename": "jquants_api_client-1.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "70e7f84fe3eef17b48bf3e90bd76fdaf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.1,<4.0.0",
            "size": 20723,
            "upload_time": "2024-01-16T11:50:15",
            "upload_time_iso_8601": "2024-01-16T11:50:15.148602Z",
            "url": "https://files.pythonhosted.org/packages/a8/c0/f608701a029f18011384d0b3eda1e9adc6360e496f8423c6ccfc70458713/jquants_api_client-1.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "877e96cd8abe8e2f313500dd63952fd854441851746142c5fc91d237f50fe04c",
                "md5": "50371cb0dc247381d93251f6b4fe582a",
                "sha256": "41ac07fc18e088e07931546e71dc222225cac62fb7a1770a36655457a4b2774c"
            },
            "downloads": -1,
            "filename": "jquants_api_client-1.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "50371cb0dc247381d93251f6b4fe582a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.1,<4.0.0",
            "size": 21763,
            "upload_time": "2024-01-16T11:50:16",
            "upload_time_iso_8601": "2024-01-16T11:50:16.425121Z",
            "url": "https://files.pythonhosted.org/packages/87/7e/96cd8abe8e2f313500dd63952fd854441851746142c5fc91d237f50fe04c/jquants_api_client-1.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-16 11:50:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "J-Quants",
    "github_project": "jquants-api-client-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jquants-api-client"
}
        
Elapsed time: 0.21499s