代码拉取完成,页面将自动刷新
同步操作将从 lin/exchanges-php 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
/**
* @author lin <465382251@qq.com>
* */
namespace Lin\Exchange;
use Lin\Exchange\Api\Account;
use Lin\Exchange\Api\Trader;
use Lin\Exchange\Api\Market;
class Exchanges
{
protected $exchange='';
protected $key='';
protected $secret='';
protected $extra='';
protected $host='';
protected $platform='';
protected $version='';
protected $acount;
protected $market;
protected $trader;
protected $options=[];
function __construct(string $exchange,string $key='',string $secret='',string $extra='',string $host=''){
$this->exchange=$exchange;
$this->key=$key;
$this->secret=$secret;
$this->extra=$extra;
$this->host=$host;
if(stripos($extra,'http')===0) {
$this->host=$extra;
$this->extra='';
}
}
/**
*
* */
function account(){
$this->acount=new Account($this->exchange,$this->key,$this->secret,$this->extra,$this->host);
$this->acount->setPlatform($this->platform)->setVersion($this->version);
$this->acount->setOptions($this->options);
return $this->acount;
}
/**
*
* */
function market(){
$this->market=new Market($this->exchange,$this->key,$this->secret,$this->extra,$this->host);
$this->market->setPlatform($this->platform)->setVersion($this->version);
$this->market->setOptions($this->options);
return $this->market;
}
/**
*
* */
function trader(){
$this->trader=new Trader($this->exchange,$this->key,$this->secret,$this->extra,$this->host);
$this->trader->setPlatform($this->platform)->setVersion($this->version);
$this->trader->setOptions($this->options);
return $this->trader;
}
/**
* Returns the underlying instance object
* */
public function getPlatform(string $type=''){
if($this->trader!==null) return $this->trader->getPlatform($type);
if($this->market!==null) return $this->market->getPlatform($type);
if($this->acount!==null) return $this->acount->getPlatform($type);
return $this->trader()->getPlatform($type);
}
/**
Set exchange transaction category, default "spot" transaction. Other options "spot" "margin" "future" "swap"
*/
public function setPlatform(string $platform=''){
$this->platform=$platform;
return $this;
}
/**
Set exchange API interface version. for example "v1" "v3" "v5"
*/
public function setVersion(string $version=''){
$this->version=$version;
return $this;
}
/**
* Support for more request Settings
* */
function setOptions(array $options=[]){
$this->options=$options;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。