Skip to content

Commit

Permalink
cancel the order market trading inquiry time
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jul 3, 2023
1 parent d506462 commit 68f1461
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/Api/Trader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class Trader extends Base implements TraderInterface
function buy(array $data,bool $show=true){
try {
//print_r($data);
$map=$this->map->requestTrader()->buy($data);
$requestTrader=$this->map->requestTrader();

$map=$requestTrader->buy($data);
//print_r($map);//die;
$result=$this->exchange->trader()->buy($map);
//print_r($result);
Expand All @@ -60,7 +62,7 @@ function buy(array $data,bool $show=true){
if(empty($trader['_order_id'])) throw new \Exception('Buy Failed');

//交易所是撮合交易,所以查询需要间隔时间 市价交易不需要等待查询
if($this->map->order_type!='market'){
if($requestTrader->order_type!='market'){
sleep(Exchanges::$TRADER_SHOW_TIME);
}

Expand Down Expand Up @@ -105,7 +107,9 @@ function buy(array $data,bool $show=true){
* */
function sell(array $data,bool $show=true){
try {
$map=$this->map->requestTrader()->sell($data);
$requestTrader=$this->map->requestTrader();

$map=$requestTrader->sell($data);
//print_r($map);
$result=$this->exchange->trader()->sell($map);
//print_r($result);
Expand All @@ -125,7 +129,7 @@ function sell(array $data,bool $show=true){
if(empty($trader['_order_id'])) throw new \Exception('Sell Failed');

//交易所是撮合交易,所以查询需要间隔时间 市价交易不需要等待查询
if($this->map->order_type!='market'){
if($requestTrader->order_type!='market'){
sleep(Exchanges::$TRADER_SHOW_TIME);
}

Expand Down
4 changes: 0 additions & 4 deletions src/Map/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class Map
protected $platform='';
protected $version='';

public $order_type='';

function __construct(string $exchange,string $key,string $secret,string $extra,string $host){
$this->exchange=$exchange;
$this->key=$key;
Expand All @@ -45,8 +43,6 @@ function requestMarket(){
function requestTrader(){
$RequestTraderMap = new RequestTraderMap($this->exchange,$this->key,$this->secret,$this->extra,$this->host);
$RequestTraderMap->setPlatform($this->platform)->setVersion($this->version);

$this->order_type=$RequestTraderMap->order_type;
return $RequestTraderMap;
}

Expand Down

0 comments on commit 68f1461

Please sign in to comment.