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

Handle Error From Calling close_position #136

Open
1 task done
haxdds opened this issue Jul 27, 2022 · 1 comment
Open
1 task done

Handle Error From Calling close_position #136

haxdds opened this issue Jul 27, 2022 · 1 comment
Labels
Broker API Relates to the Broker API enhancement New feature or request Trading API Relates to the Trading API

Comments

@haxdds
Copy link
Contributor

haxdds commented Jul 27, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Currently, the API will throw an error if we try to close a position that is does not exist. The SDK does not handle this error, meaning if the user calls close_position on a non-existing position, their code will throw an APIError.

Describe the solution you'd like.

Instead, the SDK should handle this error and return a FailedClosePositionDetails object,

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

@haxdds haxdds added enhancement New feature or request Broker API Relates to the Broker API Trading API Relates to the Trading API labels Jul 27, 2022
@kwilsonmg
Copy link

kwilsonmg commented Mar 27, 2024

I am surprised that this isn't implemented. I imagine that this could be done by wrapping python response = self.delete in a try/except block and raising that exception specifically when the code and message line up. This would be made easier by # 431 as mentioned above. I will probably work on implementing this once that one is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broker API Relates to the Broker API enhancement New feature or request Trading API Relates to the Trading API
Projects
None yet
Development

No branches or pull requests

2 participants