zhouaini528 / bybit-php

Bybit API Like the official document interface, Support for arbitrary extension.
MIT License
24 stars 12 forks source link

Connectivity issue #1

Closed vlavani closed 3 years ago

vlavani commented 3 years ago

Hello i currently cloned the repo and ran composer require linwj/bybit

in my VPS when i go to run the test to see even public data endpoints i get errors. This is how i load in my URL

myurl.com/bybit-php/tests/inverse/publics.php

zhouaini528 commented 3 years ago

Thank you for your discovery. I need to check it. Please wait a moment.

vlavani commented 3 years ago

Ok thank you so much. Really appreciate the work you have put into creating api access for many exchanges.

zhouaini528 commented 3 years ago

Hello, I did not find the error you described. What kind of error is it? I am running in php-cli mode, not running under URL in php-fpm mode.

vlavani commented 3 years ago

Ah ok, when i try to run in CLI i get

PHP Parse error: syntax error, unexpected ''../../../vendor/autoload.php'' (T_CONSTANT_ENCAPSED_STRING) in /var/www/html/bybit-php/tests/inverse/publics.php on line 7

Is there any way to run in URL?

zhouaini528 commented 3 years ago

You first try to get the data in php-cli mode. See your error may be the path problem, you wait for me to write a URL test

vlavani commented 3 years ago

Ok thank you so much. I will wait for a URL test and play around with current stage to see if i can get it to work. Thank you so much

zhouaini528 commented 3 years ago

Hello, I just finished the URl test just now.

require __DIR__ .'/vendor/autoload.php';
use \Lin\Bybit\BybitInverse;
$bybit=new BybitInverse();

try {
    $result=$bybit->publics()->getOrderBookL2([
        'symbol'=>'BTCUSD'
    ]);
    print_r(json_encode($result));
}catch (\Exception $e){
    print_r($e->getMessage());
}

try {
    $result=$bybit->publics()->getKlineList([
        'symbol'=>'BTCUSD',
        'interval'=>'15',
        'from'=>time()-3600,
    ]);
    print_r(json_encode($result));
}catch (\Exception $e){
    print_r($e->getMessage());
}
try {
    $result=$bybit->publics()->getTickers();
    print_r(json_encode($result));
}catch (\Exception $e){
    print_r($e->getMessage());
}

The test url http://161.117.186.61:8089/a.php

zhouaini528 commented 3 years ago

Demo test https://github.com/zhouaini528/bybit-php/blob/master/tests/inverse/publics.php

vlavani commented 3 years ago

hm, still getting errors running.

Cloned repo > composer require linwj/bybit > https://myip.com/bybit-php/tests/inverse/publics.php

Which causes an error. Page does not load.

vlavani commented 3 years ago

Nevermind got it working thank you so much for your help and resources !