Skip to content

Commit

Permalink
php
Browse files Browse the repository at this point in the history
  • Loading branch information
php committed Jul 26, 2024
1 parent f7deaf1 commit 48b6f1e
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 4 deletions.
28 changes: 26 additions & 2 deletions okex-php-sdk-api-v5/rapiDemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
*/
$obj = new TradeAPI(Config::$config);
// 下单 Place Order
//$res = $obj -> order('ETH-USDT-SWAP','','','','','sell','','market',"300",'','','');
// $res = $obj -> order('ETH-USDT-SWAP','cross','','','','sell','short','market',"1",'','','');
//批量下单 Batch Order
//$res = $obj -> batchOrders([['BTC-USDT-210625','isolated','','b15','','buy','long','limit','1','60000',''],['BTC-USDT-210924','isolated','','b15','','buy','long','limit','1','60000','']]);
// 撤单 Cancel Order
Expand All @@ -265,7 +265,7 @@
// 获取未成交订单列表 Get Order List
//$res = $obj -> getOrderPending('FUTURES','','','','live','','','');
// 获取历史订单记录(近七天) Get Order History (last 7 days)
$res = $obj -> getOrdersHistory('SWAP','','','','','','','','1');
// $res = $obj -> getOrdersHistory('SWAP','','','','','','','','1');
// 获取历史订单记录(近三个月) Get Order History (last 3 months)
//$res = $obj -> getOrdersHistoryArchive('SWAP','','','','','','','','1');
// 获取成交明细 Get Transaction Details
Expand Down Expand Up @@ -300,6 +300,30 @@
// $res = $obj -> setInstruments('','');
// 交易员历史分润明细
// $res = $obj -> profitSharingDetails('','');
// 交易员历史分润汇总
// $res = $obj -> totalProfitSharing('','');
// 交易员待分润明细
// $res = $obj -> unrealizedProfitSharingDetails('','');
// 交易员待分润汇总
// $res = $obj -> totalUnrealizedProfitSharing('','');
// 带单申请
// $res = $obj -> applyLeadTrading('','');
// 停止带单
// $res = $obj -> stopLeadTrading('','');
// 修改分润比例
// $res = $obj -> amendProfitSharingRatio('','');
// 查看账户配置信息
// $res = $obj -> config('','');
// 首次跟单设置
// $res = $obj -> firstCopySettings('','');
// 修改跟单设置
// $res = $obj -> amendCopySettings('','');
// 停止跟单
// $res = $obj -> stopCopyTrading('','');
// 获取跟单设置
// $res = $obj -> copySettings('','');
// 批量获取杠杆倍数
// $res = $obj -> batchLeverageInfo('','');


/**
Expand Down
145 changes: 143 additions & 2 deletions okex-php-sdk-api-v5/src/CopytradingApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,154 @@ public function setInstruments($instType='',$instId=''){
return $this->request('/api/v5/copytrading/set-instruments', $params, 'POST');
}

public function setInstruments($instType='',$instId=''){
public function profitSharingDetails($instType='',$after='',$before='',$limit=''){
$params = [
'instType' => $instType,
'instId' => $instId,
'before' => $before,
'limit' => $limit,

];

return $this->request('/api/v5/copytrading/set-instruments', $params, 'POST');
return $this->request('/api/v5/copytrading/profit-sharing-details', $params, 'GET');
}

public function totalProfitSharing($instType=''){
$params = [
'instType' => $instType,

];

return $this->request('/api/v5/copytrading/total-profit-sharing', $params, 'GET');
}

public function unrealizedProfitSharingDetails($instType=''){
$params = [
'instType' => $instType,

];

return $this->request('/api/v5/copytrading/unrealized-profit-sharing-details', $params, 'GET');
}

public function totalUnrealizedProfitSharing($instType=''){
$params = [
'instType' => $instType,

];

return $this->request('/api/v5/copytrading/total-unrealized-profit-sharing', $params, 'GET');
}

public function applyLeadTrading($instType='',$instId){
$params = [
'instType' => $instType,
'instId' => $instId,

];

return $this->request('/api/v5/copytrading/apply-lead-trading', $params, 'POST');
}

public function stopLeadTrading($instType=''){
$params = [
'instType' => $instType,

];

return $this->request('/api/v5/copytrading/stop-lead-trading', $params, 'POST');
}

public function amendProfitSharingRatio($instType='',$profitSharingRatio){
$params = [
'instType' => $instType,
'profitSharingRatio' => $profitSharingRatio,

];

return $this->request('/api/v5/copytrading/amend-profit-sharing-ratio', $params, 'POST');
}

public function config(){
$params = [

];

return $this->request('/api/v5/copytrading/config', $params, 'GET');
}

public function firstCopySettings($instType='',$uniqueCode='',$copyMgnMode='',$copyInstIdType='',$instId='',$copyMode='',$copyTotalAmt='',$copyAmt='',$copyRatio='',$tpRatio='',$slRatio='',$slTotalAmt='',$subPosCloseType=''){
$params = [
'instType' => $instType,
'uniqueCode' => $uniqueCode,
'copyMgnMode' => $copyMgnMode,
'copyInstIdType' => $copyInstIdType,
'instId' => $instId,
'copyMode' => $copyMode,
'copyTotalAmt' => $copyTotalAmt,
'copyAmt' => $copyAmt,
'copyRatio' => $copyRatio,
'tpRatio' => $tpRatio,
'slRatio' => $slRatio,
'slTotalAmt' => $slTotalAmt,
'subPosCloseType' => $subPosCloseType,

];

return $this->request('/api/v5/copytrading/first-copy-settings', $params, 'POST');
}

public function amendCopySettings($instType='',$uniqueCode='',$copyMgnMode='',$copyInstIdType='',$instId='',$copyMode='',$copyTotalAmt='',$copyAmt='',$copyRatio='',$tpRatio='',$slRatio='',$slTotalAmt='',$subPosCloseType=''){
$params = [
'instType' => $instType,
'uniqueCode' => $uniqueCode,
'copyMgnMode' => $copyMgnMode,
'copyInstIdType' => $copyInstIdType,
'instId' => $instId,
'copyMode' => $copyMode,
'copyTotalAmt' => $copyTotalAmt,
'copyAmt' => $copyAmt,
'copyRatio' => $copyRatio,
'tpRatio' => $tpRatio,
'slRatio' => $slRatio,
'slTotalAmt' => $slTotalAmt,
'subPosCloseType' => $subPosCloseType,

];

return $this->request('/api/v5/copytrading/amend-copy-settings', $params, 'POST');
}

public function stopCopyTrading($instType='',$uniqueCode,$subPosCloseType=''){
$params = [
'instType' => $instType,
'uniqueCode' => $uniqueCode,
'subPosCloseType' => $subPosCloseType,

];

return $this->request('/api/v5/copytrading/stop-copy-trading', $params, 'POST');
}

public function copySettings($instType='',$uniqueCode){
$params = [
'instType' => $instType,
'uniqueCode' => $uniqueCode,

];

return $this->request('/api/v5/copytrading/copy-settings', $params, 'GET');
}

public function batchLeverageInfo($mgnMode='',$uniqueCode,$instId=''){
$params = [
'mgnMode' => $mgnMode,
'uniqueCode' => $uniqueCode,
'instId' => $instId,

];

return $this->request('/api/v5/copytrading/batch-leverage-info', $params, 'GET');
}


Expand Down

0 comments on commit 48b6f1e

Please sign in to comment.