作者 karlet

feat:优化开平仓参数

... ... @@ -146,8 +146,14 @@ class Order
/** @var SymbolInfo $symbolInfo */
$symbolInfo = $symbolInfos[$this->symbol];
$tradeSide = "open";
if (($this->posSide == "SHORT" && $this->side == "BUY") || ($this->posSide == "LONG" && $this->side == "SELL")) {
$side = $this->side;
if ($this->posSide == "SHORT" && $this->side == "BUY") {
$tradeSide = "close";
$side = "SELL";
}
if ($this->posSide == "LONG" && $this->side == "SELL") {
$tradeSide = "close";
$side = "BUY";
}
$timeInForce = "GTC";
if ($this->ordType == "IOC") {
... ... @@ -163,7 +169,7 @@ class Order
'marginMode' => 'crossed',
'marginCoin' => 'USDT',
'symbol' => $symbol,
'side' => strtolower($this->side),
'side' => strtolower($side),
'orderType' => strtolower($this->ordType),
'price' => (string)round($this->price, $symbolInfo->pricePrec),
'size' => (string)round($this->qty, $symbolInfo->qtyPrec),
... ...