Skip to content

Commit

Permalink
add tests v5
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Nov 30, 2023
1 parent 4a24bd1 commit 45f98aa
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/v5/asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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->asset()->getDeliveryRecord([
'category'=>'linear'
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
35 changes: 35 additions & 0 deletions tests/v5/market.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* @author lin <[email protected]>
* */
use \Lin\Bybit\BybitV5;

require __DIR__ .'../../../vendor/autoload.php';

include 'key_secret.php';

$bybit=new BybitV5();

//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->market()->getOrderBook([
'category'=>'spot',
'symbol'=>'BTCUSDT',
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
35 changes: 35 additions & 0 deletions tests/v5/position.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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->position()->getList([
'category'=>'linear',
'symbol'=>'BTCUSDT',
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
32 changes: 32 additions & 0 deletions tests/v5/user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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->user()->getQueryApi();
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}

0 comments on commit 45f98aa

Please sign in to comment.