|
9 | 9 |
|
10 | 10 | class BinanceLiveTests extends TestCase
|
11 | 11 | {
|
12 |
| - private Binance\API $binance; |
| 12 | + private Binance\API $spotBinance; |
| 13 | + private Binance\API $futuresBinance; |
13 | 14 |
|
14 | 15 | public function setUp(): void {
|
15 |
| - $this->binance = new API('api_key', 'api_secret'); |
16 |
| - $this->binance->useTestnet = true; |
| 16 | + $this->spotBinance = new API('X4BHNSimXOK6RKs2FcKqExquJtHjMxz5hWqF0BBeVnfa5bKFMk7X0wtkfEz0cPrJ', 'x8gLihunpNq0d46F2q0TWJmeCDahX5LMXSlv3lSFNbMI3rujSOpTDKdhbcmPSf2i'); |
| 17 | + $this->spotBinance->useTestnet = true; |
| 18 | + |
| 19 | + $this->futuresBinance = new API('227719da8d8499e8d3461587d19f259c0b39c2b462a77c9b748a6119abd74401', 'b14b935f9cfacc5dec829008733c40da0588051f29a44625c34967b45c11d73c'); |
| 20 | + $this->futuresBinance->useTestnet = true; |
17 | 21 | }
|
18 | 22 | public function testPricesSpot()
|
19 | 23 | {
|
20 |
| - $res = $this->binance->prices(); |
| 24 | + $res = $this->spotBinance->prices(); |
21 | 25 | $this->assertIsArray($res);
|
22 | 26 | $this->assertArrayHasKey('BTCUSDT', $res);
|
23 | 27 | $this->assertIsString($res['BTCUSDT']);
|
24 | 28 | }
|
25 | 29 |
|
26 | 30 | public function testPricesFutures()
|
27 | 31 | {
|
28 |
| - $res = $this->binance->futuresPrices(); |
| 32 | + $res = $this->futuresBinance->futuresPrices(); |
29 | 33 | $this->assertIsArray($res);
|
30 | 34 | $this->assertArrayHasKey('BTCUSDT', $res);
|
31 | 35 | $this->assertIsString($res['BTCUSDT']);
|
32 | 36 | }
|
| 37 | + |
| 38 | + public function testBalanceSpot() |
| 39 | + { |
| 40 | + $res = $this->spotBinance->balances(); |
| 41 | + $this->assertIsArray($res); |
| 42 | + // $this->assertArrayHasKey('USDT', $res); |
| 43 | + // $this->assertIsString($res['USDT']['free']); |
| 44 | + } |
| 45 | + |
| 46 | + public function testBalanceFutures() |
| 47 | + { |
| 48 | + $res = $this->futuresBinance->futuresAccount(); |
| 49 | + $this->assertIsArray($res); |
| 50 | + $assets = $res['assets']; |
| 51 | + $first = $assets[0]; |
| 52 | + $this->assertArrayHasKey('asset', $first); |
| 53 | + $this->assertArrayHasKey('walletBalance', $first); |
| 54 | + } |
33 | 55 | }
|
0 commit comments