Skip to content

Commit

Permalink
Update ProtectedClient.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hitbtc-com authored Nov 3, 2016
1 parent 871c410 commit 484a893
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Hitbtc/ProtectedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,30 @@ public function getTrades($symbols = null, $by = 'trade_id', $sort = 'ask', $fro
throw new InvalidRequestException($response->getBody());
}

/**
* @param string $clientOrderId
* @return Trade[]
* @throws InvalidRequestException
*/
public function getTradesByOrder($clientOrderId)
{
$query = array(
'clientOrderId' => $clientOrderId
);

$response = $this->getHttpClient()->get('/api/1/trading/trades/by/order', array('query' => $query, 'exceptions' => false));
$document = $response->json();
if (isset($document['trades'])) {
$trades = [];
foreach ($document['trades'] as $tradeData) {
$trades[] = new Trade($tradeData);
}

return $trades;
}
throw new InvalidRequestException($response->getBody());
}

/**
* @return BalanceTrading[]
* @throws InvalidRequestException
Expand Down

0 comments on commit 484a893

Please sign in to comment.