From fb1f0ab6b60fea65313cc86767dd7a1266b61783 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Jul 2022 14:43:48 +0200 Subject: [PATCH] Release v1.2.0 (#6) --- CHANGELOG.md | 13 ++++++++- examples/spot/margin/marginDustLog.php | 21 ++++++++++++++ examples/spot/wallet/userAsset.php | 15 ++++++++++ src/Binance/Spot/Convert.php | 2 +- src/Binance/Spot/Margin.php | 16 +++++++++++ src/Binance/Spot/Wallet.php | 16 +++++++++++ tests/spot/margin/MarginDustLog.php | 40 ++++++++++++++++++++++++++ tests/spot/wallet/UserAssetTest.php | 40 ++++++++++++++++++++++++++ 8 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 examples/spot/margin/marginDustLog.php create mode 100644 examples/spot/wallet/userAsset.php create mode 100644 tests/spot/margin/MarginDustLog.php create mode 100644 tests/spot/wallet/UserAssetTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f1c46..0e0c161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # CHANGELOG +## 1.2.0 - 2022-07-19 + +### Added + +- New endpoint `POST /sapi/v3/asset/getUserAsset` +- New endpoint `GET /sapi/v1/margin/dribblet` + +### Update + +- Updated endpoint `GET /sapi/v1/convert/tradeFlow` weight + ## 1.1.0 - 2022-07-07 ### Add @@ -23,4 +34,4 @@ - Lint fix ## 1.0.0 - 2022-05-19 -- First release \ No newline at end of file +- First release diff --git a/examples/spot/margin/marginDustLog.php b/examples/spot/margin/marginDustLog.php new file mode 100644 index 0000000..2ffb06c --- /dev/null +++ b/examples/spot/margin/marginDustLog.php @@ -0,0 +1,21 @@ + $key, + 'secret' => $secret +]); + +$response = $client->marginDustLog( + [ + 'startTime' => 1640995200000, + 'endTime' => 1640995200000, + 'recvWindow' => 5000 + ] +); + +echo json_encode($response); diff --git a/examples/spot/wallet/userAsset.php b/examples/spot/wallet/userAsset.php new file mode 100644 index 0000000..e1e7610 --- /dev/null +++ b/examples/spot/wallet/userAsset.php @@ -0,0 +1,15 @@ + $key, + 'secret' => $secret +]); + +$response = $client->userAsset(); + +echo json_encode($response); diff --git a/src/Binance/Spot/Convert.php b/src/Binance/Spot/Convert.php index ecd83f2..30a1c07 100644 --- a/src/Binance/Spot/Convert.php +++ b/src/Binance/Spot/Convert.php @@ -11,7 +11,7 @@ trait Convert * * - The max interval between startTime and endTime is 30 days. * - * Weight(UID): 3000 + * Weight(UID): 100 * * @param int $startTime * @param int $endTime diff --git a/src/Binance/Spot/Margin.php b/src/Binance/Spot/Margin.php index b57e956..eb7c6ea 100644 --- a/src/Binance/Spot/Margin.php +++ b/src/Binance/Spot/Margin.php @@ -1009,4 +1009,20 @@ public function marginOrderCountUsage(array $options = []) { return $this->signRequest('GET', '/sapi/v1/margin/rateLimit/order', $options); } + + /** + * Margin Dustlog (USER_DATA) + * + * GET /sapi/v1/margin/dribblet + * + * Query the historical information of user's margin account small-value asset conversion BNB. + * + * Weight(IP): 1 + * + * @param array $options + */ + public function marginDustLog(array $options = []) + { + return $this->signRequest('GET', '/sapi/v1/margin/dribblet', $options); + } } diff --git a/src/Binance/Spot/Wallet.php b/src/Binance/Spot/Wallet.php index e2e3ebb..0ca00af 100644 --- a/src/Binance/Spot/Wallet.php +++ b/src/Binance/Spot/Wallet.php @@ -427,6 +427,22 @@ public function universalTransfer(string $type, string $asset, $amount, array $o )); } + /** + * User Asset (USER_DATA) + * + * POST /sapi/v3/asset/getUserAsset + * + * Get user assets, just for positive data. + * + * Weight(IP): 5 + * + * @param array $options + */ + public function userAsset(array $options = []) + { + return $this->signRequest('POST', '/sapi/v3/asset/getUserAsset', $options); + } + /** * Funding Wallet (USER_DATA) * diff --git a/tests/spot/margin/MarginDustLog.php b/tests/spot/margin/MarginDustLog.php new file mode 100644 index 0000000..686a4aa --- /dev/null +++ b/tests/spot/margin/MarginDustLog.php @@ -0,0 +1,40 @@ +httpMock + ->shouldReceiveRequest() + ->withUrl(new Expect\Equals('/sapi/v1/margin/dribblet')) + ->withMethod('GET') + ->withQueryParams(new Expect\ArrayEquals([ + 'startTime' => 1640995200000, + 'endTime' => 1640995200000, + 'recvWindow' => 5000 + ])) + ->andRespondWithJson($this->data, $statusCode = 200); + + $response = $this->spotClient->marginDustLog([ + 'startTime' => 1640995200000, + 'endTime' => 1640995200000, + 'recvWindow' => 5000 + ]); + + $this->assertEquals($response, $this->data); + } + + public function tearDown(): void + { + parent::tearDown(); + } +} diff --git a/tests/spot/wallet/UserAssetTest.php b/tests/spot/wallet/UserAssetTest.php new file mode 100644 index 0000000..a174945 --- /dev/null +++ b/tests/spot/wallet/UserAssetTest.php @@ -0,0 +1,40 @@ +httpMock + ->shouldReceiveRequest() + ->withUrl(new Expect\Equals('/sapi/v3/asset/getUserAsset')) + ->withMethod('POST') + ->withQueryParams(new Expect\ArrayEquals([ + 'asset' => 'BTC', + 'needBtcValuation' => 'true', + 'recvWindow' => '5000' + ]), ['timestamp', 'signature']) + ->andRespondWithJson($this->data, $statusCode = 200); + + $response = $this->spotClient->userAsset([ + 'asset' => 'BTC', + 'needBtcValuation' => true, + 'recvWindow' => 5000 + ]); + + $this->assertEquals($response, $this->data); + } + + public function tearDown(): void + { + parent::tearDown(); + } +}