正在显示
1 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -12,8 +12,9 @@ class Kline | @@ -12,8 +12,9 @@ class Kline | ||
| 12 | public $vol; | 12 | public $vol; |
| 13 | public $volQuote; | 13 | public $volQuote; |
| 14 | public $uts; //k线更新时间 | 14 | public $uts; //k线更新时间 |
| 15 | + public bool $isFinal; | ||
| 15 | 16 | ||
| 16 | - public function __construct($time, $open, $high, $low, $close, $vol, $volQuote, $uts) | 17 | + public function __construct($time, $open, $high, $low, $close, $vol, $volQuote, $uts, bool $isFinal) |
| 17 | { | 18 | { |
| 18 | $this->time = $time; | 19 | $this->time = $time; |
| 19 | $this->open = $open; | 20 | $this->open = $open; |
| @@ -23,6 +24,7 @@ class Kline | @@ -23,6 +24,7 @@ class Kline | ||
| 23 | $this->vol = $vol; | 24 | $this->vol = $vol; |
| 24 | $this->volQuote = $volQuote; | 25 | $this->volQuote = $volQuote; |
| 25 | $this->uts = $uts; | 26 | $this->uts = $uts; |
| 27 | + $this->isFinal = $isFinal; | ||
| 26 | } | 28 | } |
| 27 | public function toArray() | 29 | public function toArray() |
| 28 | { | 30 | { |
| @@ -35,6 +37,7 @@ class Kline | @@ -35,6 +37,7 @@ class Kline | ||
| 35 | 'vol' => $this->vol, | 37 | 'vol' => $this->vol, |
| 36 | 'volQuote' => $this->volQuote, | 38 | 'volQuote' => $this->volQuote, |
| 37 | 'uts' => $this->uts, | 39 | 'uts' => $this->uts, |
| 40 | + 'isFinal' => $this->isFinal, | ||
| 38 | ]; | 41 | ]; |
| 39 | } | 42 | } |
| 40 | public static function transferOkx($data) | 43 | public static function transferOkx($data) |
| @@ -51,7 +54,8 @@ class Kline | @@ -51,7 +54,8 @@ class Kline | ||
| 51 | $vol = 0; | 54 | $vol = 0; |
| 52 | $volQuote = 0; | 55 | $volQuote = 0; |
| 53 | } | 56 | } |
| 54 | - return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $time); | 57 | + $isFinal = $data[8] == "1"; |
| 58 | + return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $time, $isFinal); | ||
| 55 | } | 59 | } |
| 56 | public static function transferBinance($data) | 60 | public static function transferBinance($data) |
| 57 | { | 61 | { |
| @@ -64,7 +68,8 @@ class Kline | @@ -64,7 +68,8 @@ class Kline | ||
| 64 | $vol = $kline['v']; | 68 | $vol = $kline['v']; |
| 65 | $volQuote = $kline['q']; | 69 | $volQuote = $kline['q']; |
| 66 | $uts = $data['E']; | 70 | $uts = $data['E']; |
| 67 | - return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts); | 71 | + $isFinal = $data['x']; |
| 72 | + return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts, $isFinal); | ||
| 68 | } | 73 | } |
| 69 | public static function transferBybit($data) | 74 | public static function transferBybit($data) |
| 70 | { | 75 | { |
| @@ -77,6 +82,7 @@ class Kline | @@ -77,6 +82,7 @@ class Kline | ||
| 77 | $vol = $kline['volume']; | 82 | $vol = $kline['volume']; |
| 78 | $volQuote = $kline['turnover']; | 83 | $volQuote = $kline['turnover']; |
| 79 | $uts = $kline['timestamp']; | 84 | $uts = $kline['timestamp']; |
| 80 | - return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts); | 85 | + $isFinal = $kline['final']; |
| 86 | + return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts, $isFinal); | ||
| 81 | } | 87 | } |
| 82 | } | 88 | } |
-
请 注册 或 登录 后发表评论