|
1
|
|
|
<?php |
|
2
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\Tests; |
|
3
|
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\BybitAPI; |
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Interfaces\IResponseInterface; |
|
|
|
|
|
|
6
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\GetExecutionList; |
|
7
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\Request\GetExecutionListRequest; |
|
8
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\Response\GetExecutionListResponse; |
|
9
|
|
|
use PHPUnit\Framework\TestCase; |
|
10
|
|
|
|
|
11
|
|
|
class GetExecutionListTest extends TestCase |
|
12
|
|
|
{ |
|
13
|
|
|
public function testSuccessEndpoint() |
|
14
|
|
|
{ |
|
15
|
|
|
$bybit = (new BybitAPI())->setCredentials('https://api-testnet.bybit.com', 'fL02oi5qo8i2jDxlum', 'Ne1EE35XTprIWrId9vGEAc1ZYJTmodA4qFzZ'); |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** @var IResponseInterface $execListEndpointResponse */ |
|
18
|
|
|
$execListEndpointResponse = $bybit->privateEndpoint(GetExecutionList::class, (new GetExecutionListRequest()) |
|
19
|
|
|
->setSymbol('BTCUSDT') |
|
20
|
|
|
->setLimit(3) |
|
21
|
|
|
)->execute(); |
|
22
|
|
|
|
|
23
|
|
|
echo "Return Code: {$execListEndpointResponse->getReturnCode()}\n"; |
|
24
|
|
|
echo "Return Message: {$execListEndpointResponse->getReturnMessage()}\n"; |
|
25
|
|
|
|
|
26
|
|
|
/** @var GetExecutionListResponse $execListInfoResponse */ |
|
27
|
|
|
$execListInfoResponse = $execListEndpointResponse->getResult(); |
|
28
|
|
|
|
|
29
|
|
|
echo "Category: {$execListInfoResponse->getCategory()}\n"; |
|
30
|
|
|
echo "Next Page Cursor: {$execListInfoResponse->getNextPageCursor()}\n"; |
|
31
|
|
|
foreach ($execListInfoResponse->getExecutionList() as $exec) { |
|
32
|
|
|
echo "-----\n"; |
|
33
|
|
|
echo "Symbol: {$exec->getSymbol()}\n"; |
|
34
|
|
|
echo "Side: {$exec->getSide()}\n"; |
|
35
|
|
|
echo "Order ID: {$exec->getOrderId()}\n"; |
|
36
|
|
|
echo "Order Link ID: {$exec->getOrderLinkId()}\n"; |
|
37
|
|
|
echo "Order Price: {$exec->getOrderPrice()}\n"; |
|
38
|
|
|
echo "Order Quantity: {$exec->getOrderQty()}\n"; |
|
39
|
|
|
echo "Order Type: {$exec->getOrderType()}\n"; |
|
40
|
|
|
echo "Stop Order Type: {$exec->getOrderType()}\n"; |
|
41
|
|
|
echo "Execution ID: {$exec->getExecId()}\n"; |
|
42
|
|
|
echo "Execution Price: {$exec->getExecPrice()}\n"; |
|
43
|
|
|
echo "Execution Quantity: {$exec->getExecQty()}\n"; |
|
44
|
|
|
echo "Execution Fee: {$exec->getExecFee()}\n"; |
|
45
|
|
|
echo "Execution Type: {$exec->getExecType()}\n"; |
|
46
|
|
|
echo "Execution Value: {$exec->getExecValue()}\n"; |
|
47
|
|
|
echo "Fee Rate: {$exec->getFeeRate()}\n"; |
|
48
|
|
|
echo "Last Liquidity Ind: {$exec->getLastLiquidityInd()}\n"; |
|
49
|
|
|
echo "Is Maker: {$exec->isMaker()}\n"; |
|
50
|
|
|
echo "Leaves Quantity: {$exec->getLeavesQty()}\n"; |
|
51
|
|
|
echo "Closed Size: {$exec->getClosedSize()}\n"; |
|
52
|
|
|
echo "Mark Price: {$exec->getMarkPrice()}\n"; |
|
53
|
|
|
echo "Index Price {$exec->getIndexPrice()}\n"; |
|
54
|
|
|
echo "Underlying Price: {$exec->getUnderlyingPrice()}\n"; |
|
55
|
|
|
echo "Execution Time: {$exec->getExecTime()->format('Y-m-d H:i:s')}\n"; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Return Code: 0 |
|
60
|
|
|
* Return Message: OK |
|
61
|
|
|
* Category: |
|
62
|
|
|
* Next Page Cursor: page_token%3D91113706%26 |
|
63
|
|
|
* ----- |
|
64
|
|
|
* Symbol: BTCUSDT |
|
65
|
|
|
* Side: Sell |
|
66
|
|
|
* Order ID: 6e60910f-2c60-48c6-916e-c9c6946b3bc9 |
|
67
|
|
|
* Order Link ID: |
|
68
|
|
|
* Order Price: 61022 |
|
69
|
|
|
* Order Quantity: 0.015 |
|
70
|
|
|
* Order Type: Market |
|
71
|
|
|
* Stop Order Type: Market |
|
72
|
|
|
* Execution ID: 9cb193fe-4367-5d70-95e6-2831af76586f |
|
73
|
|
|
* Execution Price: 64225.5 |
|
74
|
|
|
* Execution Quantity: 0.015 |
|
75
|
|
|
* Execution Fee: 0.52986038 |
|
76
|
|
|
* Execution Type: Trade |
|
77
|
|
|
* Execution Value: 963.3825 |
|
78
|
|
|
* Fee Rate: 0.00055 |
|
79
|
|
|
* Last Liquidity Ind: RemovedLiquidity |
|
80
|
|
|
* Is Maker: |
|
81
|
|
|
* Leaves Quantity: 0 |
|
82
|
|
|
* Closed Size: 0.015 |
|
83
|
|
|
* Mark Price: 64235.6 |
|
84
|
|
|
* Index Price 0 |
|
85
|
|
|
* Underlying Price: 0 |
|
86
|
|
|
* Execution Time: 2024-06-22 20:52:39 |
|
87
|
|
|
* ----- |
|
88
|
|
|
* Symbol: BTCUSDT |
|
89
|
|
|
* Side: Buy |
|
90
|
|
|
* Order ID: 25d14af5-62ad-472c-a8f5-4573fdb3a3f2 |
|
91
|
|
|
* Order Link ID: |
|
92
|
|
|
* Order Price: 67436.7 |
|
93
|
|
|
* Order Quantity: 0.015 |
|
94
|
|
|
* Order Type: Market |
|
95
|
|
|
* Stop Order Type: Market |
|
96
|
|
|
* Execution ID: 6383ff73-9d54-534c-b8bc-160ba08a8edf |
|
97
|
|
|
* Execution Price: 64233.6 |
|
98
|
|
|
* Execution Quantity: 0.015 |
|
99
|
|
|
* Execution Fee: 0.5299272 |
|
100
|
|
|
* Execution Type: Trade |
|
101
|
|
|
* Execution Value: 963.504 |
|
102
|
|
|
* Fee Rate: 0.00055 |
|
103
|
|
|
* Last Liquidity Ind: RemovedLiquidity |
|
104
|
|
|
* Is Maker: |
|
105
|
|
|
* Leaves Quantity: 0 |
|
106
|
|
|
* Closed Size: 0 |
|
107
|
|
|
* Mark Price: 64235.76 |
|
108
|
|
|
* Index Price 0 |
|
109
|
|
|
*/ |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths