Skip to content

Latest commit

 

History

History
96 lines (78 loc) · 2.7 KB

README.md

File metadata and controls

96 lines (78 loc) · 2.7 KB

It is recommended that you use the test server first

Online interface testinghttps://www.bitmex.com/api/explorer/

Address of the testhttps://testnet.bitmex.com

The official addresshttps://www.bitmex.com

All interface methods are initialized the same as those provided by bitmex. See detailssrc/api

Many interfaces are not yet complete, and users can continue to extend them based on my design. Feel free to iterate with me.

中文文档

Book Datamore

//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));
}

Ordermore

//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));
}

Postionmore

//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));
}

More use cases

More API