J-Quants / jquants-api-client-python

Apache License 2.0
129 stars 23 forks source link

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

Open hiohiohio opened 1 year ago

hiohiohio commented 1 year ago

Is there an existing issue for this?

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

hiohiohio commented 1 year ago

I personally prefer separation based on class rather than parameter to keep code simple.