-
Notifications
You must be signed in to change notification settings - Fork 177
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
feat: add exercise_options_position #414
Conversation
alpaca/trading/client.py
Outdated
@@ -317,6 +321,28 @@ def close_position( | |||
|
|||
return Order(**response) | |||
|
|||
def exercise_option_contract( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exercise_options_position
perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe not as this is what we call it in the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! agreed to rename!
Co-authored-by: Neal Patel <[email protected]>
alpaca/trading/client.py
Outdated
None | ||
""" | ||
symbol_or_contract_id = validate_symbol_or_contract_id(symbol_or_contract_id) | ||
response = self.post( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe response
is unused. Not sure if you wanted to log or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Please let me remove it.
alpaca/common/utils.py
Outdated
if isinstance(symbol_or_contract_id, (UUID, str)): | ||
return symbol_or_contract_id | ||
raise ValueError( | ||
f"symbol_or_contract_id must be a UUID of an contract id or a string of a symbol." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f-string, but there are no interpolated variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Removed.
alpaca/common/utils.py
Outdated
""" | ||
A helper function to eliminate duplicate checks of symbols or contract id. | ||
|
||
If the argument given is a string, assumed to be a symbol name. If a UUID object, assumed to be an contract id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor -> "a contract id'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Fixed!
Context:
Changes: