Skip to content

Commit

Permalink
翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Mar 26, 2019
1 parent c09aaec commit 2623d51
Showing 1 changed file with 78 additions and 40 deletions.
118 changes: 78 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,96 @@
### 初始化
### It is recommended that you use the test server first

建议优先用测试服务器
Online interface testing[https://www.bitmex.com/api/explorer/](https://www.bitmex.com/api/explorer/)

在线接口测试[https://www.bitmex.com/api/explorer/](https://www.bitmex.com/api/explorer/)
Address of the test[https://testnet.bitmex.com](https://testnet.bitmex.com)

测试服务器[https://testnet.bitmex.com](https://testnet.bitmex.com)
The official address[https://www.bitmex.com](https://www.bitmex.com)

正式服务器[https://www.bitmex.com](https://www.bitmex.com)
All interface methods are initialized the same as those provided by bitmex. See details[src/api](https://github.com/zhouaini528/bitmex-php/tree/master/src/Api)

所有的接口方式初始化与bitmex提供的接口方式一样,详细请看src/api
Many interfaces are not yet complete, and users can continue to extend them based on my design. Feel free to iterate with me.

行情数据初始化
[中文文档](https://github.com/zhouaini528/bitmex-php/blob/master/README_CN.md)

Book Data[more](https://github.com/zhouaini528/bitmex-php/blob/master/tests/position.php)
```php
//$host 可以不传入,默认正式服务器访问;
$order=new \Lin\Bitmex\Api\OrderBook();
$rlt=$order->get();
print_r($rlt);
//功能多API请查看API
//Get market data
//Market parameters can not key and secret
try {
$bitmex=new Bitmex();
$result=$bitmex->orderBook()->get([
'symbol'=>'ETHUSD',
'depth'=>20
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

订单类的初始化
Order[more](https://github.com/zhouaini528/bitmex-php/blob/master/tests/order.php)
```php
//$host 可以不传入,默认正式服务器访问;
$order=new \Lin\Bitmex\Api\Order($key, $secret, $host);
//订单查询
$rlt=$order->get([
'symbol'=>'ADAZ18',
]);
print_r($rlt);

//创建新订单
$data=[
'symbol'=>'ADAZ18',
'price'=>'0.00001196',
'orderQty'=>'10',
'ordType'=>'Limit',
];
$rlt=$order->post($data);
print_r($rlt);

//功能多API请查看API
//Test API address default https://www.bitmex.com
$key='eLB_l505a_cuZL8Cmu5uo7EP';
$secret='wG3ndMquAPl6c-jHUQNhyBQJKGBwdFenIF2QxcgNKE_g8Kz3';
$host='https://testnet.bitmex.com';

$bitmex=new Bitmex($key,$secret,$host);

//bargaining transaction
try {
$result=$bitmex->order()->post([
'symbol'=>'XBTUSD',
'price'=>'100',
'side'=>'Buy',
'orderQty'=>'1',
'ordType'=>'Limit',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//track the order
try {
$result=$bitmex->order()->getOne([
'symbol'=>'XBTUSD',
'orderID'=>$result['orderID'],
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}

//cancellation of order
try {
$result=$bitmex->order()->delete([
'symbol'=>'XBTUSD',
'orderID'=>$result['orderID'],
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```


用户类的初始化
Postion[more](https://github.com/zhouaini528/bitmex-php/blob/master/tests/position.php)
```php
//$host 可以不传入,默认正式服务器访问;
$user=new \Lin\Bitmex\Api\User($key, $secret, $host);
//bargaining transaction
try {
$bitmex=new Bitmex($key,$secret,$host);
$result=$bitmex->position()->get([
'symbol'=>'XBTUSD',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
```

//订单查询
$rlt=$user->get();
print_r($rlt);
[More use cases](https://github.com/zhouaini528/bitmex-php/tree/master/tests)

//功能多API请查看API
```
[More API](https://github.com/zhouaini528/bitmex-php/tree/master/src/Api)


0 comments on commit 2623d51

Please sign in to comment.