Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helper.filter_data calls helper.convert_dtypes #244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Phillyclause89
Copy link

I really like this lib, but I found it a pain to always have to convert a bunch of strs to numerical data types when I felt like this lib should be giving me this info as floats or ints from the get go. I noticed practically everything gets passed through helper.fliter_data so I thought it would be a nice place fix the type of a few key pieces of data.

When helper.fliter_data is called it will now use helper.convert_dtypes to recursively change str values at specific keys to float or int type. Here is the full list of target keys:

Converts to float:
            "adjusted_mark_price", "ask_price", "bid_price", "break_even_price",
            "high_price", "last_trade_price", "low_price", "mark_price",
            "previous_close_price", "chance_of_profit_long", "chance_of_profit_short",
            "delta", "gamma", "implied_volatility", "rho", "theta", "vega",
            "high_fill_rate_buy_price", "high_fill_rate_sell_price", "low_fill_rate_buy_price",
            "low_fill_rate_sell_price", "last_extended_hours_trade_price", "previous_close",
            "adjusted_previous_close", "below_tick", "above_tick", "estimate", "actual", "cutoff_price",
Converts to int:
            "trade_value_multiplier", "year", "quarter", "ask_size", "bid_size",
            "last_trade_size", "open_interest", "volume",

:param data: The data passed into filter_data.
:returns:  The dict with numerical types for the data from certain keys

When helper.fliter_data is called it will now use helper.convert_dtypes to change str values at specific keys to float or int type. See docstrings of helper.convert_dtypes for full list of target keys.
@Phillyclause89 Phillyclause89 marked this pull request as ready for review February 16, 2021 11:02
some unit test now make assertions about the object types.

More dict keys targeted by helper.convert_dtypes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant