-
Notifications
You must be signed in to change notification settings - Fork 1
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
dve
committed
Aug 19, 2017
1 parent
d9a1208
commit 39b1210
Showing
6 changed files
with
521 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace DVE\KrakenClient\Model\Request; | ||
|
||
use DVE\KrakenClient\Constant\ApiMethodAccessType; | ||
use DVE\KrakenClient\Model\Response\PrivateOpenOrdersResponseModel; | ||
use Shudrum\Component\ArrayFinder\ArrayFinder; | ||
|
||
class PrivateOpenOrdersRequestModel extends RequestModel | ||
{ | ||
/** | ||
* @var bool | ||
*/ | ||
private $trades; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $userref; | ||
|
||
/** | ||
* @param bool $trades | ||
* @return PrivateQueryOrdersRequestModel | ||
*/ | ||
public function setTrades($trades) | ||
{ | ||
$this->trades = (bool)$trades; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param int $userref | ||
* @return PrivateQueryOrdersRequestModel | ||
*/ | ||
public function setUserRef($userref) | ||
{ | ||
$this->userref = $userref; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getEndPointName() | ||
{ | ||
return 'OpenOrders'; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function buildRequest() | ||
{ | ||
$requestData = []; | ||
|
||
if($this->trades) { | ||
$requestData['trades'] = $this->trades; | ||
} | ||
|
||
if($this->userref) { | ||
$requestData['userref'] = $this->userref; | ||
} | ||
|
||
return $requestData; | ||
} | ||
|
||
public function send() | ||
{ | ||
return new PrivateOpenOrdersResponseModel( | ||
$this->callApi(ApiMethodAccessType::PRIVATE_METHOD), | ||
new ArrayFinder([]) | ||
); | ||
} | ||
} |
120 changes: 120 additions & 0 deletions
120
src/Model/Response/PrivateOpenOrdersElementDescrResponseModel.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?php | ||
|
||
namespace DVE\KrakenClient\Model\Response; | ||
|
||
use Shudrum\Component\ArrayFinder\ArrayFinder; | ||
|
||
class PrivateOpenOrdersElementDescrResponseModel extends ResponseModel | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $pair; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $ordertype; | ||
|
||
/** | ||
* @var float | ||
*/ | ||
private $price; | ||
|
||
/** | ||
* @var float | ||
*/ | ||
private $price2; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $leverage; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $order; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPair() | ||
{ | ||
return $this->pair; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType() | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOrdertype() | ||
{ | ||
return $this->ordertype; | ||
} | ||
|
||
/** | ||
* @return float | ||
*/ | ||
public function getPrice() | ||
{ | ||
return $this->price; | ||
} | ||
|
||
/** | ||
* @return float | ||
*/ | ||
public function getPrice2() | ||
{ | ||
return $this->price2; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getLeverage() | ||
{ | ||
return $this->leverage; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOrder() | ||
{ | ||
return $this->order; | ||
} | ||
|
||
/** | ||
* @param ArrayFinder $results | ||
* @param ArrayFinder $params | ||
*/ | ||
protected function hydrate(ArrayFinder $results, ArrayFinder $params) | ||
{ | ||
$leverage = $results->get('leverage'); | ||
|
||
if($leverage === 'none') { | ||
$leverage = 0; | ||
} | ||
|
||
$this->pair = (string)$results->get('pair'); | ||
$this->type = (string)$results->get('type'); | ||
$this->ordertype = (string)$results->get('ordertype'); | ||
$this->price = (float)$results->get('price'); | ||
$this->price2 = (float)$results->get('price2'); | ||
$this->leverage = (int)$leverage; | ||
$this->order = (string)$results->get('order'); | ||
} | ||
} |
Oops, something went wrong.