-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
privates->postOrderCreate() signature issue #2
Comments
More info: if I remove the "reduce_only" parameter, the postOrderCreate() call works. So it is somehow related to how a boolean is treated/encoded. I tried passing a string "true"/"false" as the reduce_only param, but this caused another error (but it made the underlying sign-issue) go away. Maybe this helps in diagnosing what's wrong. Appreciate any hints you can offer ... |
Sorry to reply to you now. I just tested and have a problem like yours, I am now looking for the cause |
Sorry to keep you waiting. I have found the problem and fixed it, you can use it. The parameters you pass in are as follows $bybit->privates()->postOrderCreate([
//'order_link_id'=>'xxxxxxxxxxxxxx',
'side'=>'Sell',
'symbol'=>'BTCUSDT',
'order_type'=>'Limit',
'qty'=>'0.25',
'price'=>'40000',
'time_in_force'=>'GoodTillCancel',
//Both string type and boolean type are compatible
'reduce_only'=>'false',
'close_on_trigger'=>'false',
//or set
'reduce_only'=>false,
'close_on_trigger'=>false
]); Remember version composer update , current version 1.0.2 |
Confirmed as fixed, thank you very much! |
I am working with your API and things generally seem to work well. GET requests I had no problem with (getPositionList, getTradingRecords, getWalletBalance, etc.). However, postOrderCreate always returns this:
"ret_code" => 10004 "ret_msg" => "error sign! origin_string[api_key=xxxxxxxxxxxxxx&order_type=Market&qty=1&reduce_only=true&side=Sell&symbol=BTCUSD&time_in_force=GoodTillCancel×tamp=1609525189785]" "ext_code" => "" "ext_info" => "" "result" => null "time_now" => "1609525190.137879"
At first I thought that it might be a problem with POST requests, but postOrderCancel() passes the sign check (it returns an error because I'm supplying an invalid order-id but the signature check passes OK) ...
For the postOrderCreate request which fails, the params passed to your API are:
"side" => "Sell" "symbol" => "BTCUSD" "order_type" => "Market" "qty" => 1 "reduce_only" => true "time_in_force" => "GoodTillCancel"
and the full request which is sent to bybit is this:
"body" => "{"api_key":"xxxxxxxxxxxxxx","order_type":"Market","qty":1,"reduce_only":true,"side":"Sell","symbol":"BTCUSD","time_in_force":"GoodTillCancel","timestamp":1609525189785,"sign":"7c12c29a413c401e8c8bdf9a740c40d3974e699c07c22bd05b8eee1d2d7d5878"}
As the signature is constructed in Request.php in a generic manner, I'm not sure what could be causing this. Can you offer any suggestions?
The text was updated successfully, but these errors were encountered: