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

Stop as a percent of trade. #74

Closed
arahmed24 opened this issue Jun 21, 2020 · 4 comments
Closed

Stop as a percent of trade. #74

arahmed24 opened this issue Jun 21, 2020 · 4 comments

Comments

@arahmed24
Copy link

Is there a way to submit the stop price as the percent instead of a pre-calculated value? i.e. We want to submit a market order with a stop loss of .1%. Our preference is to submit a stop loss as a percent of the executed price, not calculated based on the current price or close price. Let's take an example. Assume the close price is 100 when we placed a market order which gets filled at 100.99 (executed price), in this case, we want the stop loss to be 100.99*.999 instead of 100 *.999.

Thanks in advance.

@shlomiku
Copy link
Contributor

Hi,
the buy() method is a backtrader method. not alpaca-backtrader-api method.
so, doing a change like this should be done (if decided that it is needed) in the original package

now, why not just have a utility function that calculates those values for you and use it every time you call the buy() method?

@arahmed24
Copy link
Author

Hi

Thank you for a quick response. My vote is to support it as it is good practice to submit stop loss as a percent of the executed price that executes on the server versus the client.

Utility function and pass it to the server in a call? Like a lambda function?

We are thinking of getting around this is by placing an order with stop loss as precalculated value and then go back update the stop loss price when we have the executed price.

Thanks

Hi,
the buy() method is a backtrader method. not alpaca-backtrader-api method.
so, doing a change like this should be done (if decided that it is needed) in the original package

now, why not just have a utility function that calculates those values for you and use it every time you call the buy() method?

@shlomiku
Copy link
Contributor

Hi
if I understand correctly you want a change/addition in the API
so it's not related to this package (you want it on the server side, not the client side)
this is the API
https://alpaca.markets/docs/api-documentation/api-v2/orders/

submit your feature request through the correct channel:
https://alpaca.markets/docs/issues-and-questions/

@shlomiku
Copy link
Contributor

closing due to lack of activity

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