zhouaini528 / bybit-php

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

Problems during postOrderCreate - body not json #17

Open Savchuk opened 1 year ago

Savchuk commented 1 year ago

Hello I'm using $bybit->privates()->postOrderCreate with necessary parameters [body] => {"0":{"side":"Sell","symbol":"ETHUSDT","qty":0.2,"price":1261.15},"api_key":"...","timestamp":16730...,"sign":"..."}

but getting the answer: [ret_msg] => body not json Help plese Thank you

zhouaini528 commented 1 year ago

[body] => {"api_key":"....","order_type":"Limit","price":"4000","qty":"1","side":"Buy","symbol":"BTCUSD","time_in_force":"GoodTillCancel","timestamp":1673401541233,"sign":"...."}

your body is not right.

zhouaini528 commented 1 year ago

Hello I'm using $bybit->privates()->postOrderCreate with necessary parameters [body] => {"0":{"side":"Sell","symbol":"ETHUSDT","qty":0.2,"price":1261.15},"api_key":"...","timestamp":16730...,"sign":"..."}

but getting the answer: [ret_msg] => body not json Help plese Thank you 2023-01-11 17-36-00屏幕截图

$bybit=new BybitLinear($key,$secret);

$result=$bybit->privates()->postOrderCreate([
        //'order_link_id'=>'xxxxxxxxxxxxxx',
        'side'=>'Sell',
        'symbol'=>'ETHUSDT',
        'order_type'=>'Limit',
        'qty'=>'0.25',
        'price'=>'40000',
        'time_in_force'=>'GoodTillCancel',

        'reduce_only'=>'false',
        'close_on_trigger'=>'false',
    ]);
    print_r($result);
Savchuk commented 1 year ago

Hello Could you provide an example of working with websocket For websocketposition example: https://bybit-exchange.github.io/docs/futuresV2/linear/#t-websocketposition I have secretkey, and your lib :) Thank you very much

ср, 11 янв. 2023 г. в 11:37, lin @.***>:

Hello I'm using $bybit->privates()->postOrderCreate with necessary parameters [body] => {"0":{"side":"Sell","symbol":"ETHUSDT","qty":0.2,"price":1261.15},"api_key":"...","timestamp":16730...,"sign":"..."}

but getting the answer: [ret_msg] => body not json Help plese Thank you [image: 2023-01-11 17-36-00屏幕截图] https://user-images.githubusercontent.com/5442664/211770734-2fbfc0c8-d015-41e3-8764-71e1dd45a9de.png

$bybit=new BybitLinear($key,$secret);

$result=$bybit->privates()->postOrderCreate([

    //'order_link_id'=>'xxxxxxxxxxxxxx',

    'side'=>'Sell',

    'symbol'=>'ETHUSDT',

    'order_type'=>'Limit',

    'qty'=>'0.25',

    'price'=>'40000',

    'time_in_force'=>'GoodTillCancel',

    'reduce_only'=>'false',

    'close_on_trigger'=>'false',

]);

print_r($result);

— Reply to this email directly, view it on GitHub https://github.com/zhouaini528/bybit-php/issues/17#issuecomment-1378474574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYAPFXKR56AV6LP4QNKODWRZ5OLANCNFSM6AAAAAATT4A36M . You are receiving this because you authored the thread.Message ID: @.***>

Savchuk commented 1 year ago

How use SocketClient with Subscribe for detect orders and positions? Give me example code please Thank you

сб, 21 янв. 2023 г. в 16:40, Savchuk Ivan @.***>:

Hello Could you provide an example of working with websocket For websocketposition example: https://bybit-exchange.github.io/docs/futuresV2/linear/#t-websocketposition I have secretkey, and your lib :) Thank you very much

ср, 11 янв. 2023 г. в 11:37, lin @.***>:

Hello I'm using $bybit->privates()->postOrderCreate with necessary parameters [body] => {"0":{"side":"Sell","symbol":"ETHUSDT","qty":0.2,"price":1261.15},"api_key":"...","timestamp":16730...,"sign":"..."}

but getting the answer: [ret_msg] => body not json Help plese Thank you [image: 2023-01-11 17-36-00屏幕截图] https://user-images.githubusercontent.com/5442664/211770734-2fbfc0c8-d015-41e3-8764-71e1dd45a9de.png

$bybit=new BybitLinear($key,$secret);

$result=$bybit->privates()->postOrderCreate([

    //'order_link_id'=>'xxxxxxxxxxxxxx',

    'side'=>'Sell',

    'symbol'=>'ETHUSDT',

    'order_type'=>'Limit',

    'qty'=>'0.25',

    'price'=>'40000',

    'time_in_force'=>'GoodTillCancel',

    'reduce_only'=>'false',

    'close_on_trigger'=>'false',

]);

print_r($result);

— Reply to this email directly, view it on GitHub https://github.com/zhouaini528/bybit-php/issues/17#issuecomment-1378474574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYAPFXKR56AV6LP4QNKODWRZ5OLANCNFSM6AAAAAATT4A36M . You are receiving this because you authored the thread.Message ID: @.***>

Savchuk commented 1 year ago

How use SocketClient with Subscribe for detect orders and positions? Secretkey too Give me example code please Thank you

ср, 25 янв. 2023 г. в 11:46, Savchuk Ivan @.***>:

How use SocketClient with Subscribe for detect orders and positions? Give me example code please Thank you

сб, 21 янв. 2023 г. в 16:40, Savchuk Ivan @.***>:

Hello Could you provide an example of working with websocket For websocketposition example:

https://bybit-exchange.github.io/docs/futuresV2/linear/#t-websocketposition I have secretkey, and your lib :) Thank you very much

ср, 11 янв. 2023 г. в 11:37, lin @.***>:

Hello I'm using $bybit->privates()->postOrderCreate with necessary parameters [body] => {"0":{"side":"Sell","symbol":"ETHUSDT","qty":0.2,"price":1261.15},"api_key":"...","timestamp":16730...,"sign":"..."}

but getting the answer: [ret_msg] => body not json Help plese Thank you [image: 2023-01-11 17-36-00屏幕截图] https://user-images.githubusercontent.com/5442664/211770734-2fbfc0c8-d015-41e3-8764-71e1dd45a9de.png

$bybit=new BybitLinear($key,$secret);

$result=$bybit->privates()->postOrderCreate([

    //'order_link_id'=>'xxxxxxxxxxxxxx',

    'side'=>'Sell',

    'symbol'=>'ETHUSDT',

    'order_type'=>'Limit',

    'qty'=>'0.25',

    'price'=>'40000',

    'time_in_force'=>'GoodTillCancel',

    'reduce_only'=>'false',

    'close_on_trigger'=>'false',

]);

print_r($result);

— Reply to this email directly, view it on GitHub https://github.com/zhouaini528/bybit-php/issues/17#issuecomment-1378474574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYAPFXKR56AV6LP4QNKODWRZ5OLANCNFSM6AAAAAATT4A36M . You are receiving this because you authored the thread.Message ID: @.***>