Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed May 28, 2020
1 parent dd78a90 commit c2e40c2
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 0 deletions.
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,147 @@ $bittrex->setOptions([
]);
```

### Spot API

Market related API [More](https://github.com/zhouaini528/bittrex-php/blob/master/tests/market.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

try {
$result=$bittrex->market()->headTrade([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getTrades([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getCandles([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getTicker([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

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

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

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

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

```

Order related API [More](https://github.com/zhouaini528/bitfinex-php/blob/master/tests/order.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

//Place an Order
try {
$result=$bittrex->order()->post([
//'clientOrderId'=>'xxxxxxxx',
'marketSymbol'=>'BTC-USD',
'direction'=>'BUY',//BUY, SELL

'type'=>'LIMIT',//LIMIT, MARKET, CEILING_LIMIT, CEILING_MARKET
'quantity'=>'0.01',
'limit'=>'3000',

//GOOD_TIL_CANCELLED, IMMEDIATE_OR_CANCEL, FILL_OR_KILL, POST_ONLY_GOOD_TIL_CANCELLED, BUY_NOW
'timeInForce'=>'FILL_OR_KILL'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//Track the order
try {
$result=$bittrex->order()->get([
'orderId'=>'xxxxxxxx'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//Cancel an existing order
try {
$result=$bittrex->order()->delete([
'orderId'=>'xxxxxxxx'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

Accounts related API [More](https://github.com/zhouaini528/bitfinex-php/blob/master/tests/account.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

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

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

```

[More Tests](https://github.com/zhouaini528/bittrex-php/tree/master/tests)

[More API](https://github.com/zhouaini528/bittrex-php/tree/master/src/Api)


143 changes: 143 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,146 @@ $bittrex->setOptions([
//'verify'=>false,
]);
```

### 现货交易 API

Market related API [More](https://github.com/zhouaini528/bittrex-php/blob/master/tests/market.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

try {
$result=$bittrex->market()->headTrade([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getTrades([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getCandles([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

try {
$result=$bittrex->market()->getTicker([
'marketSymbol'=>'BTC-USD'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

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

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

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

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

```

Order related API [More](https://github.com/zhouaini528/bitfinex-php/blob/master/tests/order.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

//Place an Order
try {
$result=$bittrex->order()->post([
//'clientOrderId'=>'xxxxxxxx',
'marketSymbol'=>'BTC-USD',
'direction'=>'BUY',//BUY, SELL

'type'=>'LIMIT',//LIMIT, MARKET, CEILING_LIMIT, CEILING_MARKET
'quantity'=>'0.01',
'limit'=>'3000',

//GOOD_TIL_CANCELLED, IMMEDIATE_OR_CANCEL, FILL_OR_KILL, POST_ONLY_GOOD_TIL_CANCELLED, BUY_NOW
'timeInForce'=>'FILL_OR_KILL'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//Track the order
try {
$result=$bittrex->order()->get([
'orderId'=>'xxxxxxxx'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//Cancel an existing order
try {
$result=$bittrex->order()->delete([
'orderId'=>'xxxxxxxx'
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

Accounts related API [More](https://github.com/zhouaini528/bitfinex-php/blob/master/tests/account.php)
```php
//If you have an Subaccount Id, you can fill it in
$bittrex=new Bittrex($key,$secret,$subaccount_id='');

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

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

```

[More Tests](https://github.com/zhouaini528/bittrex-php/tree/master/tests)

[More API](https://github.com/zhouaini528/bittrex-php/tree/master/src/Api)

0 comments on commit c2e40c2

Please sign in to comment.