Issue Adding New Order on Binance Spot Test Network using PHP

56 Views Asked by At

I am facing an issue when attempting to add a new order on the Binance Spot Test Network using PHP. The API request seems to be successful, and I receive a “NEW” in status, but don't find order in platform testnet binancefuture.

This is example of the code :

<?php

$endpoint = 'https://testnet.binance.vision/api/v3/order';


$params = [
    'symbol' => 'BTCUSDT',    
    'side' => 'BUY',           
    'type' => 'LIMIT',         
    'timeInForce' => 'GTC',    
    'quantity' => 1,           
    'price' => 50000,          
];


$params['timestamp'] = time() * 1000;


$query_string = http_build_query($params, '', '&');


$signature = hash_hmac('sha256', $query_string, $api_secret);


$params['signature'] = $signature;


$url = $endpoint . '?' . http_build_query($params, '', '&');

$ch = curl_init($url);


curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-MBX-APIKEY: ' . $api_key]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


$response = curl_exec($ch);


curl_close($ch);


echo $response;

This response :

{"symbol":"ETCUSDT","orderId":762995,"orderListId":-1,"clientOrderId":"mkfVUpOq3icQXxxxxxx","transactTime":1703759151177,"price":"21.20000000","origQty":"10.00000000","executedQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1703759151177,"fills":[],"selfTradePreventionMode":"EXPIRE_MAKER"}

0

There are 0 best solutions below