Skip to content

Commit

Permalink
Merge pull request #28 from hhxsv5/master
Browse files Browse the repository at this point in the history
Fix docs and rename Symbol::getHistoricRates() to Symbol::getKLines()
  • Loading branch information
谢彪 authored Mar 7, 2019
2 parents d1e7f69 + 7909726 commit b3c3e15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ $api->subscribePublicChannel($query, $channel, function (array $message, WebSock
| KuCoin\SDK\PrivateApi\Account::getDetail() | YES | https://docs.kucoin.com/#get-an-account |
| KuCoin\SDK\PrivateApi\Account::getLedgers() | YES | https://docs.kucoin.com/#get-account-ledgers |
| KuCoin\SDK\PrivateApi\Account::getHolds() | YES | https://docs.kucoin.com/#get-holds |
| KuCoin\SDK\PrivateApi\Account::innerTransfer() | YES | https://docs.kucoin.com/#inner-tranfer |
| KuCoin\SDK\PrivateApi\Account::innerTransfer() | YES | https://docs.kucoin.com/#inner-transfer |

</details>

Expand Down Expand Up @@ -195,7 +195,7 @@ $api->subscribePublicChannel($query, $channel, function (array $message, WebSock
| KuCoin\SDK\PublicApi\Symbol::getAggregatedFullOrderBook() | NO | https://docs.kucoin.com/#get-full-order-book-aggregated |
| KuCoin\SDK\PublicApi\Symbol::getAtomicFullOrderBook() | NO | https://docs.kucoin.com/#get-full-order-book-atomic |
| KuCoin\SDK\PublicApi\Symbol::getTradeHistories() | NO | https://docs.kucoin.com/#get-trade-histories |
| KuCoin\SDK\PublicApi\Symbol::getHistoricRates() | NO | https://docs.kucoin.com/#get-historic-rates |
| KuCoin\SDK\PublicApi\Symbol::getKLines() | NO | https://docs.kucoin.com/#get-klines |
| KuCoin\SDK\PublicApi\Symbol::get24HStats() | NO | https://docs.kucoin.com/#get-24hr-stats |
| KuCoin\SDK\PublicApi\Symbol::getMarkets() | NO | https://docs.kucoin.com/#get-market-list |

Expand Down
8 changes: 4 additions & 4 deletions src/PublicApi/Symbol.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ public function getTradeHistories($symbol)
}

/**
* Get historic rates
* Get KLines for a symbol. Data are returned in grouped buckets based on requested type.
* @param string $symbol
* @param int $beginAt
* @param int $startAt
* @param int $endAt
* @param string $type
* @return array
* @throws \KuCoin\SDK\Exceptions\BusinessException
* @throws \KuCoin\SDK\Exceptions\HttpException
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
*/
public function getHistoricRates($symbol, $beginAt, $endAt, $type)
public function getKLines($symbol, $startAt, $endAt, $type)
{
$response = $this->call(
Request::METHOD_GET,
'/api/v1/market/candles',
compact('symbol', 'beginAt', 'endAt', 'type')
compact('symbol', 'startAt', 'endAt', 'type')
);
return $response->getApiData();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/SymbolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ public function testGetHistories(Symbol $api)
* @throws \KuCoin\SDK\Exceptions\HttpException
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
*/
public function testGetHistoricRates(Symbol $api)
public function testGetKLines(Symbol $api)
{
$data = $api->getHistoricRates('ETH-BTC', time() - 24 * 3600 * 7 * 3, time(), '8hour');
$data = $api->getKLines('ETH-BTC', time() - 24 * 3600 * 7 * 3, time(), '8hour');
$this->assertInternalType('array', $data);
foreach ($data as $item) {
//[ "time","open","close","high","low","volume","turnover"]
Expand Down

0 comments on commit b3c3e15

Please sign in to comment.