Skip to content

Commit

Permalink
okex v5 set platform default spot
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Nov 8, 2021
1 parent 2ed1aa8 commit 1225024
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Exchanges/Okex.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function getPlatform(string $type=''){
Set exchange transaction category, default "spot" transaction. Other options "spot" "margin" "future" "swap"
*/
public function setPlatform(string $platform=''){
$this->platform=$platform;
$this->platform=$platform ?? 'spot';
return $this;
}

Expand Down
17 changes: 10 additions & 7 deletions src/Map/RequestTraderMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ function buy(array $data){
}

switch ($this->platform){
case 'spot':{
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='quote_ccy';
break;
}
case 'margin':{
break;
}
Expand All @@ -131,8 +126,12 @@ function buy(array $data){

break;
}
case 'spot':
default:{//spot
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='quote_ccy';
}
}

}else{
//v3
$map['client_oid']=$data['_client_id'] ?? ($data['client_oid'] ?? '');
Expand Down Expand Up @@ -387,8 +386,12 @@ function sell(array $data){

break;
}
case 'spot':
default:{//spot
$map['tdMode']=$data['tdMode'] ?? 'cash';
$map['tgtCcy']='base_ccy';
}
}

}else{
$map['client_oid']=$data['_client_id'] ?? ($data['client_oid'] ?? '');
$map['instrument_id']=$data['_symbol'] ?? $data['instrument_id'];
Expand Down

0 comments on commit 1225024

Please sign in to comment.