Skip to content

Commit

Permalink
Release v1.2.0 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
tantialex authored Jul 19, 2022
1 parent ed4aa6e commit fb1f0ab
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 2 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,4 +34,4 @@
- Lint fix

## 1.0.0 - 2022-05-19
- First release
- First release
21 changes: 21 additions & 0 deletions examples/spot/margin/marginDustLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require_once __DIR__ . '/../../../vendor/autoload.php';

$key = '';
$secret = '';

$client = new \Binance\Spot([
'key' => $key,
'secret' => $secret
]);

$response = $client->marginDustLog(
[
'startTime' => 1640995200000,
'endTime' => 1640995200000,
'recvWindow' => 5000
]
);

echo json_encode($response);
15 changes: 15 additions & 0 deletions examples/spot/wallet/userAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

require_once __DIR__ . '/../../../vendor/autoload.php';

$key = '';
$secret = '';

$client = new \Binance\Spot([
'key' => $key,
'secret' => $secret
]);

$response = $client->userAsset();

echo json_encode($response);
2 changes: 1 addition & 1 deletion src/Binance/Spot/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/Binance/Spot/Margin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
16 changes: 16 additions & 0 deletions src/Binance/Spot/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down
40 changes: 40 additions & 0 deletions tests/spot/margin/MarginDustLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use Binance\Tests\BaseTestCase;
use Aeris\GuzzleHttpMock\Expect;
use Binance\Exception\MissingArgumentException;

class MarginDustLogTest extends BaseTestCase
{
public function setUp(): void
{
parent::setUp();
}

public function testMarginDustLog()
{
$this->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();
}
}
40 changes: 40 additions & 0 deletions tests/spot/wallet/UserAssetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use Binance\Tests\BaseTestCase;
use Aeris\GuzzleHttpMock\Expect;
use Binance\Exception\MissingArgumentException;

class UserAssetTest extends BaseTestCase
{
public function setUp(): void
{
parent::setUp();
}

public function testUserAsset()
{
$this->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();
}
}

0 comments on commit fb1f0ab

Please sign in to comment.