-
Notifications
You must be signed in to change notification settings - Fork 10
/
position.php
56 lines (46 loc) · 1.18 KB
/
position.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @author lin <[email protected]>
*
* Most of them are unfinished and need your help
* https://github.com/zhouaini528/bitmex-php.git
* */
use Lin\Bitmex\Bitmex;
require __DIR__ .'../../vendor/autoload.php';
//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);
try {
$result=$bitmex->position()->postIsolate([
'symbol'=>'XBTUSD',
'enabled'=>'false',
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
//bargaining transaction
try {
//Default return all
$result=$bitmex->position()->get([
//'filter'=>'{"symbol": "XBTUSD"}',
//'columns'=>'markPrice',
//'count'=>1,
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
//Choose leverage for a position
try {
$result=$bitmex->position()->postLeverage([
'symbol'=>'XBTUSD',
'leverage'=>0
]);
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}
?>