Skip to content

Commit

Permalink
add get uid
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Mar 22, 2021
1 parent 236cb35 commit 989d3a1
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Api/AccountV3/Account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* @author lin <[email protected]>
* */

namespace Lin\Okex\Api\AccountV3;

use Lin\Okex\Request;

class Account extends Request
{
/**
* GET /api/account/v3/uid
* */
public function getUid(array $data=[]){
$this->type='GET';
$this->path='/api/account/v3/uid';
$this->data=$data;
return $this->exec();
}

/**
* POST/api/account/v3/purchase_redempt
* */
public function postPurchaseRedempt(array $data=[]){
$this->type='POST';
$this->path='/api/account/v3/purchase_redempt';
$this->data=$data;
return $this->exec();
}
}
7 changes: 7 additions & 0 deletions src/OkexAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Lin\Okex;

use Lin\Okex\Api\AccountV3\Account;
use Lin\Okex\Api\AccountV3\Currencies;
use Lin\Okex\Api\AccountV3\Deposit;
use Lin\Okex\Api\AccountV3\Ledger;
Expand Down Expand Up @@ -51,6 +52,12 @@ function setOptions(array $options=[]){
$this->options=$options;
}

/**
*
* */
public function account(){
return new Account($this->init());
}

/**
*
Expand Down
47 changes: 47 additions & 0 deletions tests/account_v3/account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php


/**
* @author lin <[email protected]>
*
* Fill in your key and secret and pass can be directly run
*
* Most of them are unfinished and need your help
* https://github.com/zhouaini528/okex-php.git
* */
use Lin\Okex\OkexAccount;

require __DIR__ .'../../../vendor/autoload.php';

include 'key_secret.php';

$okex=new OkexAccount($key,$secret,$passphrase);

//You can set special needs
$okex->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,
]);

//
try {
$result=$okex->account()->getUid();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}




0 comments on commit 989d3a1

Please sign in to comment.