Skip to content
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

quoteOrderQty formatted wrong in binance_build_query function #456

Open
nattila1 opened this issue Nov 10, 2021 · 3 comments
Open

quoteOrderQty formatted wrong in binance_build_query function #456

nattila1 opened this issue Nov 10, 2021 · 3 comments

Comments

@nattila1
Copy link

nattila1 commented Nov 10, 2021

quoteOrderQty formatted wrong in binance_build_query function

Short Description:
If quoteOrderQty is set in a new MARKET order in binance_build_query() function http_build_query() replace the word "quot" with a quotation mark ("eorderQTY). So the query URL will be something like this: symbol=BTCBUSD&side=BUY&type=MARKET&recvWindow=60000"eOrderQty=1001&newClientOrderId=f4ab2acbdc0aabcf0f7c875c87a129

Sorry but I don't know how it should be fixed on a proper way.

thank you

@ePascalC
Copy link
Collaborator

&quot is an HTML notation for "
But it will not be so easy to find the solution I suppose.

@nattila1 Can you give me the function and parameters that you used in your script so I can simulate? Thanks.

@nattila1
Copy link
Author

nattila1 commented Nov 10, 2021

Hi @ePascalC ,

I am simply trying to place a new MARKET order on test environment with following parameters:

$flags = []; $flags['isQuoteOrder'] = true; $new_order = $api->order('BUY', 'BTCBUSD', 1000, '', 'MARKET', $flags, false );

Maybe if & would be URL encoded, this wouldn't happen, no?

@qbreton
Copy link

qbreton commented Apr 10, 2022

Hi @nattila1, I tried to reproduce your issue without success, is it still bugged when you calls the function ?

Tried to reproduce with

function binance_build_query($params = [])
{
    $new_arr = array();
    $query_add = '';
    foreach ($params as $label=>$item) {
        if ( gettype($item) == 'array' ) {
            foreach ($item as $arritem) {
                $query_add = $label . '=' . $arritem . '&' . $query_add;
            }
        } else {
            $new_arr[$label] = $item;
        }
    }
    $query = http_build_query($new_arr, '', '&');
    $query = $query_add . $query;

    return $query;
}

$opt = [
    "symbol" => "BTCBUSD",
    "side" => "BUY",
    "type" => "MARKET",
    "quoteOrderQty" => 1000,
    "recvWindow" => 60000,
];
echo binance_build_query($opt);

And getting as result : symbol=BTCBUSD&side=BUY&type=MARKET&quoteOrderQty=1000&recvWindow=60000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants