Skip to content

Commit

Permalink
binance default host
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Dec 14, 2021
1 parent 7448a5e commit 1b4af6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Exchanges/Binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BaseBinance
function __construct($key,$secret,$host=''){
$this->key=$key;
$this->secret=$secret;
$this->host=empty($host)?'https://api.binance.com':$host;
$this->host=$host;
}

protected function checkType(){
Expand Down Expand Up @@ -67,13 +67,13 @@ function setOptions(array $options=[]){
function getPlatform(string $type=''){
switch (strtolower($type)){
case 'spot':{
$this->host='https://api.binance.com';
if(empty($this->host)) $this->host='https://api.binance.com';
if($this->platform_spot == null) $this->platform_spot=new BinanceApi($this->key,$this->secret,$this->host);;
$this->platform_spot->setOptions($this->options);
return $this->platform_spot;
}
case 'future':{
$this->host='https://fapi.binance.com';
if(empty($this->host)) $this->host='https://fapi.binance.com';
if($this->platform_future == null) $this->platform_future=new BinanceFuture($this->key,$this->secret,$this->host);
$this->platform_future->setOptions($this->options);
return $this->platform_future;
Expand Down
2 changes: 1 addition & 1 deletion src/Map/ResponseTraderMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function show(array $data){

switch ($this->checkType()){
case 'future':{
$map['_price_avg']=$data['result']['avgPrice'];
$map['_price_avg']=$data['result']['avgPrice'] ?? 0;
$map['_filed_amount']=bcmul(strval($data['result']['executedQty']),strval($data['result']['avgPrice']),16);
break;
}
Expand Down

0 comments on commit 1b4af6b

Please sign in to comment.