Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jul 15, 2021
1 parent 0931b9d commit e8b9fdd
Show file tree
Hide file tree
Showing 2 changed files with 326 additions and 22 deletions.
175 changes: 165 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,170 @@ $coinex->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,

//If you are developing locally and need an agent, you can set this
//'proxy'=>true,
//More flexible Settings
/* 'proxy'=>[
'http' => 'http://127.0.0.1:12333',
'https' => 'http://127.0.0.1:12333',
'no' => ['.cn']
], */
//Close the certificate
//'verify'=>false,
//https://github.com/guzzle/guzzle
'proxy'=>[],

//https://www.php.net/manual/en/book.curl.php
'curl'=>[],
]);
```

### Exchange Spot

Market API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/market.php)

```php
$conex=new CoinexExchange();

try {
$result=$conex->market()->getMarketList();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketTicker([
'market'=>'BCHBTC'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketDepth([
'market'=>'BCHBTC',
'merge'=>'0.1'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketKline([
'market'=>'BCHBTC',
'type'=>'4hour'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

Account API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/account.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
$result=$conex->account()->getBalanceInfo([
//You can 'access_id' and 'tonxe' leave it blank
'access_id'=>$key,
'tonce'=>time().'000',
]);

//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->account()->getBalanceInfo();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->account()->getBalanceCoinWithdraw();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->account()->getCreditInfo();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```


Trading API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/trading.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->postMarket([
//'access_id'=>'xxxxx',
//'tonce'=>time().'000',
'market'=>'BCHBTC',
'type'=>'sell',
'amount'=>'1',
'client_id'=>'99999999',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->getStatus([
//'access_id'=>'xxxxx',
//'tonce'=>time().'000',
'id'=>'99999999',
'market'=>'BCHBTC',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->deletePending([
'id'=>'9999999',
'market'=>'BCHBTC',
'type'=>'0'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```


Margin API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/margin.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->margin()->getAccount([
'market'=>'BCHBTC'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->margin()->getMarket();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

More Test [more](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange)

### Perpetual Futures






173 changes: 161 additions & 12 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,169 @@ Support for more request Settings
```php
$coinex=new CoinbeneSpot();

//You can set special needs
//支持更多的请求设置
$coinex->setOptions([
//Set the request timeout to 60 seconds by default
//设置请求过期时间,默认60s
'timeout'=>10,

//If you are developing locally and need an agent, you can set this
//'proxy'=>true,
//More flexible Settings
/* 'proxy'=>[
'http' => 'http://127.0.0.1:12333',
'https' => 'http://127.0.0.1:12333',
'no' => ['.cn']
], */
//Close the certificate
//'verify'=>false,
//https://github.com/guzzle/guzzle
'proxy'=>[],

//https://www.php.net/manual/en/book.curl.php
'curl'=>[],
]);
```

### 现货交易

市场 API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/market.php)

```php
$conex=new CoinexExchange();

try {
$result=$conex->market()->getMarketList();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketTicker([
'market'=>'BCHBTC'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketDepth([
'market'=>'BCHBTC',
'merge'=>'0.1'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->market()->getMarketKline([
'market'=>'BCHBTC',
'type'=>'4hour'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

账户 API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/account.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
$result=$conex->account()->getBalanceInfo([
//You can 'access_id' and 'tonxe' leave it blank
'access_id'=>$key,
'tonce'=>time().'000',
]);

//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->account()->getBalanceInfo();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->account()->getBalanceCoinWithdraw();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->account()->getCreditInfo();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```


交易 API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/trading.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->postMarket([
//'access_id'=>'xxxxx',
//'tonce'=>time().'000',
'market'=>'BCHBTC',
'type'=>'sell',
'amount'=>'1',
'client_id'=>'99999999',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->getStatus([
//'access_id'=>'xxxxx',
//'tonce'=>time().'000',
'id'=>'99999999',
'market'=>'BCHBTC',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->trading()->deletePending([
'id'=>'9999999',
'market'=>'BCHBTC',
'type'=>'0'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```


保证金 API [More](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange/margin.php)

```php
$conex=new CoinexExchange($key,$secret);

try {
//You can 'access_id' and 'tonxe' leave it blank
$result=$conex->margin()->getAccount([
'market'=>'BCHBTC'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$conex->margin()->getMarket();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

More Test [more](https://github.com/zhouaini528/coinex-php/blob/master/tests/exchange)

### 期货交易

0 comments on commit e8b9fdd

Please sign in to comment.