diff --git a/src/Bitmex.php b/src/Bitmex.php index ceda73d..811ca16 100644 --- a/src/Bitmex.php +++ b/src/Bitmex.php @@ -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; @@ -48,6 +49,7 @@ private function init(){ 'key'=>$this->key, 'secret'=>$this->secret, 'host'=>$this->host, + 'timeout'=>$this->timeout, ]; } @@ -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 * */ diff --git a/tests/order.php b/tests/order.php index 2e28fdf..78a6afa 100644 --- a/tests/order.php +++ b/tests/order.php @@ -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([