J-Quants API
API Specification(English)J-Quants Website
  • J-Quants APIについて
  • お知らせ
    • データ修正履歴
  • サービス概要
    • プランごとに利用可能なAPIとデータ期間
    • 提供データの更新タイミング
    • API利用までの流れ
  • API仕様
    • API共通の留意事項
    • API仕様書ページの見方
    • リフレッシュトークン取得(/token/auth_user)
    • IDトークン取得(/token/auth_refresh)
    • 上場銘柄一覧(/listed/info)
      • 市場区分コード及び市場区分名
      • 17業種コード及び業種名
      • 33業種コード及び業種名
    • 株価四本値(/prices/daily_quotes)
    • 前場四本値(/prices/prices_am)
    • 投資部門別情報(/markets/trades_spec)
      • 市場名
    • 信用取引週末残高(/markets/weekly_margin_interest)
    • 業種別空売り比率(/markets/short_selling)
    • 売買内訳データ(/markets/breakdown)
    • 取引カレンダー(/markets/trading_calendar)
      • 休日区分
    • 指数四本値(/indices)
      • 配信対象指数コード
    • TOPIX指数四本値(/indices/topix)
    • 財務情報(/fins/statements)
      • 開示書類種別
    • 財務諸表(BS/PL)(/fins/fs_details)
    • 配当金情報(/fins/dividend)
    • 決算発表予定日(/fins/announcement)
    • 日経225オプション四本値(/option/index_option)
    • 先物四本値(/derivatives/futures)
      • 先物商品区分コード
    • オプション四本値(/derivatives/options)
      • オプション商品区分コード
  • FAQ
    • サービスについて
    • 利用目的及びデータの利用について
    • プラン・変更・キャンセルと退会について
    • お支払いについて
    • データについて
    • サービス障害について
    • アカウントについて
  • 🔗関連サイト
GitBook提供
このページ内
  • API概要
  • 本APIの留意点
  • パラメータ及びレスポンス
  • 投資部門別売買状況のデータを取得します
  • データ項目概要
  • APIコールサンプルコード
  1. API仕様

投資部門別情報(/markets/trades_spec)

投資部門別の情報を取得する事ができます

前へ前場四本値(/prices/prices_am)次へ市場名

最終更新 5 か月前

API概要

投資部門別売買状況(株式・金額)のデータを取得することができます。 配信データは下記のページで公表している内容と同一です。データの単位は千円です。

本APIの留意点

  • 2022年4月4日に行われた市場区分見直しに伴い、市場区分に応じた内容となっている統計資料は、 見直し後の市場区分に変更して掲載しています。

  • 過誤訂正により過去の投資部門別売買状況データが訂正された場合は、本APIでは以下のとおりデータを提供します。

    • 2023年4月3日以前に訂正が公表された過誤訂正:訂正前のデータは提供せず、訂正後のデータのみ提供します。

    • 2023年4月3日以降に訂正が公表された過誤訂正:訂正前と訂正後のデータのいずれも提供します。訂正が生じた場合には、市場名、開始日および終了日を同一とするレコードが追加され、公表日が新しいデータが訂正後、公表日が古いデータが訂正前のデータと識別することが可能です。

  • 過誤訂正により過去の投資部門別売買状況データが訂正された場合は、過誤訂正が公表された翌営業日にデータが更新されます。

パラメータ及びレスポンス

データの取得では、セクション(section)または日付(from/to)の指定が可能です。 各パラメータの組み合わせとレスポンスの結果については以下のとおりです。

section
from /to
レスポンスの結果

指定したセクションの指定した期間のデータ

指定したセクションの全期間のデータ

すべてのセクションの指定した期間のデータ 

すべてのセクションの全期間のデータ

セクション(section)で指定可能なパラメータについてはこちらを参照ください。

投資部門別売買状況のデータを取得します

GET https://api.jquants.com/v1/markets/trades_spec

データの取得では、市場(section)または公表日の日付(from/to)が指定できます。

*は必須項目

Query Parameters

Name
Type
Description

section

String

セクション

(e.g. TSEPrime)

from

String

fromの指定

(e.g. 20210901 or 2021-09-01)

to

String

toの指定

(e.g. 20210907 or 2021-09-07)

pagination_key

String

検索の先頭を指定する文字列

過去の検索で返却されたpagination_keyを設定

Headers

Name
Type
Description

Authorization*

String

アクセスキー

