j-quants / jquants-api-client-python Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
As a user of the jquants-api-client-python library, I would like to request the addition of a JSONClient to provide access to the raw JSON response from the J-Quants API. Currently, the library does not offer an option to access the JSON data directly, as it converts the API responses into Pandas dataframes by default.
By implementing a JSONClient, users who prefer to work with raw JSON data or use other data processing libraries can easily access the API responses in their desired format. This added flexibility will cater to a wider range of use cases and user preferences.
A potential example of how the JSONClient could be used is as follows:
import jquantsapi
my_mail_address = "*****"
my_password = "*****"
json_cli = jquantsapi.JSONClient(mail_address=my_mail_address, password=my_password)
response_json = json_cli.get_prices_daily_quotes(
start_dt=datetime(2022, 7, 25, tzinfo=tz.gettz("Asia/Tokyo")),
end_dt=datetime(2022, 7, 26, tzinfo=tz.gettz("Asia/Tokyo")),
)
In this example, response_json would contain the raw JSON response from the J-Quants API.
Thank you for considering this feature request. Adding a JSONClient would improve the overall user experience of the jquants-api-client-python library by offering greater flexibility and catering to diverse user needs.
No response
No response
No response
https://discord.com/channels/1001344948597178409/1012651918885126195/1087066654732730469
get_statements_rangeがcache_dirのcsv.gzを読み込んだ場合、元のget_fins_statementsが返すdfと型が異なるカラムがあると思うのですが、そこは統一されていた方が個人的にはうれしいなと感じました 😅 今のままでも十分便利なのですが、あくまでもご参考まで 🙇♂️
No response
.
.
No response
get_prices_daily_quotes()のDate列がdatetime型でなくなった。
get_prices_daily_quotes()のDate列がdatetime型である。
v1.1.0
df = jqapi.get_prices_daily_quotes(code)
df['Date'].dtype
> dtype('O')
J-Quants API released the new API endpoint to get market info.
https://jpx.gitbook.io/j-quants-api/api-reference/market-api
No response
No response
No response
current warning in GitHub Actions log.
Warning: The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
poetry install
)make lint
および make lint-fix
についてjquants-api-client-python/CONTRIBUTING.md
Line 24 in 7be06db
jquants-api-client-python/jquantsapi/client.py
Lines 370 to 371 in 3c3c31c
J-Quants API released the new API endpoint for TOPIX data.
Would like to support this new endpoint.
ref. https://jpx.gitbook.io/j-quants-api/api-reference/indices
No response
No response
No response
pandas and numpy are installed and causing dependency conflicts when installing jquants-api-client in Colab.
Installing collected packages: types-urllib3, numpy, types-requests, types-python-dateutil, pandas, jquants-api-client
Attempting uninstall: numpy
Found existing installation: numpy 1.21.6
Uninstalling numpy-1.21.6:
Successfully uninstalled numpy-1.21.6
Attempting uninstall: pandas
Found existing installation: pandas 1.3.5
Uninstalling pandas-1.3.5:
Successfully uninstalled pandas-1.3.5
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
scipy 1.7.3 requires numpy<1.23.0,>=1.16.5, but you have numpy 1.24.1 which is incompatible.
numba 0.56.4 requires numpy<1.24,>=1.18, but you have numpy 1.24.1 which is incompatible.
jquants-api-client-python/pyproject.toml
Lines 33 to 40 in c35ae6e
J-Quants API is officially released
ref. https://jpx.gitbook.io/j-quants-ja
ref. https://jpx.gitbook.io/j-quants-en
リリース手順を記載したドキュメントを用意しておきたいです。
As a user of the jquants-api-client-python library, I would like to request the addition of support for Polars DataFrames as an alternative to the current implementation that returns Pandas DataFrames. Polars is a fast DataFrame library implemented in Rust and Python and has been gaining popularity among users for its performance benefits.
By providing support for Polars DataFrames, users can choose between Pandas and Polars based on their preferences and use case requirements. This added flexibility will cater to a wider range of user needs and improve the overall user experience of the jquants-api-client-python library.
An example of how Polars support could be implemented is as follows:
import jquantsapi
my_mail_address = "*****"
my_password = "*****"
cli = jquantsapi.Client(mail_address=my_mail_address, password=my_password, dataframe_lib="polars")
pl_df = cli.get_prices_daily_quotes(
start_dt=datetime(2022, 7, 25, tzinfo=tz.gettz("Asia/Tokyo")),
end_dt=datetime(2022, 7, 26, tzinfo=tz.gettz("Asia/Tokyo")),
)
In this example, pl_df would contain the data in a Polars DataFrame format instead of a Pandas DataFrame.
Thank you for considering this feature request. Adding support for Polars DataFrames will enhance the jquants-api-client-python library's flexibility, allowing it to cater to a broader range of user needs and preferences.
No response
No response
No response
I am using jquantsapi on python-3.10.
cli = jquantsapi.Client()
df = cli.get_price_range( ... )
get_price_range() dump warnings.
Could you quiet the following messages?
/usr/local/lib/python3.10/site-packages/jquantsapi/client.py:537: FutureWarning: In a future version, `df.iloc[:, i] = newvals` will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either `df[df.columns[i]] = newvals` or, if columns are non-unique, `df.isetitem(i, newvals)`
df.loc[:, "Date"] = pd.to_datetime(df["Date"], format="%Y%m%d")
Downloading whole data every day may not be a good idea.
It takes a lot of times (a few hours).
Support to generated adjusted values using the adjustmentfactor value.
No response
No response
Discordチャンネルとgithubのリポジトリで正しく連携が行われているかの確認をしてほしい。
手順どおりに設定する
No response
No response
CONTRIBUTING.md の記載内容を調節したいです。
Google Colab でインストールすると以下のエラーが発生しています。
エラーを発生させないために requests のバージョン制約を ^2.23.0
としたいです。
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.28.1 which is incompatible.
Successfully installed jquants-api-client-0.1.0 requests-2.28.1 types-python-dateutil-2.8.19 types-requests-2.28.7 types-urllib3-1.26.20
jquants-api-client-python/pyproject.toml
Line 30 in b879a4c
Dear jquants-api-client-python maintainers,
I hope this message finds you well. I am an avid user of your library, and I have a feature request that I believe would greatly enhance its usability.
While the current implementation of jquants-api-client-python allows users to obtain stock market information such as the latest stock prices via Python, I would like to propose adding functionality that enables users to retrieve this information through the command line interface (CLI).
In daily life, there are instances where users may want to quickly access the latest stock prices or other financial information without running a Python script. By incorporating CLI support, users can efficiently obtain the desired data with a simple command.
Here's an example usage of the proposed CLI command:
jquants get-price TickerSymbol --date YYYY-MM-DD
This command would return the stock price for the specified ticker symbol on the specified date.
Additionally, users could request information on multiple stocks simultaneously, like so:
jquants get-prices TickerSymbol1 TickerSymbol2 ... --date YYYY-MM-DD
By implementing this feature, users can quickly obtain the information they need, and it will ultimately improve the overall user experience of the jquants-api-client-python library.
Thank you for considering my request. I look forward to hearing your thoughts on this proposed enhancement.
Best regards,
No response
No response
No response
すべての株価データの取得に手元の環境では4時間以上かかっています。
1時間以内で取得できるように改善したいです。
改善案:
一旦は案1のクライアント側で対処できるかを検証します。
https://pypi.org/project/jquants-api-client/0.1.0/ からこのリポジトリへの導線を提供するために Homepage と Bug Tracker を掲載されるようにしたいです。
pyproject.toml で指定すればよさそうです。
Homepage: https://github.com/J-Quants/jquants-api-client-python
Bug Tracker: https://github.com/J-Quants/jquants-api-client-python/issues
Currently the interfaces of methods are not unified.
No response
No response
No response
J-Quants API に追加される「リフレッシュトークン取得API」に対応したいです。
ref. https://jpx.gitbook.io/j-quants-api/api-reference/refreshtoken
加えて、各種サンプルの更新を実施したいです。
※ サンプル更新については実装の目処がついた段階で別のissueに切り分けますが、一旦はこのissueで管理します。
Python 3.7 will be EOL at Jun 2022. We should put deprecated status into python 3.7 support.
No response
No response
No response
cli.get_statements_range(start_dt=start_dt, end_dt=end_dt)
958
959 if http_error_msg:
--> 960 raise HTTPError(http_error_msg, response=self)
961
962 def close(self):
HTTPError: 413 Client Error: Request Entity Too Large for url: https://api.jquants.com/v1/fins/statements?code=&date=20220513
No response
1.1.1
` cli.get_statements_range(start_dt=start_dt, end_dt=end_dt)`
No response
example notebooks are not working for v0.2.0
No response
jquants-api-client-python v0.2.0
run example notebooks using Google Colab
No response
上場廃止銘柄の銘柄コードで client.get_listed_info()
を使うとクラッシュする。
Traceback (most recent call last):
File "/home/yusuke/garage/finance/stock_analysis/do_filter_by_margins.py", line 64, in <module>
quants()
File "/home/yusuke/garage/finance/stock_analysis/do_filter_by_margins.py", line 45, in quants
info = jqutil.get_listed_info(client, code)
File "/home/yusuke/garage/finance/stock_analysis/jqutil.py", line 39, in get_listed_info
df = client.get_listed_info(code)
File "/home/yusuke/.pyenv/versions/finance/lib/python3.9/site-packages/jquantsapi/client.py", line 371, in get_listed_info
df.loc[df["Sector33Code"] == "50", "Sector33Code"] = "0050"
File "/home/yusuke/.pyenv/versions/finance/lib/python3.9/site-packages/pandas/core/frame.py", line 3805, in __getitem__
indexer = self.columns.get_loc(key)
File "/home/yusuke/.pyenv/versions/finance/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
raise KeyError(key) from err
KeyError: 'Sector33Code'
市場コードに上場廃止に対応するコードを振った上で廃止直前のカテゴリ等を入れておけば良いと思う。
jquants-api 自体が上場廃止を想定していない?
jquants-api-client==0.2.0
現時点だと銘柄コード `6826` で確認できる。
No response
(大変有用な製品の開発・運用をありがとうございます!陰ながら応援させていただきます。)
後述の例の通り、始まりと終わりの年月日を引数として要求するメソッドが複数存在する。それらについて、あるものは datetime
をとり、別のものは str
をとる。
なお、 str
の場合、yyyymmdd
の形式で8桁の数値を str
で要求する。
下記の通り、年月日を要求するメソッドについて、その型を yyyymmdd
形式の str
に統一する事を提案する。
一例として、下記の通り修正のイメージを示す。
jquants-api-client-python/jquantsapi/client.py
Lines 281 to 285 in 7be06db
def get_price_range(
self,
- start_dt: datetime = datetime(2017, 1, 1, tzinfo=tz.gettz("Asia/Tokyo")),
- end_dt: datetime = datetime.now(tz.gettz("Asia/Tokyo")),
+ from_yyyymmdd: str = '20170101',
+ to_yyyymmdd_dt: str = None,
) -> pd.DataFrame:
提案の理由は2つある。
まず1つ目として、型を統一したい理由は、同じ目的で使用する値について、メソッドによって異なる型を要求するのは、混乱の元になるためである。
次に2つ目として、 datatime
ではなく str
を選択した理由は、 datatime
で受け取った値は、 pd.date_range()
に渡されるのみで、他に変換等されていないためである。
pd.date_range()
は8桁の数値で str
を渡しても、 datetime
と同じように解釈してくれる。このため、引数として受け取った str
をそのまま pd.date_range()
に渡しても動作は変わらないと考えられる。よって、 datetime
で引数として受け取らなくても、 str
で必要な情報を得られると考えた。
ここで8桁の数値で str
を渡したときの動作を確認する。以下は、 pd.date_range()
に対して yyyymmdd
形式の8桁の数値で str
を渡した際の挙動である。
pd.date_range('20220101', '20220214')
# =>
DatetimeIndex(['2022-01-01', '2022-01-02', '2022-01-03', '2022-01-04',
'2022-01-05', '2022-01-06', '2022-01-07', '2022-01-08',
'2022-01-09', '2022-01-10', '2022-01-11', '2022-01-12',
'2022-01-13', '2022-01-14', '2022-01-15', '2022-01-16',
'2022-01-17', '2022-01-18', '2022-01-19', '2022-01-20',
'2022-01-21', '2022-01-22', '2022-01-23', '2022-01-24',
'2022-01-25', '2022-01-26', '2022-01-27', '2022-01-28',
'2022-01-29', '2022-01-30', '2022-01-31', '2022-02-01',
'2022-02-02', '2022-02-03', '2022-02-04', '2022-02-05',
'2022-02-06', '2022-02-07', '2022-02-08', '2022-02-09',
'2022-02-10', '2022-02-11', '2022-02-12', '2022-02-13',
'2022-02-14'],
dtype='datetime64[ns]', freq='D')
Google colaboratoryでの実行結果:
上図より、2022年1月1日から同年2月14日までの範囲を、意図通り取り出せていることがわかる。
現在 datetime
として要求するメソッドには、デフォルトと引数としてタイムゾーンが与えられている datetime
がセットされている。これに特別な理由がある場合は、 str
を渡すと想定外の挙動を示す可能性がある。
str
の箇所jquants-api-client-python/jquantsapi/client.py
Lines 229 to 231 in 7be06db
datetime
の箇所jquants-api-client-python/jquantsapi/client.py
Lines 283 to 284 in 7be06db
jquants-api-client-python/jquantsapi/client.py
Lines 422 to 423 in 7be06db
Issue作成時に選択できるテンプレートを作成したいです。
J-Quants API will release new spec of listed/info endpoint on 2022-11-16.
Current jquants-api-client-python does not support the new spec.
ref. https://jpx.gitbook.io/j-quants-api/api-reference/listed-api
No response
v0.1.6
jquantsapi.Client().get_listed_info()
No response
PyPIへのパッケージ登録を自動化したいです。
github でリリースしたタイミングで github actions で連携する想定です。
example notebooks are not working for v0.2.0
No response
jquants-api-client-python v0.2.0
run example notebooks using Google Colab
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.