Replies: 1 comment
-
Good spot I've added your suggestion into Bot.py, Closeposition is used where possible already. Don't think it can be used with Limit orders |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
looking and playing currently with your bot (btw: great job, looks really great) and noticed your note about trailing stop not working.
I looked closer on the trailing stop order logic and noticed possible issue.
You are using "stopPrice" parameter with type='TRAILING_STOP_MARKET' but stopPrice parameter is not used by Binance API for that type. You should use "activationPrice" parameter instead with desired price like take profit. In that case trailing stop loss will be activated with selected callback which is calculated based on current price.
You can push activationPrice as empty parameter which will cause that activation price will be current market price on order submit.
NOTE: Please consider this as suggestion fix and look on it. I was not able to test it yet.
See: https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
Binance-Futures-Trading-Bot/Bot.py
Lines 249 to 267 in 3ff7f4e
Aditional note:
I suggest to use "reduceOnly" or "closePosition" position parameter with TAKE_PROFIT/TAKE_PROFIT_MARKET, STOP/STOP_MARKET and TRAILING_STOP_MARKET. Preferably "reduceOnly" with 100% of trade size to prevent closing existing position and opening new trade in opposite way in case of trade size miscalculation due to rounding, etc.
Beta Was this translation helpful? Give feedback.
All reactions