正在显示
3 个修改的文件
包含
91 行增加
和
0 行删除
trader/exchange/bitget/Api.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace trader\exchange\bitget; | ||
| 4 | + | ||
| 5 | +require_once __DIR__ . '/../../struct/ApiInfo.php'; | ||
| 6 | +require_once __DIR__ . '/../../../jytools/func.php'; | ||
| 7 | + | ||
| 8 | +use trader\struct\ApiInfo; | ||
| 9 | +use jytools\Curl; | ||
| 10 | +use function jytools\getMicrotime; | ||
| 11 | + | ||
| 12 | +class Api | ||
| 13 | +{ | ||
| 14 | + private $host = ''; | ||
| 15 | + private ApiInfo $apiInfo; | ||
| 16 | + public function __construct(ApiInfo $apiInfo) | ||
| 17 | + { | ||
| 18 | + $this->apiInfo = $apiInfo; | ||
| 19 | + } | ||
| 20 | + public function setHost($host) | ||
| 21 | + { | ||
| 22 | + $this->host = $host; | ||
| 23 | + } | ||
| 24 | +} |
trader/exchange/bybit/Api.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace trader\exchange\bybit; | ||
| 4 | + | ||
| 5 | +require_once __DIR__ . '/../../struct/ApiInfo.php'; | ||
| 6 | +require_once __DIR__ . '/../../../jytools/func.php'; | ||
| 7 | + | ||
| 8 | +use trader\struct\ApiInfo; | ||
| 9 | +use jytools\Curl; | ||
| 10 | +use function jytools\getMicrotime; | ||
| 11 | + | ||
| 12 | +class Api | ||
| 13 | +{ | ||
| 14 | + private $host = ''; | ||
| 15 | + private ApiInfo $apiInfo; | ||
| 16 | + public function __construct(ApiInfo $apiInfo) | ||
| 17 | + { | ||
| 18 | + $this->apiInfo = $apiInfo; | ||
| 19 | + } | ||
| 20 | + public function setHost($host) | ||
| 21 | + { | ||
| 22 | + $this->host = $host; | ||
| 23 | + } | ||
| 24 | +} |
trader/exchange/bybit/ExBroker.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace trader\exchange\binance; | ||
| 4 | + | ||
| 5 | +require_once __DIR__ . '/../../struct/ApiInfo.php'; | ||
| 6 | +require_once __DIR__ . '/Api.php'; | ||
| 7 | +require_once __DIR__ . '/../../../jytools/Websocket.php'; | ||
| 8 | +require_once __DIR__ . '/../../../jytools/func.php'; | ||
| 9 | + | ||
| 10 | +use trader\struct\ApiInfo; | ||
| 11 | +use trader\exchange\bybit\Api as BbApi; | ||
| 12 | +use jytools\Websocket; | ||
| 13 | +use function jytools\output; | ||
| 14 | + | ||
| 15 | +class ExBroker | ||
| 16 | +{ | ||
| 17 | + private $host = 'wss://stream.bybit.com'; | ||
| 18 | + private $path = '/v5/private'; | ||
| 19 | + private ApiInfo $apiInfo; | ||
| 20 | + private BbApi $api; | ||
| 21 | + private ?Websocket $wsAcc; | ||
| 22 | + private ?Websocket $wsKline; | ||
| 23 | + | ||
| 24 | + public function __construct(ApiInfo $apiInfo) | ||
| 25 | + { | ||
| 26 | + $this->apiInfo = $apiInfo; | ||
| 27 | + $this->api = new BbApi($apiInfo); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public function setWsHost($host) | ||
| 31 | + { | ||
| 32 | + $this->host = $host; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public function setRestHost($host) | ||
| 36 | + { | ||
| 37 | + $this->api->setHost($host); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public function accListen(callable $onData) {} | ||
| 41 | + | ||
| 42 | + public function klineListen($symbol, $interval, callable $onData) {} | ||
| 43 | +} |
-
请 注册 或 登录 后发表评论