|
|
|
<?php
|
|
|
|
|
|
|
|
namespace trader\exchange\binance;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../struct/ApiInfo.php';
|
|
|
|
require_once __DIR__ . '/Api.php';
|
|
|
|
require_once __DIR__ . '/../../../jytools/Websocket.php';
|
|
|
|
require_once __DIR__ . '/../../../jytools/func.php';
|
|
|
|
|
|
|
|
use trader\struct\ApiInfo;
|
|
|
|
use trader\exchange\bybit\Api as BbApi;
|
|
|
|
use jytools\Websocket;
|
|
|
|
use function jytools\output;
|
|
|
|
|
|
|
|
class ExBroker
|
|
|
|
{
|
|
|
|
private $host = 'wss://stream.bybit.com';
|
|
|
|
private $path = '/v5/private';
|
|
|
|
private ApiInfo $apiInfo;
|
|
|
|
private BbApi $api;
|
|
|
|
private ?Websocket $wsAcc;
|
|
|
|
private ?Websocket $wsKline;
|
|
|
|
|
|
|
|
public function __construct(ApiInfo $apiInfo)
|
|
|
|
{
|
|
|
|
$this->apiInfo = $apiInfo;
|
|
|
|
$this->api = new BbApi($apiInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setWsHost($host)
|
|
|
|
{
|
|
|
|
$this->host = $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setRestHost($host)
|
|
|
|
{
|
|
|
|
$this->api->setHost($host);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function accListen(callable $onData) {}
|
|
|
|
|
|
|
|
public function klineListen($symbol, $interval, callable $onData) {}
|
|
|
|
} |
...
|
...
|
|