Skip to content

Make the library more Options friendly #754

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

majdzadeh
Copy link

@majdzadeh majdzadeh commented May 11, 2025

This pull request contains a number of changes to make the library more Options friendly:

  • Use multiplier for Options instead of hard-coded values
  • Make get_increment() work properly for an Options order

Description by Korbit AI

What change is being made?

Modify the calculation of order value for options by multiplying with a generic multiplier instead of the fixed value of 100 in the _on_filled_order method of strategy_executor.py.

Why are these changes being made?

This change generalizes the code to accommodate different option contract sizes other than the fixed multiplier of 100, enhancing the flexibility and accuracy of the order value calculation for various option types. This approach is necessary to support assets in markets where the multiplier might not be 100, providing a more adaptable solution.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

The multiplier for Option contracts is not always 100. As an example,
the multiplier for Bitcoin Option contracts is `1`.
@majdzadeh majdzadeh requested a review from grzesir as a code owner May 11, 2025 18:07
Copy link
Contributor

korbit-ai bot commented May 11, 2025

Important

Required App Permission Update

Noise Reduction Improvements

This update requests write permissions for Commit Statuses in order to send updates directly to your PRs without adding comments that spam notifications. Visit our changelog to learn more.

Click here to accept the updated permissions

To accept the updated permissions, sufficient privileges are required

Copy link
Contributor

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
lumibot/strategies/strategy_executor.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

majdzadeh added 3 commits May 15, 2025 20:30
The multiplier for Option contracts is not always 100. As an example,
the multiplier for Bitcoin Option contracts is `1`.
Method documentation has been updated with the description for the new
Option contract multiplier.
In case of an Option order, get_increment() shall behave differently;
negative in case of a buy order and untouched in case of sell order.
@majdzadeh majdzadeh changed the title Use multiplier for Options Make the library more Options friendly May 16, 2025
@majdzadeh
Copy link
Author

@grzesir
Whenever you're free, would you please share your thoughts?

@grzesir
Copy link
Contributor

grzesir commented May 17, 2025

@grzesir

Whenever you're free, would you please share your thoughts?

This looks good except for the get increment part. Could you explain your reasoning there?

@majdzadeh
Copy link
Author

This looks good except for the get increment part. Could you explain your reasoning there?

Thanks a lot for your feedback @grzesir
In case of Options, when we sell, we a get a premium therefore, we have a positive cashflow. On the other hand, when we buy, we pay a premium therefore, we have a negative cashflow.

@grzesir
Copy link
Contributor

grzesir commented May 17, 2025

This looks good except for the get increment part. Could you explain your reasoning there?

Thanks a lot for your feedback @grzesir In case of Options, when we sell, we a get a premium therefore, we have a positive cashflow. On the other hand, when we buy, we pay a premium therefore, we have a negative cashflow.

That makes sense, but how is that different from any other asset?

@majdzadeh
Copy link
Author

majdzadeh commented May 17, 2025

That makes sense, but how is that different from any other asset?

Currently and in the context of get_increment(), regardless of the underlying asset of an order, if it is a selling order, we get -order.quantity and if it is a buying order, we get order.quantity. I believe this should be vice versa in the case of an Options order. As a side note, the previous behaviour of the method is kept untouched.

@majdzadeh
Copy link
Author

@grzesir
Kindly let me know if you think a modification is required; otherwise could you please approve the PR? Just to reiterate, the original behaviour of the method (get_increment()) is kept untouched.

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.

2 participants