Skip to content

Commit 2d7c3bc

Browse files
authored
Merge pull request #89 from bzeron/master
update 1.1.18
2 parents c278f75 + 62f1759 commit 2d7c3bc

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

src/Api.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ abstract class Api
1616
/**
1717
* @var string SDK Version
1818
*/
19-
const VERSION = '1.1.17';
19+
const VERSION = '1.1.18';
20+
21+
/**
22+
* @var string SDK update date
23+
*/
24+
const UPDATE_DATE = '2020.07.13';
2025

2126
/**
2227
* @var string
@@ -136,8 +141,8 @@ public static function getLogger()
136141
{
137142
if (self::$logger === null) {
138143
self::$logger = new Logger('kucoin-sdk');
139-
$handler = new RotatingFileHandler(static::getLogPath() . '/kucoin-sdk.log', 0, static::$logLevel);
140-
$formatter = new LineFormatter(null, null, false, true);
144+
$handler = new RotatingFileHandler(static::getLogPath() . '/kucoin-sdk.log', 0, static::$logLevel);
145+
$formatter = new LineFormatter(null, null, false, true);
141146
$handler->setFormatter($formatter);
142147
self::$logger->pushHandler($handler);
143148
}
@@ -216,7 +221,7 @@ public function call($method, $uri, array $params = [], array $headers = [], $ti
216221
$request->getRequestUri(),
217222
$request->getBodyParams()
218223
);
219-
$headers = array_merge($headers, $authHeaders);
224+
$headers = array_merge($headers, $authHeaders);
220225
}
221226
$headers['User-Agent'] = 'KuCoin-PHP-SDK/' . static::VERSION;
222227

@@ -232,7 +237,7 @@ public function call($method, $uri, array $params = [], array $headers = [], $ti
232237
static::getLogger()->debug(sprintf('Sent a HTTP request#%s: %s', $requestId, $request));
233238
}
234239
$requestStart = microtime(true);
235-
$response = $this->http->request($request, $timeout);
240+
$response = $this->http->request($request, $timeout);
236241
if (self::isDebugMode()) {
237242
$cost = (microtime(true) - $requestStart) * 1000;
238243
static::getLogger()->debug(sprintf('Received a HTTP response#%s: cost %.2fms, %s', $requestId, $cost, $response));

src/PublicApi/Symbol.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ public function getAtomicFullOrderBook($symbol)
9696
return $response->getApiData();
9797
}
9898

99+
/**
100+
* Get full order book(atomic) v2
101+
* @param string $symbol
102+
* @return array
103+
* @throws \KuCoin\SDK\Exceptions\BusinessException
104+
* @throws \KuCoin\SDK\Exceptions\HttpException
105+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
106+
*/
107+
public function getV2AtomicFullOrderBook($symbol)
108+
{
109+
$response = $this->call(Request::METHOD_GET, '/api/v2/market/orderbook/level3', compact('symbol'));
110+
return $response->getApiData();
111+
}
112+
99113
/**
100114
* Get trade histories
101115
* @param string $symbol

tests/SymbolTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ public function testGetAtomicFullOrderBook(Symbol $api)
136136
$this->assertArrayHasKey('time', $data);
137137
}
138138

139+
/**
140+
* @dataProvider apiProvider
141+
* @param Symbol $api
142+
* @throws \KuCoin\SDK\Exceptions\BusinessException
143+
* @throws \KuCoin\SDK\Exceptions\HttpException
144+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
145+
*/
146+
public function testGetV2AtomicFullOrderBook(Symbol $api)
147+
{
148+
$data = $api->getV2AtomicFullOrderBook('ETH-BTC');
149+
$this->assertInternalType('array', $data);
150+
$this->assertArrayHasKey('sequence', $data);
151+
$this->assertArrayHasKey('bids', $data);
152+
$this->assertArrayHasKey('asks', $data);
153+
$this->assertArrayHasKey('time', $data);
154+
}
155+
139156

140157
/**
141158
* @dataProvider apiProvider

0 commit comments

Comments
 (0)