-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f1e753
commit 423f14f
Showing
5 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?php | ||
|
||
namespace Butschster\Kraken\Objects; | ||
|
||
class Ticker | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $data; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $pair; | ||
|
||
/** | ||
* @param string $pair | ||
* @param array $data | ||
*/ | ||
public function __construct(string $pair, array $data) | ||
{ | ||
$this->data = $data; | ||
$this->pair = $pair; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function pair(): string | ||
{ | ||
return $this->pair; | ||
} | ||
|
||
/** | ||
* Ask price | ||
* @return mixed | ||
*/ | ||
public function askPrice(): float | ||
{ | ||
return (float) array_get($this->data, 'a.0', 0); | ||
} | ||
|
||
/** | ||
* Ask whole lot volume | ||
* @return mixed | ||
*/ | ||
public function askWholeLotVolume(): float | ||
{ | ||
return (float) array_get($this->data, 'a.1', 0); | ||
} | ||
|
||
/** | ||
* Ask lot volume | ||
* @return mixed | ||
*/ | ||
public function askLotVolume(): float | ||
{ | ||
return (float) array_get($this->data, 'a.2', 0); | ||
} | ||
|
||
/** | ||
* Bid price | ||
* @return mixed | ||
*/ | ||
public function bidPrice(): float | ||
{ | ||
return (float) array_get($this->data, 'b.0', 0); | ||
} | ||
|
||
/** | ||
* Bid whole lot volume | ||
* @return mixed | ||
*/ | ||
public function bidWholeLotVolume(): float | ||
{ | ||
return (float) array_get($this->data, 'b.1', 0); | ||
} | ||
|
||
/** | ||
* Bid lot volume | ||
* @return mixed | ||
*/ | ||
public function bidLotVolume(): float | ||
{ | ||
return (float) array_get($this->data, 'b.2', 0); | ||
} | ||
|
||
/** | ||
* Last trade closed price | ||
* | ||
* @return float | ||
*/ | ||
public function lastClosedPrice(): float | ||
{ | ||
return (float) array_get($this->data, 'c.0', 0); | ||
} | ||
|
||
/** | ||
* Last trade closed price | ||
* | ||
* @return float | ||
*/ | ||
public function lastLotVolume(): float | ||
{ | ||
return (float) array_get($this->data, 'c.1', 0); | ||
} | ||
|
||
/** | ||
* Today volume | ||
* | ||
* @return float | ||
*/ | ||
public function volumeToday(): float | ||
{ | ||
return (float) array_get($this->data, 'v.0', 0); | ||
} | ||
|
||
/** | ||
* Last 24 hours volume | ||
* | ||
* @return float | ||
*/ | ||
public function volumePrevious(): float | ||
{ | ||
return (float) array_get($this->data, 'v.1', 0); | ||
} | ||
|
||
/** | ||
* Today volume weighted average price | ||
* | ||
* @return float | ||
*/ | ||
public function avgPriceVolumeToday(): float | ||
{ | ||
return (float) array_get($this->data, 'p.0', 0); | ||
} | ||
|
||
/** | ||
* Last 24 volume weighted average price | ||
* | ||
* @return float | ||
*/ | ||
public function avgPriceVolumPrevious(): float | ||
{ | ||
return (float) array_get($this->data, 'v.1', 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Butschster\Kraken\Objects; | ||
|
||
use Illuminate\Support\Collection; | ||
|
||
class TickerCollection extends Collection | ||
{ | ||
|
||
} |