JQuants.jl
GitHub repo: https://github.com/ki-chi/JQuants.jl
Overview
A Julia package for using the J-Quants API that provide Japanese listed issues' price and financial information.
You have to register to use the J-Quants API.
Installation
In the Julia REPL:
] JQuants
or
julia> using Pkg; Pkg.add("JQuants")
Example
julia> using JQuants
julia> authorize([YOUR REFRESH TOKEN])
true
julia> fetch(FinsStatements(code="86970")); # Fetch financial statements
API Wrappers
Functions exported from JQuants
:
Base.fetch
โ Methodfetch(api::API, kwargs...)
Fetch data from JQuants API.
Arguments
api::API
: API struct to fetch data fromjson::Bool
: If true, return a vector of the raw JSON strings. The number of elements in the vector is equal to the number of pages of the API response. If false, return a DataFrame. Default is false.
Examples
julia> fetch(ListedInfo(code="72030"));
julia> fetch(ListedInfo(code="72030"), json=true);
JQuants.authorize
โ Functionauthorize(refresh_token::AbstractString)
authorize(emailaddress::AbstractString, password::AbstractString)
Authorize by the refresh token refresh_token
, or the combination of email address emailaddress
and password password
. Return true
after the authorization.
The details of this API are here and here.
This package temporally holds your ID Token and Refresh Token as the package-internal variables. Once authorized, reauthorization is not required until that the process of Julia exits or the tokens expires. You can check your tokens using JQuants.check_refresh_token()
and JQuants.check_id_token()
.
Examples
julia> reftoken = [YOUR REFRESH TOKEN];
julia> authorize(reftoken)
true
julia> email, pass = [YOUR EMAIL ADDRESS], [YOUR PASSWORD]
julia> authorize(email, pass)
true