Bybit testnet issue with create_order, "ret_code":10004

See original GitHub issue
  • OS: CENTOS 7.9
  • Programming Language version: PHP 7.4.18
  • CCXT version: 1.49.61

My code:

require __DIR__ . '/../vendor/autoload.php';
$exchange = new \ccxt\bybit(array(
    'apiKey' => 'key-here',
    'secret' => 'secret-here',
    'timeout' => 30000,
    'enableRateLimit' => true,
));
$exchange->set_sandbox_mode(true);
echo "CCXT version: " . \ccxt\Exchange::VERSION . "<br />";
$markets = $exchange->load_markets(); // load all markets
$exchange->verbose = true;

$order = $exchange->create_order('XRP/USD', 'limit', 'buy', 3, 1.5274);

Output:

CCXT version: 1.49.61

Array
(
    [0] => Request:
    [1] => POST
    [2] => https://api-testnet.bybit.com/v2/private/order/create
    [3] => Array
        (
            [Content-Type] => application/json
        )

    [4] => {"side":"Buy","symbol":"XRPUSD","order_type":"Limit","qty":3,"time_in_force":"GoodTillCancel","price":1.52740000000000009094947017729282379150390625,"api_key":"key-here","recv_window":5000,"timestamp":1620479666458,"sign":"ce9b6f2631bba02f56a1d0bfe625e3c2d0cbcbc087fd1daf4cabe26333f244de"}
)
Array
(
    [0] => Response:
    [1] => POST
    [2] => https://api-testnet.bybit.com/v2/private/order/create
    [3] => 200
    [4] => 
    [5] => Array
        (
            [Content-Type] => application/json; charset=utf-8
            [Content-Length] => 366
            [Expires] => Sat, 08 May 2021 13:14:26 GMT
            [Cache-Control] => max-age=0, no-cache, no-store
            [Pragma] => no-cache
            [Date] => Sat, 08 May 2021 13:14:26 GMT
            [Connection] => keep-alive
        )

    [6] => {"ret_code":10004,"ret_msg":"error sign! origin_string[api_key=key-here\u0026order_type=Limit\u0026price=1.52740000000000009094947017729282379150390625\u0026qty=3\u0026recv_window=5000\u0026side=Buy\u0026symbol=XRPUSD\u0026time_in_force=GoodTillCancel\u0026timestamp=1620479666458]","ext_code":"","ext_info":"","result":null,"time_now":"1620479666.560160"}
)


Fatal error:  Uncaught ccxt\AuthenticationError: bybit {"ret_code":10004,"ret_msg":"error sign! origin_string[api_key=key-here\u0026order_type=Limit\u0026price=1.52740000000000009094947017729282379150390625\u0026qty=3\u0026recv_window=5000\u0026side=Buy\u0026symbol=XRPUSD\u0026time_in_force=GoodTillCancel\u0026timestamp=1620479666458]","ext_code":"","ext_info":"","result":null,"time_now":"1620479666.560160"} in /home/username/public_html/trading/app/vendor/ccxt/ccxt/php/Exchange.php:1391
Stack trace:
#0 /home/username/public_html/trading/app/vendor/ccxt/ccxt/php/bybit.php(2297): ccxt\Exchange->throw_exactly_matched_exception(Array, '10004', 'bybit {"ret_cod...')
#1 /home/username/public_html/trading/app/vendor/ccxt/ccxt/php/Exchange.php(1626): ccxt\bybit->handle_errors(200, 'OK', 'https://api-tes...', 'POST', Array, '{"ret_code":100...', Array, Array, '{"side":"Buy","...')
#2 /home/username/public_html/trading/app/vendor/ccxt/ccxt/php/Exchange.php(1382): ccxt\Exchange->fetch('https://api-tes...', 'POST', Array, ' in /home/username/public_html/trading/app/vendor/ccxt/ccxt/php/Exchange.php on line 1391

Please look at this part- “price”:1.52740000000000009094947017729282379150390625 I provided the price value: 1.5274

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
shoemoneycommented, May 26, 2021

Xrp always gives errors. its not ccxt

0reactions
ttoduacommented, Jul 23, 2022

@alesha1488 can you please provide your thoughts? which PHP version do you use, or if you can trace how your 0.007 turns into 0.0070000000000000001, as we couldn’t reproduce, nor guess in which line that incorrect transformation happens. Do you use something other config which is not shown in your provided snippet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bybit testnet issue with create_order, "ret_code":10004
OS: CENTOS 7.9; Programming Language version: PHP 7.4.18; CCXT version: 1.49.61. My code: require __DIR__ . '/../vendor/autoload.php' ...
Read more >
Sign error for bybit using c# when sending post request
I am trying to send a simple post request to the bybit api and I keep getting the 10004 sign error.
Read more >
Group And Resources – Bybit API Docs - GitHub Pages
Fix issue where not returning stop orders of Deactivated status ... Please visit Bybit's testnet or mainnet to generate an API key REST...
Read more >
Return Code: 10004 - Re-quote on Short/Sell Orders - MQL5
Hello There, I am not sure that why I am getting a retcode 10004 each time the EA is trying to place a...
Read more >
Newest 'bybit' Questions - Stack Overflow
i trying to make my CCXT bot to close old opposite trade with new trade coming from trading ... Bybit api connection "retCode":10004,"retMsg":"error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found