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

how to set a stop loss in binance #780

Open
paulc1983 opened this issue May 12, 2022 · 1 comment
Open

how to set a stop loss in binance #780

paulc1983 opened this issue May 12, 2022 · 1 comment

Comments

@paulc1983
Copy link

hi

i get this error submitting a stop order or binance.:
Parameter 'timeInForce' sent when not required.

that is submitting it as stop with isBuy = false.

I have looked at the code and set ispostonly = true , or modified the code to prevent the time in force param being added and get:
Binance stop order : ExchangeSharp.APIException: {"code":-1106,"msg":"Parameter 'price' sent when not required."}

whats the correct way to set a stop loss in binance?

I modified the code to change the type of order to 'STOP_LOSS_LIMIT' and added :
if (order.OrderType == OrderType.Stop)
payload["stopPrice"] = order.StopPrice;

this works. should i create a branch with these changes and raise a pr or is there a better way to do this using the existing 'STOP_LOSS' type?

@vslee
Copy link
Collaborator

vslee commented May 12, 2022

You could probably incorporate fixes for both STOP_LOSS and STOP_LOSS_LIMIT. First, do a refactor rename to the enum OrderType.Stop to StopMarket. Then, add another enum member OrderType.StopLimit. And then you can make the fixes you proposed above, as well as likely editing the line where timeInForce is set.
Go ahead send a PR and we'll get it merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants