1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

J-Quants API 使い方【無料アカウント】

Last updated at Posted at 2025-07-15

J-Quantsアカウントの作成と無料プランの登録

Screenshot 2025-07-15 at 15.12.16.png
URL: https://jpx-jquants.com
まずはSignupしてアカウントを作りますが、この登録ではまだ無料枠が使えるようにはならないので注意。

Screenshot 2025-07-15 at 15.23.54.png

ログイン後、プラン表欄に行くと、プランを登録することができます(自分は登録済みなので、「現在登録中のプラン」になっています。)ので、無料Freeを登録しましょう。
Screenshot 2025-07-15 at 15.24.43.png

Pythonでリフレッシュトークン・IDトークンの取得

J-Quants APIではリフレッシュトークンを取得後、そのトークンを使ってさらにIDトークンを取得して、リクエストをします。

# refreshTokenの取得
data={ "mailaddress": MAIL_ADDRESS, "password": PASSWORD }
r_post = requests.post("https://api.jquants.com/v1/token/auth_user", data=json.dumps(data))
REFRESH_TOKEN = r_post.json()["refreshToken"]

# idTokenの取得
r_post = requests.post(f"https://api.jquants.com/v1/token/auth_refresh?refreshtoken={REFRESH_TOKEN}")
idToken = r_post.json()["idToken"]

Pythonで上場銘柄一覧の取得

トークンを取得後、getでリクエストして、Json情報を取得します。このサンプルは上場銘柄一覧をリクエストしています。

import requests
import json

idToken = "YOUR idToken"
headers = {'Authorization': 'Bearer {}'.format(idToken)}
r = requests.get("https://api.jquants.com/v1/listed/info", headers=headers)
r.json()

他にもいろいろリクエストができるので、詳細はDocで。
https://jpx.gitbook.io/j-quants-ja/api-reference/listed_info

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?