Skip to content

Commit

Permalink
Set the request timeout to 60 seconds by default
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jul 22, 2019
1 parent 3350a87 commit 95baa58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Bitmex.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Bitmex
protected $host;

protected $proxy=false;
protected $timeout=60;

function __construct(string $key='',string $secret='',string $host='https://www.bitmex.com'){
$this->key=$key;
Expand All @@ -48,6 +49,7 @@ private function init(){
'key'=>$this->key,
'secret'=>$this->secret,
'host'=>$this->host,
'timeout'=>$this->timeout,
];
}

Expand All @@ -68,6 +70,13 @@ function setProxy($proxy=true){
$this->proxy=$proxy;
}

/**
* Set the request timeout to 60 seconds by default
* */
function setTimeOut($timeout=60){
$this->timeout=$timeout;
}

/**
* Public Announcements List Operations Expand Operations
* */
Expand Down
3 changes: 3 additions & 0 deletions tests/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

$bitmex=new Bitmex($key,$secret,$host);

//Set the request timeout to 60 seconds by default
//$bitmex->setTimeOut(10);

//bargaining transaction
try {
$result=$bitmex->order()->post([
Expand Down

0 comments on commit 95baa58

Please sign in to comment.