|
...
|
...
|
@@ -102,4 +102,40 @@ class Order |
|
|
|
}
|
|
|
|
return $order;
|
|
|
|
}
|
|
|
|
function toBybitOrder(array $symbolInfos, callable $toSymbolOri)
|
|
|
|
{
|
|
|
|
$symbol = call_user_func($toSymbolOri, $this->symbol);
|
|
|
|
/** @var SymbolInfo $symbolInfo */
|
|
|
|
$symbolInfo = $symbolInfos[$this->symbol];
|
|
|
|
$order = [
|
|
|
|
'symbol' => $symbol,
|
|
|
|
'qty' => round($this->qty, $symbolInfo->qtyPrec),
|
|
|
|
'price' => round($this->price, $symbolInfo->pricePrec),
|
|
|
|
'orderLinkId' => $this->cliOrdId,
|
|
|
|
];
|
|
|
|
if ($this->ordType == "MARKET") {
|
|
|
|
$order['orderType'] = "Market";
|
|
|
|
unset($order['price']);
|
|
|
|
}
|
|
|
|
if ($this->ordType == "LIMIT") {
|
|
|
|
$order['timeInForce'] = "GTC";
|
|
|
|
}
|
|
|
|
if ($this->ordType == "IOC") {
|
|
|
|
$order['timeInForce'] = "IOC";
|
|
|
|
$order['orderType'] = "Limit";
|
|
|
|
}
|
|
|
|
if ($this->side == "BUY") {
|
|
|
|
$order['side'] = "Buy";
|
|
|
|
} else {
|
|
|
|
$order['side'] = "Sell";
|
|
|
|
}
|
|
|
|
if ($this->posSide == "LONG") {
|
|
|
|
$order['positionIdx'] = "1";
|
|
|
|
} else if ($this->posSide == "SHORT") {
|
|
|
|
$order['positionIdx'] = "2";
|
|
|
|
} else {
|
|
|
|
$order['positionIdx'] = "0";
|
|
|
|
}
|
|
|
|
return $order;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|