Skip to content

Commit 897c9bb

Browse files
author
Jon Eyrick
authored
fix history() fromId, defaults to all
1 parent 7502938 commit 897c9bb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

php-binance-api.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -515,17 +515,18 @@ public function orders(string $symbol, int $limit = 500, int $fromOrderId = 1)
515515
*
516516
* @param $symbol string the currency symbol
517517
* @param $limit int the amount of orders returned
518-
* @param $fromTradeId int return the orders from this order onwards
518+
* @param $fromTradeId int (optional) return the orders from this order onwards. negative for all
519519
* @return array with error message or array of orderDetails array
520520
* @throws \Exception
521521
*/
522-
public function history(string $symbol, int $limit = 500, int $fromTradeId = 1)
522+
public function history(string $symbol, int $limit = 500, int $fromTradeId = -1)
523523
{
524-
return $this->httpRequest("v3/myTrades", "GET", [
524+
$parameters = [
525525
"symbol" => $symbol,
526-
"limit" => $limit,
527-
"fromId" => $fromTradeId,
528-
], true);
526+
"limit" => $limit
527+
];
528+
if ( $fromTradeId > 0 ) $parameters["fromId"] = $fromTradeId;
529+
return $this->httpRequest( "v3/myTrades", "GET", $parameters, true );
529530
}
530531

531532
/**

0 commit comments

Comments
 (0)