|
...
|
...
|
@@ -12,8 +12,9 @@ class Kline |
|
|
|
public $vol;
|
|
|
|
public $volQuote;
|
|
|
|
public $uts; //k线更新时间
|
|
|
|
public bool $isFinal;
|
|
|
|
|
|
|
|
public function __construct($time, $open, $high, $low, $close, $vol, $volQuote, $uts)
|
|
|
|
public function __construct($time, $open, $high, $low, $close, $vol, $volQuote, $uts, bool $isFinal)
|
|
|
|
{
|
|
|
|
$this->time = $time;
|
|
|
|
$this->open = $open;
|
|
...
|
...
|
@@ -23,6 +24,7 @@ class Kline |
|
|
|
$this->vol = $vol;
|
|
|
|
$this->volQuote = $volQuote;
|
|
|
|
$this->uts = $uts;
|
|
|
|
$this->isFinal = $isFinal;
|
|
|
|
}
|
|
|
|
public function toArray()
|
|
|
|
{
|
|
...
|
...
|
@@ -35,6 +37,7 @@ class Kline |
|
|
|
'vol' => $this->vol,
|
|
|
|
'volQuote' => $this->volQuote,
|
|
|
|
'uts' => $this->uts,
|
|
|
|
'isFinal' => $this->isFinal,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
public static function transferOkx($data)
|
|
...
|
...
|
@@ -51,7 +54,8 @@ class Kline |
|
|
|
$vol = 0;
|
|
|
|
$volQuote = 0;
|
|
|
|
}
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $time);
|
|
|
|
$isFinal = $data[8] == "1";
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $time, $isFinal);
|
|
|
|
}
|
|
|
|
public static function transferBinance($data)
|
|
|
|
{
|
|
...
|
...
|
@@ -64,7 +68,8 @@ class Kline |
|
|
|
$vol = $kline['v'];
|
|
|
|
$volQuote = $kline['q'];
|
|
|
|
$uts = $data['E'];
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts);
|
|
|
|
$isFinal = $data['x'];
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts, $isFinal);
|
|
|
|
}
|
|
|
|
public static function transferBybit($data)
|
|
|
|
{
|
|
...
|
...
|
@@ -77,6 +82,7 @@ class Kline |
|
|
|
$vol = $kline['volume'];
|
|
|
|
$volQuote = $kline['turnover'];
|
|
|
|
$uts = $kline['timestamp'];
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts);
|
|
|
|
$isFinal = $kline['final'];
|
|
|
|
return new Kline($time, $open, $high, $low, $close, $vol, $volQuote, $uts, $isFinal);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|