I create stop-limit orders for positions using futures API .It usually works fine ,But in high volatile markets the Stop Limit order not triggered ,and in a another occasion Limit Order partially filled and automatically closed.
What is the reason for this, and how can I avoid this.
This is my function for placing Take profit Limit and Stop Limit orders
def placeTPSLOrder(symbol,side,type,order_quantity,id,price,stopPrice):
ORDER_PATH = '/fapi/v1/order'
BASE_URL = 'https://fapi.binance.com'
tpsl_order_url = urljoin(BASE_URL, ORDER_PATH)
nowtimestamp = int(time.time() * 1000)
paramstpsl = {
'symbol': symbol,
'side': side,
'positionSide':'BOTH',
'type': type,
'timeInForce': 'GTC',
'quantity':order_quantity,
'reduceOnly':'true',
'newClientOrderId':id,
'price':price,
'stopPrice': stopPrice,
'recvWindow': 5000,
'timestamp': nowtimestamp
}