Git Product home page Git Product logo

jquants-api-client-python's People

Contributors

a-sugiyama-digima avatar dakimura avatar dependabot[bot] avatar dogwood008 avatar drillan avatar hiohiohio avatar m-yamasaki17 avatar s-meitoma avatar t-shinno avatar tak0721 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquants-api-client-python's Issues

feat: generate adjusted values (price/volume) from cached data

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Downloading whole data every day may not be a good idea.
It takes a lot of times (a few hours).

Describe the solution you'd like.

Support to generated adjusted values using the adjustmentfactor value.

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

feat: Add CLI Command Functionality to jquants-api-client-python Library

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

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,

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

[Bug]: fix example notebooks for v0.2.0 part2

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

example notebooks are not working for v0.2.0

Expected Behavior

No response

SDK Version I encountered this issue in

jquants-api-client-python v0.2.0

Steps To Reproduce

run example notebooks using Google Colab

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

Discord webhook test

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Discordチャンネルとgithubのリポジトリで正しく連携が行われているかの確認をしてほしい。

Describe the solution you'd like.

手順どおりに設定する

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

データ取得時間の改善

すべての株価データの取得に手元の環境では4時間以上かかっています。
1時間以内で取得できるように改善したいです。

改善案:

  1. クライアント側で並行処理
  2. API側のレスポンス改善 (エンドポイントの追加含む)

一旦は案1のクライアント側で対処できるかを検証します。

ISSUE_TEMPLATEを作成したい

Issue作成時に選択できるテンプレートを作成したいです。

  • バグレポート
  • 機能追加リクエスト
  • 質問

[Bug]: get_statements_range

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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

Expected Behavior

No response

SDK Version I encountered this issue in

1.1.1

Steps To Reproduce

` cli.get_statements_range(start_dt=start_dt, end_dt=end_dt)`

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

fix: adjust dependencies for Colab env

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.

pandas = [
{ version = "~1.3.5", python = ">=3.7.1,<3.8" },
{ version = "^1.4.3", python = ">=3.8" }
]
numpy = [
{ version = "~1.21.6", python = ">=3.7.1,<3.8" },
{ version = "^1.23.1", python = ">=3.8" }
]

[Bug]: get_fins_statements type mismatch between cached and non-cached

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

https://discord.com/channels/1001344948597178409/1012651918885126195/1087066654732730469

get_statements_rangeがcache_dirのcsv.gzを読み込んだ場合、元のget_fins_statementsが返すdfと型が異なるカラムがあると思うのですが、そこは統一されていた方が個人的にはうれしいなと感じました 😅 今のままでも十分便利なのですが、あくまでもご参考まで 🙇‍♂️

Expected Behavior

No response

SDK Version I encountered this issue in

.

Steps To Reproduce

.

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

feat: Add JSONClient to allow access to raw JSON response from J-Quants API

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

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.

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

[Question]: FutureWarning on python-3.10

Question form pre-submit checklist.

  • I have searched the existing issues to ensure there isn't already an issue about this question.
  • My question has to do with the Python SDK and isn't a general question about the API. (If it is please open your issue in J-Quants API Community on Slack)
  • My question isn't about how to do a specific algorithm or asking for trade advice (answers to these are outside the scope of this repo).

Question

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")

feat: support index endpoint

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

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

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

[Bug]:get_prices_daily_quotes()のDate列がdatetime型でなくなった

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

get_prices_daily_quotes()のDate列がdatetime型でなくなった。

Expected Behavior

get_prices_daily_quotes()のDate列がdatetime型である。

SDK Version I encountered this issue in

v1.1.0

Steps To Reproduce

df = jqapi.get_prices_daily_quotes(code)
df['Date'].dtype
> dtype('O')

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

3ab9845#r108375830

Relax the requests dependency

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

requests = "^2.28.1"

feat: unified interfaces improvements

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Currently the interfaces of methods are not unified.

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

[Bug]: fix: support new spec of listed/info endpoints

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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

Expected Behavior

No response

SDK Version I encountered this issue in

v0.1.6

Steps To Reproduce

jquantsapi.Client().get_listed_info()

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

feat: Add support for Polars DataFrames as an alternative to Pandas DataFrames

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

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.

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

年月日を引数にとるメソッドについて、その型を統一したい

(大変有用な製品の開発・運用をありがとうございます!陰ながら応援させていただきます。)

背景

後述の例の通り、始まりと終わりの年月日を引数として要求するメソッドが複数存在する。それらについて、あるものは datetime をとり、別のものは str をとる。

なお、 str の場合、yyyymmdd の形式で8桁の数値を str で要求する。

提案

提案の内容

下記の通り、年月日を要求するメソッドについて、その型を yyyymmdd 形式の str に統一する事を提案する。

一例として、下記の通り修正のイメージを示す。

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")),
) -> pd.DataFrame:

 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での実行結果:

image

上図より、2022年1月1日から同年2月14日までの範囲を、意図通り取り出せていることがわかる。

検討が必要な点

現在 datetime として要求するメソッドには、デフォルトと引数としてタイムゾーンが与えられている datetime がセットされている。これに特別な理由がある場合は、 str を渡すと想定外の挙動を示す可能性がある。

年月日を引数として受け取る例

str の箇所

from_yyyymmdd: str = "",
to_yyyymmdd: str = "",
date_yyyymmdd: str = "",

self, code: str = "", date_yyyymmdd: str = ""

datetime の箇所

start_dt: datetime = datetime(2017, 1, 1, tzinfo=tz.gettz("Asia/Tokyo")),
end_dt: datetime = datetime.now(tz.gettz("Asia/Tokyo")),

start_dt: datetime = datetime(2017, 1, 1, tzinfo=tz.gettz("Asia/Tokyo")),
end_dt: datetime = datetime.now(tz.gettz("Asia/Tokyo")),

[Bug]: `client.get_listed_info` で上場廃止銘柄を正しく処理できていない

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

上場廃止銘柄の銘柄コードで 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'

Expected Behavior

市場コードに上場廃止に対応するコードを振った上で廃止直前のカテゴリ等を入れておけば良いと思う。

jquants-api 自体が上場廃止を想定していない?

SDK Version I encountered this issue in

jquants-api-client==0.2.0

Steps To Reproduce

現時点だと銘柄コード `6826` で確認できる。

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

[Bug]: fix example notebooks for v0.2.0 part1

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

example notebooks are not working for v0.2.0

Expected Behavior

No response

SDK Version I encountered this issue in

jquants-api-client-python v0.2.0

Steps To Reproduce

run example notebooks using Google Colab

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

fix: set Python 3.7 is deprecated

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Python 3.7 will be EOL at Jun 2022. We should put deprecated status into python 3.7 support.

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.