1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI; |
4
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Auth\Credentials; |
6
|
|
|
use Carpenstar\ByBitAPI\Core\Builders\RestBuilder; |
7
|
|
|
use Carpenstar\ByBitAPI\Core\Exceptions\SDKException; |
8
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
9
|
|
|
use Carpenstar\ByBitAPI\Core\Interfaces\IEndpointInterface; |
10
|
|
|
use Carpenstar\ByBitAPI\Core\Interfaces\IResponseInterface; |
11
|
|
|
use Carpenstar\ByBitAPI\Core\Interfaces\IParametersInterface; |
12
|
|
|
use Carpenstar\ByBitAPI\MarketV5\MarketAPI; |
|
|
|
|
13
|
|
|
use Carpenstar\ByBitAPI\WebSocketsV5\SocketAPI; |
|
|
|
|
14
|
|
|
|
15
|
|
|
class BybitAPI |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Параметры подключения к ByBit |
19
|
|
|
* |
20
|
|
|
* @var Credentials |
21
|
|
|
*/ |
22
|
|
|
protected Credentials $credentials; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Конструктор приложения. |
26
|
|
|
* |
27
|
|
|
* @param string|null $host |
28
|
|
|
*/ |
29
|
|
|
public function __construct(string $host = null) |
30
|
|
|
{ |
31
|
|
|
$this->credentials = new Credentials(); |
32
|
|
|
$this->credentials->setHost($host); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param string $host |
37
|
|
|
* @param string $apiKey |
38
|
|
|
* @param string $secret |
39
|
|
|
* @return $this |
40
|
|
|
*/ |
41
|
|
|
public function setCredentials(string $host, string $apiKey = '', string $secret = ''): self |
42
|
|
|
{ |
43
|
|
|
$this->credentials = (new Credentials()) |
44
|
|
|
->setHost($host) |
45
|
|
|
->setApiKey($apiKey) |
46
|
|
|
->setSecret($secret); |
47
|
|
|
|
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $host |
53
|
|
|
* @return $this |
54
|
|
|
*/ |
55
|
|
|
public function setHost(string $host): self |
56
|
|
|
{ |
57
|
|
|
$this->credentials->setHost($host); |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param string $apiKey |
63
|
|
|
* @return $this |
64
|
|
|
*/ |
65
|
|
|
public function setApiKey(string $apiKey): self |
66
|
|
|
{ |
67
|
|
|
$this->setApiKey($apiKey); |
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $secret |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function setSecret(string $secret): self |
76
|
|
|
{ |
77
|
|
|
$this->credentials->setSecret($secret); |
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Модуль для подключения к сокет-соединениям |
83
|
|
|
* |
84
|
|
|
* @return SocketAPI |
85
|
|
|
* @throws SDKException |
86
|
|
|
*/ |
87
|
|
|
public function websockets(): SocketAPI |
88
|
|
|
{ |
89
|
|
|
return new SocketAPI($this->credentials); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Модуль для получения публичных рыночных данных |
94
|
|
|
* |
95
|
|
|
* @return MarketAPI |
96
|
|
|
*/ |
97
|
|
|
public function market(): MarketAPI |
98
|
|
|
{ |
99
|
|
|
return new MarketAPI($this->credentials); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
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