Skip to content

Commit

Permalink
okex v5 add tgtCcy 'quote_ccy' and 'base_ccy'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Dec 28, 2021
1 parent 296122c commit 55e4979
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/Map/RequestTraderMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function buy(array $data){
$map['sz']=$data['_number'] ?? 0;
}else{
$map['ordType']='market';
$map['sz']=$data['_price'] ?? 0;
}

switch ($this->platform){
Expand All @@ -133,7 +132,16 @@ function buy(array $data){
case 'spot':
default:{//spot
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='quote_ccy';

if(isset($data['_number']) && $data['_number']>0 && $map['ordType']=='market'){
$map['tgtCcy']='base_ccy';
$map['sz']=$data['_number'];
}

if(isset($data['_price']) && $data['_price']>0 && $map['ordType']=='market'){
$map['tgtCcy']='quote_ccy';
$map['sz']=$data['_price'];
}
}
}
}else{
Expand Down Expand Up @@ -381,15 +389,8 @@ function sell(array $data){
$map['sz']=$data['_number'] ?? 0;
}else{
$map['ordType']='market';
$map['sz']=$data['_number'] ?? 0;
}

switch ($this->platform){
case 'spot':{
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='base_ccy';
break;
}
case 'margin':{
break;
}
Expand All @@ -406,7 +407,16 @@ function sell(array $data){
case 'spot':
default:{//spot
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='base_ccy';

if(isset($data['_number']) && $data['_number']>0 && $map['ordType']=='market'){
$map['tgtCcy']='base_ccy';
$map['sz']=$data['_number'];
}

if(isset($data['_price']) && $data['_price']>0 && $map['ordType']=='market'){
$map['tgtCcy']='quote_ccy';
$map['sz']=$data['_price'];
}
}
}
}else{
Expand Down

0 comments on commit 55e4979

Please sign in to comment.