zhouaini528 / bybit-php

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

invalid signature for boolean values #18

Open martinambrus opened 1 year ago

martinambrus commented 1 year ago

when you pass a real boolean value into an endpoint which expects one, the resulting signature is incorrect and generates an "error sign!" result from the ByBit API

example:

$bybit->privates()->postPositionSwitchIsolated([
      'symbol' => $symbol,
      'is_isolated' => false,
      'buy_leverage' => $leverage,
      'sell_leverage' => $leverage
    ]);

however, if you pass the boolean value as a string instead, everything works correctly:

$bybit->privates()->postPositionSwitchIsolated([
      'symbol' => $symbol,
      'is_isolated' => 'false',
      'buy_leverage' => $leverage,
      'sell_leverage' => $leverage
    ]);

I think this should be either documented somewhere or fixed, as it took me a while to realize what's going on and why my valid requests come back with an invalid signature error.

eppenga commented 8 months ago

I think this has nothing to do with this script, if you lookup the API documentation of ByBit, they are the once who want to have it as a string. BTW, I had the same problem that you had ;)

Check for example: https://bybit-exchange.github.io/docs/v5/order/create-order