-
Notifications
You must be signed in to change notification settings - Fork 12
/
order.php
66 lines (54 loc) · 1.31 KB
/
order.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
57
58
59
60
61
62
63
64
65
66
<?php
/**
* @author lin <[email protected]>
* */
use \Lin\Bybit\BybitV5;
require __DIR__ .'../../../vendor/autoload.php';
include 'key_secret.php';
$bybit=new BybitV5($key,$secret);
//You can set special needs
$bybit->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,
'headers'=>[
//X-Referer or Referer - 經紀商用戶專用的頭參數
//X-BAPI-RECV-WINDOW 默認值為5000
//cdn-request-id
'X-BAPI-RECV-WINDOW'=>'6000',
]
]);
try {
$result=$bybit->order()->postCreate([
'category'=>'spot',
'symbol'=>'BTCUSDT',
'side'=>'buy',
'orderType'=>'limit',
'qty'=>'1',
'price'=>'1000',
//'orderLinkId'=>'xxxxxxxxxxx',
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
try {
$result=$bybit->order()->getRealTime([
'category'=>'spot',
'symbol'=>'BTCUSDT',
'orderId'=>'xxxxxxxxxx',
//'orderLinkId'=>'xxxxxxxxxxx',
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
try {
$result=$bybit->order()->getSpotBorrowCheck([
'category'=>'spot',
'symbol'=>'BTCUSDT',
'side'=>'by'
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}