Closed ajmalazeez007 closed 3 years ago
Use "stopLimitTimeInForce" instead of "timeInForce" and you cant use type parameter in OCO orders.
EXAMPLE
//New OCO (TRADE)
try {
$result=$binance->trade()->postOrderOco([
'symbol'=>'LTCBTC',
'side'=>'SELL',
'quantity'=>'0.1',
'price'=>'200',
'stopPrice'=>'0.1',
'stopLimitPrice'=>'0.1',
'stopLimitTimeInForce'=>'GTC',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
When I try OCO order with sample code provided, I get the following error.
Array ( [code] => -1104 [msg] => Not all sent parameters were read; read '7' parameter(s) but was sent '9'. [_method] => POST [_url] => https://api.binance.com/api/v3/order/ocosymbol=LTCBTC&side=SELL&type=LIMIT&quantity=0.1&price=200&stopPrice=0.1&timeInForce=GTC×tamp=1623257733000 [_httpcode] => 400 )
So I modified the code as by removing type and timeInForce after referring to officila Binance documentation, I get the below error.
Array ( [code] => -1013 [msg] => Stop loss orders are not supported for this symbol. [_method] => POST [_url] => https://api.binance.com/api/v3/order/ocosymbol=LTCBTC&side=SELL&quantity=0.1&price=200&stopPrice=0.1×tamp=1623257816000 [_httpcode] => 400 )
What is the fix for his?