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

Add additional keys to the binary_flag dictionary in the util.data_format file #9

Open
timothyareed opened this issue Oct 22, 2022 · 1 comment

Comments

@timothyareed
Copy link

timothyareed commented Oct 22, 2022

First of all, this is an excellent library and you guys did a great job!

I am pulling some options data from Polygon.IO and then options are labeled as 'CALL' and 'PUT', for this library
they need to be 'c' or 'p', which would require either creating a new DataFrame column or renaming the current column.
which really doesn't add much more time on our side, but can easily be handled in the library. there is a dictionary
"binary_flag" in the util.data_format file that converts the 'c' or 'p' to 1 and -1, I'm proposing adding additional keys to
cover more use cases than just 'c' and 'p'. My current workaround is to simply modify the dictionary after I import the library
as seen below.

import py_vollib_vectorized

Add some key_value pairs to the binary flag dictionary

py_vollib_vectorized.util.data_format.binary_flag['CALL'] = 1
py_vollib_vectorized.util.data_format.binary_flag['PUT'] = -1

@marcdemers
Copy link
Owner

Hi Timothy,

Can you do a simple PR for this? seems pretty straightforward, just make sure to add a test as well!

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

No branches or pull requests

2 participants