Skip to content

Commit 522f162

Browse files
authored
Merge pull request #13 from hhxsv5/master
Fix recent fills
2 parents 844b585 + 369a6d8 commit 522f162

File tree

4 files changed

+48
-59
lines changed

4 files changed

+48
-59
lines changed

src/PrivateApi/Fill.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ public function getList($orderId, $symbolId, array $pagination = [])
2828
return $response->getApiData();
2929
}
3030

31+
/**
32+
* Get the recent fills of the latest transactions within 24 hours.
33+
* @return array
34+
* @throws \KuCoin\SDK\Exceptions\BusinessException
35+
* @throws \KuCoin\SDK\Exceptions\HttpException
36+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
37+
*/
38+
public function getRecentList()
39+
{
40+
$response = $this->call(Request::METHOD_GET, '/api/v1/limit/fills');
41+
return $response->getApiData();
42+
}
3143
}

src/PrivateApi/Order.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,13 @@ public function getDetail($orderId)
8686
}
8787

8888
/**
89-
* Get the limited fills of the latest transactions within 24 hours.
89+
* Get the recent orders of the latest transactions within 24 hours.
9090
* @return array
9191
* @throws \KuCoin\SDK\Exceptions\BusinessException
9292
* @throws \KuCoin\SDK\Exceptions\HttpException
9393
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
9494
*/
95-
public function getLimitFills()
96-
{
97-
$response = $this->call(Request::METHOD_GET, '/api/v1/limit/fills');
98-
return $response->getApiData();
99-
}
100-
101-
/**
102-
* Get the limited orders of the latest transactions within 24 hours.
103-
* @return array
104-
* @throws \KuCoin\SDK\Exceptions\BusinessException
105-
* @throws \KuCoin\SDK\Exceptions\HttpException
106-
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
107-
*/
108-
public function getLimitOrders()
95+
public function getRecentList()
10996
{
11097
$response = $this->call(Request::METHOD_GET, '/api/v1/limit/orders');
11198
return $response->getApiData();

tests/FillTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,35 @@ public function testGetList(Fill $api)
5757
$this->assertArrayHasKey('tradeId', $item);
5858
}
5959
}
60+
61+
/**
62+
* @depends testNewFill
63+
* @param Fill $api
64+
* @throws \KuCoin\SDK\Exceptions\BusinessException
65+
* @throws \KuCoin\SDK\Exceptions\HttpException
66+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
67+
*/
68+
public function testGetRecentList(Fill $api)
69+
{
70+
$items = $api->getRecentList();
71+
foreach ($items as $item) {
72+
$this->assertArrayHasKey('symbol', $item);
73+
$this->assertArrayHasKey('side', $item);
74+
$this->assertArrayHasKey('forceTaker', $item);
75+
$this->assertArrayHasKey('orderId', $item);
76+
$this->assertArrayHasKey('fee', $item);
77+
$this->assertArrayHasKey('feeCurrency', $item);
78+
$this->assertArrayHasKey('liquidity', $item);
79+
$this->assertArrayHasKey('type', $item);
80+
$this->assertArrayHasKey('feeRate', $item);
81+
$this->assertArrayHasKey('counterOrderId', $item);
82+
$this->assertArrayHasKey('createdAt', $item);
83+
$this->assertArrayHasKey('displayType', $item);
84+
$this->assertArrayHasKey('size', $item);
85+
$this->assertArrayHasKey('stop', $item);
86+
$this->assertArrayHasKey('price', $item);
87+
$this->assertArrayHasKey('funds', $item);
88+
$this->assertArrayHasKey('tradeId', $item);
89+
}
90+
}
6091
}

tests/OrderTest.php

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testGetDetail(Order $api, array $orders)
142142
$this->assertArrayHasKey('feeCurrency', $order);
143143
$this->assertArrayHasKey('remark', $order);
144144
$this->assertArrayHasKey('type', $order);
145-
$this->assertArrayHasKey('iceberge', $order);
145+
$this->assertArrayHasKey('iceberg', $order);
146146
$this->assertArrayHasKey('createdAt', $order);
147147
$this->assertArrayHasKey('visibleSize', $order);
148148
$this->assertArrayHasKey('price', $order);
@@ -198,50 +198,9 @@ public function testCancelAll($api)
198198
* @throws \KuCoin\SDK\Exceptions\HttpException
199199
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
200200
*/
201-
public function testGetLimitFills(Order $api)
201+
public function testGetRecentList(Order $api)
202202
{
203-
$items = $api->getLimitFills();
204-
foreach ($items as $item) {
205-
$this->assertArrayHasKey('symbol', $item);
206-
$this->assertArrayHasKey('hidden', $item);
207-
$this->assertArrayHasKey('opType', $item);
208-
$this->assertArrayHasKey('fee', $item);
209-
$this->assertArrayHasKey('channel', $item);
210-
$this->assertArrayHasKey('feeCurrency', $item);
211-
$this->assertArrayHasKey('remark', $item);
212-
$this->assertArrayHasKey('type', $item);
213-
$this->assertArrayHasKey('iceberg', $item);
214-
$this->assertArrayHasKey('createdAt', $item);
215-
$this->assertArrayHasKey('visibleSize', $item);
216-
$this->assertArrayHasKey('price', $item);
217-
$this->assertArrayHasKey('stopTriggered', $item);
218-
$this->assertArrayHasKey('funds', $item);
219-
$this->assertArrayHasKey('id', $item);
220-
$this->assertArrayHasKey('timeInForce', $item);
221-
$this->assertArrayHasKey('side', $item);
222-
$this->assertArrayHasKey('dealSize', $item);
223-
$this->assertArrayHasKey('cancelAfter', $item);
224-
$this->assertArrayHasKey('dealFunds', $item);
225-
$this->assertArrayHasKey('stp', $item);
226-
$this->assertArrayHasKey('postOnly', $item);
227-
$this->assertArrayHasKey('stopPrice', $item);
228-
$this->assertArrayHasKey('size', $item);
229-
$this->assertArrayHasKey('stop', $item);
230-
$this->assertArrayHasKey('cancelExist', $item);
231-
$this->assertArrayHasKey('clientOid', $item);
232-
}
233-
}
234-
235-
/**
236-
* @depends testNewOrder
237-
* @param Order $api
238-
* @throws \KuCoin\SDK\Exceptions\BusinessException
239-
* @throws \KuCoin\SDK\Exceptions\HttpException
240-
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
241-
*/
242-
public function testGetLimitOrders(Order $api)
243-
{
244-
$items = $api->getLimitOrders();
203+
$items = $api->getRecentList();
245204
foreach ($items as $item) {
246205
$this->assertArrayHasKey('symbol', $item);
247206
$this->assertArrayHasKey('hidden', $item);

0 commit comments

Comments
 (0)