Closed BaseMax closed 2 years ago
<?php // .... $order = [ 'clientOid' => uniqid(), 'price' => '1', 'size' => '1', 'symbol' => 'BTC-USDT', 'type' => 'limit', 'side' => 'sell', 'remark' => 'ORDER#' . time(), ]; try { $result = $api->create($order); var_dump($result); } catch (\Throwable $e) { var_dump($e->getMessage()); }
Here, I am trying to start order with the SELL type. Does everything correct and my code should work? or do I miss understanding something? Does this only work in FEATURES mode? not normal mode? Any kind of help is welcome. Thanks in advance.
You are using the Spot SDK now, I think the parameters are ok. Any questions ? Could you please give me the whole error that KuCoin sent to you?
Thank you for your message, here is the full details:
<?php
$body = [
"clientOid" => uniqid(),
"price" => (string) $close,
"size" => (string) $size,
"symbol" => $ticker_name,
"type" => "limit",
"side" => $type === ORDER_BUY ? "buy" : "sell",
'remark' => 'ORDER#' . time(),
];
$endpoint = 'https://api.kucoin.com';
function request(bool $isTest = false, string $method, string $endpoint, string $route, array $body = []) : string {...}
$res = request(false, "POST", $endpoint, "/api/v1/orders", $body);
Array
(
[clientOid] => 6294eb11426e5
[price] => 1.0817
[size] => 5
[symbol] => GMT-USDT
[type] => limit
[side] => sell
[remark] => ORDER#1653926673
)
{"code":"200004","msg":"Balance insufficient!"}
https://www.kucoin.com/trade/KCS-USDT?spm=....
:
It seems it's not possible to open order with a SELL position.
Q: Opening order with a SELL position only allowed in features MODE?
My problem is fixed, Opening an order with the Sell position is only allowed in Features mode. I switched to features and the error was solved.
Thanks.
Here, I am trying to start order with the SELL type.
Does everything correct and my code should work? or do I miss understanding something?
Does this only work in FEATURES mode? not normal mode?
Any kind of help is welcome. Thanks in advance.