|
@@ -73,7 +73,7 @@ class Order |
|
@@ -73,7 +73,7 @@ class Order |
|
73
|
}
|
73
|
}
|
|
74
|
return $order;
|
74
|
return $order;
|
|
75
|
}
|
75
|
}
|
|
76
|
- function toBinanceOrder(array $symbolInfos, callable $toSymbolOri)
|
76
|
+ public function toBinanceOrder(array $symbolInfos, callable $toSymbolOri)
|
|
77
|
{
|
77
|
{
|
|
78
|
$symbol = call_user_func($toSymbolOri, $this->symbol);
|
78
|
$symbol = call_user_func($toSymbolOri, $this->symbol);
|
|
79
|
/** @var SymbolInfo $symbolInfo */
|
79
|
/** @var SymbolInfo $symbolInfo */
|
|
@@ -102,7 +102,7 @@ class Order |
|
@@ -102,7 +102,7 @@ class Order |
|
102
|
}
|
102
|
}
|
|
103
|
return $order;
|
103
|
return $order;
|
|
104
|
}
|
104
|
}
|
|
105
|
- function toBybitOrder(array $symbolInfos, callable $toSymbolOri)
|
105
|
+ public function toBybitOrder(array $symbolInfos, callable $toSymbolOri)
|
|
106
|
{
|
106
|
{
|
|
107
|
$symbol = call_user_func($toSymbolOri, $this->symbol);
|
107
|
$symbol = call_user_func($toSymbolOri, $this->symbol);
|
|
108
|
/** @var SymbolInfo $symbolInfo */
|
108
|
/** @var SymbolInfo $symbolInfo */
|
|
@@ -140,4 +140,37 @@ class Order |
|
@@ -140,4 +140,37 @@ class Order |
|
140
|
}
|
140
|
}
|
|
141
|
return $order;
|
141
|
return $order;
|
|
142
|
}
|
142
|
}
|
|
|
|
143
|
+ public function toBitgetOrder(array $symbolInfos, callable $toSymbolOri)
|
|
|
|
144
|
+ {
|
|
|
|
145
|
+ $symbol = call_user_func($toSymbolOri, $this->symbol);
|
|
|
|
146
|
+ /** @var SymbolInfo $symbolInfo */
|
|
|
|
147
|
+ $symbolInfo = $symbolInfos[$this->symbol];
|
|
|
|
148
|
+ $tradeSide = "open";
|
|
|
|
149
|
+ if (($this->posSide == "SHORT" && $this->side == "BUY") || ($this->posSide == "LONG" && $this->side == "SELL")) {
|
|
|
|
150
|
+ $tradeSide = "close";
|
|
|
|
151
|
+ }
|
|
|
|
152
|
+ $timeInForce = "GTC";
|
|
|
|
153
|
+ if ($this->ordType == "IOC") {
|
|
|
|
154
|
+ $timeInForce = "IOC";
|
|
|
|
155
|
+ $ordType = "LIMIT";
|
|
|
|
156
|
+ }
|
|
|
|
157
|
+ if ($this->ordType == "FOK") {
|
|
|
|
158
|
+ $timeInForce = "FOK";
|
|
|
|
159
|
+ $ordType = "LIMIT";
|
|
|
|
160
|
+ }
|
|
|
|
161
|
+ $order = [
|
|
|
|
162
|
+ 'productType' => 'USDT-FUTURES',
|
|
|
|
163
|
+ 'marginMode' => 'crossed',
|
|
|
|
164
|
+ 'marginCoin' => 'USDT',
|
|
|
|
165
|
+ 'symbol' => $symbol,
|
|
|
|
166
|
+ 'side' => strtolower($this->side),
|
|
|
|
167
|
+ 'orderType' => strtolower($this->ordType),
|
|
|
|
168
|
+ 'price' => (string)round($this->price, $symbolInfo->pricePrec),
|
|
|
|
169
|
+ 'size' => (string)round($this->qty, $symbolInfo->qtyPrec),
|
|
|
|
170
|
+ 'tradeSide' => $tradeSide,
|
|
|
|
171
|
+ 'force' => $timeInForce,
|
|
|
|
172
|
+ 'clientOid' => $this->cliOrdId,
|
|
|
|
173
|
+ ];
|
|
|
|
174
|
+ return $order;
|
|
|
|
175
|
+ }
|
|
143
|
} |
176
|
} |