alpacahq / alpaca-py

The Official Python SDK for Alpaca API
https://alpaca.markets/sdks/python/getting_started.html
Apache License 2.0
537 stars 134 forks source link

Add polars basic support #485

Open sanurielf opened 2 months ago

sanurielf commented 2 months ago

This PR is to include to_polars function to export data in polars DataFrame format. Basic unittest included also.

sanurielf commented 1 month ago

Hey @hiohiohio this is to add polars support, we currently use polars but the pandas to polars conversion is CPU intensive for large data.

hiohiohio commented 1 month ago

@sanurielf thank you for the PR. Regarding polars and/or design of alpaca-py, wondering points in the below. sorry still lacking confidence to say. a. should we set polars and pandas as optional dependency? i.e. installing with alpaca-py[pandas], alpaca-py[polars]. or we are ok to set pandas/polars as dependencies since usually both are already installed for data related work? b. should we introduce pandas/polars interface into client instead of response model to skip computation of json to pydantic layer? or should we separate raw data client and pydantic/pandas/polars wrapping clients? (keeping pydantic for request model validation)