-
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
120bd82
commit b1510f6
Showing
2 changed files
with
64 additions
and
12 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
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 |
---|---|---|
|
@@ -3,9 +3,9 @@ | |
|
||
/** | ||
* @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 | ||
* */ | ||
|
@@ -21,9 +21,9 @@ | |
$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, | ||
//'proxy'=>true, | ||
//More flexible Settings | ||
/* 'proxy'=>[ | ||
'http' => 'http://127.0.0.1:12333', | ||
|
@@ -37,16 +37,16 @@ | |
//Place an Order | ||
try { | ||
$result=$huobi->contract()->postOrder([ | ||
'symbol'=>'BTC',//string false "BTC","ETH"... | ||
'symbol'=>'EOS',//string false "BTC","ETH"... | ||
'contract_type'=>'quarter',// string false Contract Type ("this_week": "next_week": "quarter":) | ||
'contract_code'=>'BTC190927',// string false BTC180914 | ||
'price'=>'2000',// decimal true Price | ||
'contract_code'=>'EOS201225',// string false BTC180914 | ||
'price'=>'1',// decimal true Price | ||
'volume'=>'1',// long true Numbers of orders (amount) | ||
'direction'=>'buy',// string true Transaction direction | ||
'offset'=>'open',// string true "open", "close" | ||
'order_price_type'=>'limit',//"limit", "opponent" | ||
'lever_rate'=>20,//int true Leverage rate [if“Open”is multiple orders in 10 rate, there will be not multiple orders in 20 rate | ||
|
||
//'client_order_id'=>'',//long false Clients fill and maintain themselves, and this time must be greater than last time | ||
]); | ||
print_r($result); | ||
|
@@ -59,7 +59,7 @@ | |
$result=$huobi->contract()->postOrderInfo([ | ||
'order_id'=>$result['data']['order_id'],//You can also 'xxxx,xxxx,xxxx' multiple ID | ||
//'client_order_id'=>'xxxx', | ||
'symbol'=>'BTC' | ||
'symbol'=>'EOS' | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
|
@@ -71,13 +71,13 @@ | |
$result=$huobi->contract()->postCancel([ | ||
'order_id'=>$result['data'][0]['order_id'],//You can also 'xxxx,xxxx,xxxx' multiple ID | ||
//'client_order_id'=>'xxxx', | ||
'symbol'=>'BTC' | ||
'symbol'=>'EOS' | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
} | ||
die; | ||
|
||
//User`s position Information | ||
try { | ||
$result=$huobi->contract()->postPositionInfo(); | ||
|
@@ -100,4 +100,55 @@ | |
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
} | ||
} | ||
|
||
|
||
/*try { | ||
$result=$huobi->contract()->postOpenOrders([ | ||
'symbol'=>'EOS' | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
} | ||
try { | ||
$result=$huobi->contract()->postCancelAll([ | ||
'symbol'=>'EOS' | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
} | ||
try { | ||
$result=$huobi->contract()->postBatchOrder([ | ||
'orders_data'=>[ | ||
[ | ||
'symbol'=>'EOS', | ||
'contract_type'=>'quarter', | ||
'contract_code'=>'EOS201225', | ||
'price'=>'1', | ||
'volume'=>'1', | ||
'direction'=>'buy', | ||
'offset'=>'open', | ||
'order_price_type'=>'limit', | ||
'lever_rate'=>20, | ||
], | ||
[ | ||
'symbol'=>'EOS', | ||
'contract_type'=>'quarter', | ||
'contract_code'=>'EOS201225', | ||
'price'=>'1.1', | ||
'volume'=>'1', | ||
'direction'=>'buy', | ||
'offset'=>'open', | ||
'order_price_type'=>'limit', | ||
'lever_rate'=>20, | ||
], | ||
], | ||
]); | ||
print_r($result); | ||
}catch (\Exception $e){ | ||
print_r(json_decode($e->getMessage(),true)); | ||
}*/ |