Skip to content

Commit

Permalink
Provide setter/getter for headers x-mbx-used-weight and x-mbx-used-we…
Browse files Browse the repository at this point in the history
…ight-1
  • Loading branch information
munvier committed Jun 11, 2020
1 parent 84908cf commit a455b94
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions php-binance-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ class API

protected $exchangeInfo = NULL;
protected $lastRequest = [];


private $xMbxUsedWeight = 0;
private $xMbxUsedWeight1m = 0;

/**
* Constructor for the class,
* send as many argument as you want.
Expand Down Expand Up @@ -1015,7 +1018,15 @@ protected function httpRequest(string $url, string $method = "GET", array $param
'header' => $header,
'json' => $json
];


if (isset($header['x-mbx-used-weight'])) {
$this->setXMbxUsedWeight($header['x-mbx-used-weight']);
}

if (isset($header['x-mbx-used-weight-1m'])) {
$this->setXMbxUsedWeight1m($header['x-mbx-used-weight-1m']);
}

if(isset($json['msg'])){
// should always output error, not only on httpdebug
// not outputing errors, hides it from users and ends up with tickets on github
Expand Down Expand Up @@ -2347,5 +2358,22 @@ private function floorDecimal($n, $decimals=2)
{
return floor($n * pow(10, $decimals)) / pow(10, $decimals);
}


private function setXMbxUsedWeight (int $usedWeight) : void {
$this->xMbxUsedWeight = $usedWeight;
}

private function setXMbxUsedWeight1m (int $usedWeight1m) : void {
$this->xMbxUsedWeight1m = $usedWeight1m;
}

public function getXMbxUsedWeight () : int {
$this->xMbxUsedWeight;
}

public function getXMbxUsedWeight1m () : int {
$this->xMbxUsedWeight1m;
}

}

0 comments on commit a455b94

Please sign in to comment.