Skip to content

Commit

Permalink
add swap orders account api
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jul 27, 2020
1 parent ef8f9ed commit 260ddc3
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 132 deletions.
51 changes: 34 additions & 17 deletions src/Api/Swap/Accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,87 @@

class Accounts extends Request
{
/*
* GET/api/swap/v3/accounts
* */
public function getAll(){
$this->type='GET';
$this->path='/api/swap/v3/accounts';

return $this->exec();
}

/**
* GET GET /api/swap/v3/<instrument_id>/accounts
* */
public function get(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/'.$data['instrument_id'].'/accounts';

$this->data=$data;

return $this->exec();
}

/**
* GET /api/swap/v3/accounts/<instrument_id>/settings
* */
public function getSettings(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/accounts/'.$data['instrument_id'].'/settings';

$this->data=$data;

return $this->exec();
}

/**
* POST /api/swap/v3/accounts/<instrument_id>/leverage
* */
public function postLeverage(array $data=[]){
$this->type='POST';
$this->path='/api/swap/v3/accounts/'.$data['instrument_id'].'/leverage';

$this->data=$data;

return $this->exec();
}

/**
* GET /api/swap/v3/accounts/<instrument_id>/ledger
* */
public function getLedger(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/accounts/'.$data['instrument_id'].'/ledger';

$this->data=$data;

return $this->exec();
}

/**
* GET /api/swap/v3/accounts/<instrument_id>/holds
* */
public function getHolds(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/accounts/'.$data['instrument_id'].'/holds';

$this->data=$data;

return $this->exec();
}
}

/*
* GET/api/swap/v3/trade_fee
* */
public function getRradeFee(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/trade_fee';

$this->data=$data;

return $this->exec();
}


}
6 changes: 3 additions & 3 deletions src/Api/Swap/Fills.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class Fills extends Request
/**
* GET /api/swap/v3/fills
* */
public function get(){
public function get(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/fills';

return $this->exec();
}
}
}
140 changes: 94 additions & 46 deletions src/Api/Swap/Instruments.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,125 +15,173 @@ class Instruments extends Request
public function get(){
$this->type='GET';
$this->path='/api/swap/v3/instruments';

return $this->exec();
}

/**
* /api/swap/v3/instruments/<instrument_id>/depth
* */
public function getDepth(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/depth';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/ticker
* */
public function getTickerAll(){
$this->type='GET';
$this->path='/api/swap/v3/instruments/ticker';

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/ticker
* */
public function getTicker(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/ticker';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/trades
* */
public function getTrades(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/trades';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/candle
* */
public function getCandles(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/candles';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/candle';

$this->data=$data;

return $this->exec();
}

/*
* GET/api/swap/v3/instruments/<instrument_id>/index
* */
public function getIndex(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/index';


$this->data=$data;

return $this->exec();
}

/*
* GET/api/swap/v3/rate
* */
public function getRate(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/rate';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/open_interest
* */
public function getOpenInterest(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/open_interest';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/price_limit
* */
public function getPriceLimit(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/price_limit';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/liquidation
* */
public function getLiquidation(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/liquidation';

$this->data=$data;

return $this->exec();
}

public function getHolds(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/accounts/'.$data['instrument_id'].'/holds';


$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/funding_time
* */
public function getFundingTime(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/funding_time';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/mark_price
* */
public function getMarkPrice(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/mark_price';

$this->data=$data;

return $this->exec();
}


/*
* GET/api/swap/v3/instruments/<instrument_id>/historical_funding_rate
* */
public function getHistoricalFundingRate(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/historical_funding_rate';


$this->data=$data;

return $this->exec();
}

/*
* GET/api/swap/v3/instruments/<instrument_id>/history/candles
* */
public function getHistoryCandles(array $data=[]){
$this->type='GET';
$this->path='/api/swap/v3/instruments/'.$data['instrument_id'].'/history/candles';

$this->data=$data;

return $this->exec();
}
}
}
Loading

0 comments on commit 260ddc3

Please sign in to comment.