Skip to content

Commit

Permalink
add error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jul 11, 2019
1 parent 02c091d commit 6d9aa4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Api/Trader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function buy(array $data){
$trader=$this->map->response_trader()->buy(['result'=>$result,'request'=>$data]);

//如果交易默认完成,则不用再查询
if(isset($trader['_status']) && in_array($trader['_status'],['FILLED','FAILURE'])) return $trader;
if(isset($trader['_status']) && in_array($trader['_status'],['FILLED','FAILURE'])) return ['_error'=>$trader];

//交易所是撮合交易,所以查询需要间隔时间
sleep(Exchanges::$TRADER_SHOW_TIME);
Expand Down Expand Up @@ -90,7 +90,7 @@ function sell(array $data){

//如果交易默认完成,则不用再查询
//bitmex 存在可能
if(isset($trader['_status']) && in_array($trader['_status'],['FILLED','FAILURE'])) return $trader;
if(isset($trader['_status']) && in_array($trader['_status'],['FILLED','FAILURE'])) return ['_error'=>$trader];

//交易所是撮合交易,所以查询需要间隔时间
sleep(Exchanges::$TRADER_SHOW_TIME);
Expand Down Expand Up @@ -136,7 +136,7 @@ function cancel(array $data){
$trader=$this->map->response_trader()->cancel(['result'=>$result,'request'=>$data]);

//如果交易默认完成,则不用再查询
if(isset($trader['_status']) && in_array($trader['_status'],['CANCELLED','FAILURE'])) return $trader;
if(isset($trader['_status']) && in_array($trader['_status'],['CANCELLED','FAILURE'])) return ['_error'=>$trader];

//交易所是撮合交易,所以查询需要间隔时间
sleep(Exchanges::$TRADER_SHOW_TIME);
Expand Down
2 changes: 1 addition & 1 deletion tests/okex.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
case 150:{
$result=$exchanges->trader()->buy([
'_symbol'=>'BTC-USDT',
'_number'=>'0.001',
'_number'=>'1',
'_price'=>'2000',
//'_client_id'=>'custom ID',
]);
Expand Down

0 comments on commit 6d9aa4f

Please sign in to comment.