{
    "trades_spec": [
        {
            "PublishedDate":"2017-01-13",
            "StartDate":"2017-01-04",
            "EndDate":"2017-01-06",
            "Section":"TSE1st",
            "ProprietarySales":1311271004,
            "ProprietaryPurchases":1453326508,
            "ProprietaryTotal":2764597512,
            "ProprietaryBalance":142055504,
            "BrokerageSales":7165529005,
            "BrokeragePurchases":7030019854,
            "BrokerageTotal":14195548859,
            "BrokerageBalance":-135509151,
            "TotalSales":8476800009,
            "TotalPurchases":8483346362,
            "TotalTotal":16960146371,
            "TotalBalance":6546353,
            "IndividualsSales":1401711615,
            "IndividualsPurchases":1161801155,
            "IndividualsTotal":2563512770,
            "IndividualsBalance":-239910460,
            "ForeignersSales":5094891735,
            "ForeignersPurchases":5317151774,
            "ForeignersTotal":10412043509,
            "ForeignersBalance":222260039,
            "SecuritiesCosSales":76381455,
            "SecuritiesCosPurchases":61700100,
            "SecuritiesCosTotal":138081555,
            "SecuritiesCosBalance":-14681355,
            "InvestmentTrustsSales":168705109,
            "InvestmentTrustsPurchases":124389642,
            "InvestmentTrustsTotal":293094751,
            "InvestmentTrustsBalance":-44315467,
            "BusinessCosSales":71217959,
            "BusinessCosPurchases":63526641,
            "BusinessCosTotal":134744600,
            "BusinessCosBalance":-7691318,
            "OtherCosSales":10745152,
            "OtherCosPurchases":15687836,
            "OtherCosTotal":26432988,
            "OtherCosBalance":4942684,
            "InsuranceCosSales":15926202,
            "InsuranceCosPurchases":9831555,
            "InsuranceCosTotal":25757757,
            "InsuranceCosBalance":-6094647,
            "CityBKsRegionalBKsEtcSales":10606789,
            "CityBKsRegionalBKsEtcPurchases":8843871,
            "CityBKsRegionalBKsEtcTotal":19450660,
            "CityBKsRegionalBKsEtcBalance":-1762918,
            "TrustBanksSales":292932297,
            "TrustBanksPurchases":245322795,
            "TrustBanksTotal":538255092,
            "TrustBanksBalance":-47609502,
            "OtherFinancialInstitutionsSales":22410692,
            "OtherFinancialInstitutionsPurchases":21764485,
            "OtherFinancialInstitutionsTotal":44175177,
            "OtherFinancialInstitutionsBalance":-646207
        }
    ],
    "pagination_key": "value1.value2."
}
{
    "message": "<Error Message>"
}
{
    "message": "The incoming token is invalid or expired."
}
{
    "message": "Missing Authentication Token. The method or resources may not be supported."
}
{
    "message": "Unexpected error. Please try again later."
}
{
    "message": "Response data is too large. Specify parameters to reduce the acquired data range."
}

データ項目概要

変数名
説明
型
備考

PublishedDate

公表日

String

YY-MM-DD

StartDate

開始日

String

YY-MM-DD

EndDate

終了日

String

YY-MM-DD

Section

市場名

String

ProprietarySales

自己計_売

Number

ProprietaryPurchases

自己計_買

Number

ProprietaryTotal

自己計_合計

Number

ProprietaryBalance

自己計_差引

Number

BrokerageSales

委託計_売

Number

BrokeragePurchases

委託計_買

Number

BrokerageTotal

委託計_合計

Number

BrokerageBalance

委託計_差引

Number

TotalSales

総計_売

Number

TotalPurchases

総計_買

Number

TotalTotal

総計_合計

Number

TotalBalance

総計_差引

Number

IndividualsSales

個人_売

Number

IndividualsPurchases

個人_買

Number

IndividualsTotal

個人_合計

Number

IndividualsBalance

個人_差引

Number

ForeignersSales

海外投資家_売

Number

ForeignersPurchases

海外投資家_買

Number

ForeignersTotal

海外投資家_合計

Number

ForeignersBalance

海外投資家_差引

Number

SecuritiesCosSales

証券会社_売

Number

SecuritiesCosPurchases

証券会社_買

Number

SecuritiesCosTotal

証券会社_合計

Number

SecuritiesCosBalance

証券会社_差引

Number

InvestmentTrustsSales

投資信託_売

Number

InvestmentTrustsPurchases

投資信託_買

Number

InvestmentTrustsTotal

投資信託_合計

Number

InvestmentTrustsBalance

投資信託_差引

Number

BusinessCosSales

事業法人_売

Number

BusinessCosPurchases

事業法人_買

Number

BusinessCosTotal

事業法人_合計

Number

BusinessCosBalance

事業法人_差引

Number

OtherCosSales

その他法人_売

Number

OtherCosPurchases

その他法人_買 

Number

OtherCosTotal

その他法人_合計

Number

OtherCosBalance

その他法人_差引

Number

InsuranceCosSales

生保・損保_売

Number

InsuranceCosPurchases

生保・損保_買

Number

InsuranceCosTotal

生保・損保_合計

Number

InsuranceCosBalance

生保・損保_差引

Number

CityBKsRegionalBKsEtcSales

都銀・地銀等_売

Number

CityBKsRegionalBKsEtcPurchases

都銀・地銀等_買

Number

CityBKsRegionalBKsEtcTotal

都銀・地銀等_合計

Number

CityBKsRegionalBKsEtcBalance

都銀・地銀等_差引

Number

TrustBanksSales

信託銀行_売

Number

TrustBanksPurchases

信託銀行_買

Number

TrustBanksTotal

信託銀行_合計

Number

TrustBanksBalance

信託銀行_差引

Number

OtherFinancialInstitutionsSales

その他金融機関_売

Number

OtherFinancialInstitutionsPurchases

その他金融機関_買

Number

OtherFinancialInstitutionsTotal

その他金融機関_合計

Number

OtherFinancialInstitutionsBalance

その他金融機関_差引

Number

APIコールサンプルコード

idToken=<YOUR idToken> && curl https://api.jquants.com/v1/markets/trades_spec?section=TSEPrime&from=20230324&to=20230403 -H "Authorization: Bearer $idToken" 
import requests
import json

idToken = "YOUR idToken"
headers = {'Authorization': 'Bearer {}'.format(idToken)}
r = requests.get("https://api.jquants.com/v1/markets/trades_spec?section=TSEPrime&from=20230324&to=20230403", headers=headers)
r.json()

を参照

https://www.jpx.co.jp/markets/statistics-equities/investor-type/index.html
市場名
市場名