Skip to content

Commit ce65826

Browse files
committed
orderAmendments() added
1 parent 29d1f01 commit ce65826

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

php-binance-api.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,6 +3644,38 @@ public function commissionRate(string $symbol, array $params = []) {
36443644
return $this->apiRequest("v3/account/commission", 'GET', array_merge($request, $params), true);
36453645
}
36463646

3647+
/**
3648+
* orderAmendments - Get all amendments of a single order
3649+
*
3650+
* @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#query-order-amendments-user_data
3651+
*
3652+
* @property int $weight 4
3653+
*
3654+
* @param string $symbol (mandatory) The symbol, e.g. BTCUSDT
3655+
* @param string $orderId (mandatory) The ID of the order
3656+
* @param string $fromExecutionId (optional) The ID of the execution to start from
3657+
* @param int $limit (optional) The number of results to return (default is 500, max is 1000)
3658+
*
3659+
* @return array with error message or the rate limit details
3660+
* @throws \Exception
3661+
*/
3662+
public function orderAmendments(string $symbol, string $orderId, ?string $fromExecutionId = null, ?int $limit = null, array $params = []) {
3663+
$request = [
3664+
'symbol' => $symbol,
3665+
'orderId' => $orderId,
3666+
];
3667+
3668+
if ($fromExecutionId) {
3669+
$request['fromExecutionId'] = $fromExecutionId;
3670+
}
3671+
3672+
if (!is_null($limit)) {
3673+
$request['limit'] = $limit;
3674+
}
3675+
3676+
return $this->apiRequest("v3/order/amendments", 'GET', array_merge($request, $params), true);
3677+
}
3678+
36473679
/**
36483680
* ocoOrder - Create a new OCO order
36493681
*

tests/BinanceStaticTests.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,24 @@ public function testCommissionRate()
11671167
parse_str($queryString, $params);
11681168

11691169
$this->assertEquals($this->symbol, $params['symbol']);
1170+
}
1171+
1172+
public function testOrderAmendments()
1173+
{
1174+
try {
1175+
$this->binance->orderAmendments($this->symbol, $this->orderId);
1176+
1177+
} catch (\Throwable $e) {
1178+
1179+
}
1180+
$endpoint = "https://api.binance.com/api/v3/order/amendments?";
1181+
$this->assertTrue(str_starts_with(self::$capturedUrl, $endpoint));
11701182

1183+
$queryString = substr(self::$capturedUrl, strlen($endpoint));
1184+
parse_str($queryString, $params);
1185+
1186+
$this->assertEquals($this->symbol, $params['symbol']);
1187+
$this->assertEquals($this->orderId, $params['orderId']);
11711188
}
11721189

11731190
public function testFuturesAccountSnapshot()

0 commit comments

Comments
 (0)