Here is an example of an article based on your problem:
Ethereum API error: Delphi + Binance API + Limit control problem
In this article, we will examine why you will meet an incorrect signature error when using the Ethereum API in the Delphi application. We will also discuss potential solutions and give examples of code that will help you solve the problem.
issue
“Incorrect signature.” It occurs when Binance API’s request does not respond to the required signature format. This can happen for various reasons, such as:
- Incorrect final point or API method
- Insufficient balance or authorization of the account
- Missing or mismatched parameters
Code example
To recreate this problem, let’s use a simple example in Delphi. We will create a form with a button and try to place a limit using the Binance API interface.
`Delphinst1.Pas
TFOR1.Button1Click procedure (Sender: ...
to start
// Define your Binance API certificates (API key, secret key)
Var
Apikey: String;
Apisecret: String;
// Initiate the Binance API object
API: = tbinanceapi.create;
API.SetAPIKEY (APIKEY);
API.Setapisecret (Apisecret);
// Get a current account balance
Var balance: total number;
API.GETBALANCE ("ETH", "usdt", balance, zero, zero);
// Create a new order
Var in order: Trever;
Order.Symbol: = 'btc / usdt';
order. Bide: = line.
Order. Quantity: = 1;
Order.
order. // accept 10% of the costs
Order.sellingfee: = float64 (20.00); // suppose 20% of the costs
// Try to place an order
If api.order ("limit", "buy", command), then
Writeteln ("Order successfully placed!");
Otherwise
Writeln ("A Row of Retting Errers.");
END;
'
issue
In this example, we try to place a purchase limit (buy) on Bitcoin / USDT pay using the Binance API interface. We define our API certificates and receive a current account balance. Then, we create a new trosseux object with the desired properties.
Finally, we try to place an command using the "API.order (" limit "," buy ", command).
Solution
To solve this problem, you must:
- Check the signature : Make sure that the end point and the API method respond to the required signature format. API Binance uses a specific signature scheme for border orders.
- Check the account balance : Make sure you have enough funds on your account to place an order.
- Use the correct properties of the trot : twice check the properties of the Tordera object, which you transfer to
api.oorder (). In particular, check that the "marketprice" field corresponds to the desired price.
Here is an updated example with additional checks:
` Delphinst1.Pas
TFOR1.Button1Click procedure (Sender: …
to start
// Define your Binance API certificates (API key, secret key)
Var
Apikey: String;
Apisecret: String;
// Initiate the Binance API object
API: = tbinanceapi.create;
API.SetAPIKEY (APIKEY);
API.Setapisecret (Apisecret);
// Get a current account balance
Var balance: total number;
If API.Getbalancia (“ETH”, “usdt”, balance, zero, zero), then
Writeln (“The account balance is valid.”);
Otherwise
WRITELN (“Error of obtaining an account balance error:”, API.Getbalancer);
END;
// Create a new order
Var in order: Trever;
If order.symbol = ‘btc / usdt’, then
order. Bide: = line.
Order. Quantity: = 1;
Order. // accept the market price of 10,000 USD
order. // accept 10% of the costs
Order.sellingfee: = float64 (20.00); // suppose 20% of the costs
// Try to place an order
If api.order (“limit”, “buy”, command), then
Writeteln (“Order successfully placed!”);
Otherwise
Writeln (“A Row of Error Setting:”, API.Getbalancerror);
END;
Otherwise
Writeteln (“Incorrect symbol:”, Order.