-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add market data and user funding requests
- Loading branch information
1 parent
8f62d9c
commit fda3520
Showing
13 changed files
with
342 additions
and
5 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
3 changes: 2 additions & 1 deletion
3
src/message/MessageGetAccountBalances.php → ...essage/data/MessageGetAccountBalances.php
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,41 @@ | ||
<?php | ||
namespace KrakenClient\message\funding; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Retrieve methods available for depositing a particular asset. | ||
*/ | ||
class MessageGetDepositMethods extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_DEPOSIT_METHODS = '/%s/private/DepositMethods'; | ||
|
||
/** | ||
* Field constants. | ||
*/ | ||
private const FIELD_ASSET = 'asset'; | ||
|
||
/** | ||
* @param bool $exendedResponse | ||
*/ | ||
public function __construct(string $asset, string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_ASSET] = $asset; | ||
$this->body[self::FIELD_NONCE] = $this->generateNonce(); | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::POST, vsprintf(self::PATH_DEPOSIT_METHODS, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get information about the assets that are available for deposit, withdrawal, trading and staking. | ||
*/ | ||
class MessageGetAssetInfo extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_ASSET_INFO = '/%s/public/Assets'; | ||
|
||
/** */ | ||
private const FIELD_ASSET = 'asset'; | ||
private const FIELD_ASSET_CLASS = 'aclass'; | ||
|
||
/** | ||
* @param string $version | ||
*/ | ||
public function __construct(string $asset = 'all', string $assetClass = 'currency', string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_ASSET] = $asset; | ||
$this->body[self::FIELD_ASSET_CLASS] = $assetClass; | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_ASSET_INFO, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get Order Book. | ||
*/ | ||
class MessageGetOrderBook extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_ORDER_BOOK = '/%s/public/Depth'; | ||
|
||
/** */ | ||
private const FIELD_PAIR = 'pair'; | ||
private const FIELD_COUNT = 'count'; | ||
|
||
/** | ||
* @param string $pair | ||
* @param int $count | ||
* @param string $version | ||
*/ | ||
public function __construct(string $pair, int $count = 100, string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_PAIR] = $pair; | ||
$this->body[self::FIELD_COUNT] = $count; | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_ORDER_BOOK, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/message/MessageGetServerTime.php → src/message/market/MessageGetServerTime.php
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,45 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get Recent Spreads. | ||
*/ | ||
class MessageGetSpreads extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_SPREAD = '/%s/public/Spread'; | ||
|
||
/** */ | ||
private const FIELD_PAIR = 'pair'; | ||
private const FIELD_SINCE = 'since'; | ||
|
||
/** | ||
* @param string $pair | ||
* @param string $since | ||
* @param string $version | ||
*/ | ||
public function __construct(string $pair, string $since = null, string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_PAIR] = $pair; | ||
|
||
if (!is_null($since)) { | ||
$this->body[self::FIELD_SINCE] = $since; | ||
} | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_SPREAD, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/message/MessageGetSystemStatus.php → ...message/market/MessageGetSystemStatus.php
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,40 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get Ticker Information | ||
* Note: Today's prices start at midnight UTC | ||
*/ | ||
class MessageGetTicker extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_TICKER = '/%s/public/Ticker'; | ||
|
||
/** */ | ||
private const FIELD_PAIR = 'pair'; | ||
|
||
/** | ||
* @param string $pair | ||
* @param string $version | ||
*/ | ||
public function __construct(string $pair, string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_PAIR] = $pair; | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_TICKER, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get tradable asset pairs. | ||
*/ | ||
class MessageGetTradableAssetPairs extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_TRADABLE_ASSET = '/%s/public/AssetPairs'; | ||
|
||
/** */ | ||
private const FIELD_PAIR = 'pair'; | ||
private const FIELD_INFO = 'info'; | ||
|
||
/** | ||
* @param string $pair | ||
* @param string $info | ||
* @param string $version | ||
*/ | ||
public function __construct(string $pair, string $info = 'info', string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_PAIR] = $pair; | ||
$this->body[self::FIELD_INFO] = $info; | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_TRADABLE_ASSET, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
namespace KrakenClient\message\market; | ||
|
||
use GuzzleHttp\Psr7\Request; | ||
use KrakenClient\message\Message; | ||
use KrakenClient\object\HttpMethod; | ||
|
||
/** | ||
* Get Recent Trades. | ||
* Note: Returns the last 1000 trades by default | ||
*/ | ||
class MessageGetTrades extends Message | ||
{ | ||
/** | ||
* Message path. | ||
*/ | ||
public const PATH_TRADES = '/%s/public/Trades'; | ||
|
||
/** */ | ||
private const FIELD_PAIR = 'pair'; | ||
private const FIELD_SINCE = 'since'; | ||
|
||
/** | ||
* @param string $pair | ||
* @param string $since | ||
* @param string $version | ||
*/ | ||
public function __construct(string $pair, string $since = null, string $version = '0') | ||
{ | ||
parent::__construct($version); | ||
|
||
$this->body[self::FIELD_PAIR] = $pair; | ||
|
||
if (!is_null($since)) { | ||
$this->body[self::FIELD_SINCE] = $since; | ||
} | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function generateRequest(): Request | ||
{ | ||
return new Request(HttpMethod::GET, vsprintf(self::PATH_TRADES, [$this->version]) . $this->generateQueryParameters(), [], http_build_query($this->body, '', '&')); | ||
} | ||
} |
Oops, something went wrong.