Skip to content

Latest commit

 

History

History
225 lines (173 loc) · 5.53 KB

README_CN.md

File metadata and controls

225 lines (173 loc) · 5.53 KB

建议您先阅读官方文档

Bitfinex 文档地址 https://docs.bitfinex.com/

V1 不支持

V2 支持

所有接口方法的初始化都与Bitfinex提供的方法相同。更多细节 src/api

大部分的接口已经完成,使用者可以根据我的设计方案继续扩展,欢迎与我一起迭代它。

English Document

QQ交流群:668421169

其他交易所API

Exchanges 它包含以下所有交易所,强烈推荐使用该SDK。

Bitmex 支持Websocket

Okex 支持Websocket

Huobi 支持Websocket

Binance 支持Websocket

Kucoin

Mxc

Coinbase

ZB

Bitfinex

Bittrex

Kraken

Gate

Bigone

Crex24

Bybit

Coinbene

Bitget

Poloniex

如果没有找到你想要的交易所SDK你可以告诉我,我来加入它们。

安装方式

composer require linwj/bitfinex

支持更多的请求设置

$bitfinex=new Bitfinex($key,$secret);

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

现货交易 API

Market related API More

$bitfinex=new Bitfinex();

try {
    $result=$bitfinex->market()->getPlatformStatus();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->market()->getTickers([
        'symbols'=>'tBTCUSD'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->market()->getTicker([
        'symbol'=>'tBTCUSD'
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->market()->getTradesHist([
        'symbol'=>'tBTCUSD',
        'limit'=>2,
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->market()->getBook([
        'symbol'=>'tBTCUSD',
        'precision'=>'P0',
        'len'=>1
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

Order related API More

$bitfinex=new Bitfinex($key,$secret);

//Place an Order
try {
    $result=$bitfinex->order()->postSubmit([
        //'cid'=>'',
        'type'=>'LIMIT',
        'symbol'=>'tBTCUSD',
        'price'=>'5000',
        'amount'=>'0.01',//Amount of order (positive for buy, negative for sell)
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//track the order
try {
    $result=$bitfinex->order()->post([
        //'cid'=>'',
        'symbol'=>'tBTCUSD',
        'id'=>['33950998275']
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//update the order
try {
    $result=$bitfinex->order()->postUpdate([
        //'cid'=>'',
        'symbol'=>'tBTCUSD',
        'id'=>'33950998275',
        'amount'=>0.02,
        'price'=>6000,
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

//Cancel an existing order
try {
    $result=$bitfinex->order()->postUpdate([
        //'cid'=>'',
        'id'=>'33950998275',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

Accounts related API More

$bitfinex=new Bitfinex($key,$secret);

try {
    $result=$bitfinex->account()->postInfoUser();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->account()->postLoginsHist();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bitfinex->account()->postAuditHist();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

更多用例

更多API