-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2aa062
commit bd2ccd3
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* @author lin <[email protected]> | ||
* */ | ||
|
||
namespace Lin\Huobi\Api\Futures; | ||
|
||
|
||
|
||
use Lin\Huobi\Request; | ||
|
||
class Lightning extends Request | ||
{ | ||
/** | ||
* POST api/v1/lightning_close_position | ||
* */ | ||
public function postClosePosition(array $data){ | ||
$this->type='POST'; | ||
$this->path='/api/v1/lightning_close_position'; | ||
|
||
$this->data=$data; | ||
return $this->exec(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?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\Huobi\HuobiFuture; | ||
|
||
require __DIR__ .'../../../vendor/autoload.php'; | ||
|
||
include 'key_secret.php'; | ||
|
||
$huobi=new HuobiFuture($key,$secret); | ||
|
||
//You can set special needs | ||
$huobi->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, | ||
]); | ||
|
||
//The Last Trade of a Contract | ||
try { | ||
$result=$huobi->lightning()->postClosePosition([ | ||
'symbol'=>'ETC',//string false "BTC","ETH"... | ||
'contract_type'=>'quarter',// string false Contract Type ("this_week": "next_week": "quarter":) | ||
'contract_code'=>'ETC191227',// string false BTC180914 | ||
'volume'=>1, | ||
'direction'=>'sell', | ||
//'client_order_id'=>rand(100000,999999) | ||
/* | ||
symbol false string 品种代码 "BTC","ETH"... | ||
contract_type false string 合约类型 “this_week”:当周,“next_week”:次周,“quarter”:季度 | ||
contract_code false string 合约代码 BTC190903 | ||
volume true int 委托数量(张) | ||
direction true string “buy”:买,“sell”:卖 | ||
client_order_id false int (API)客户自己填写和维护,必须保持唯一 | ||
*/ | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
} |