Ethereum: Get Binance USDT trc-20 trades (ETH/USDT)?

Home > Ethereum: Get Binance USDT trc-20 trades (ETH/USDT)?

Here is an article on how to edit the existing node.js way to return trades from tron ​​adjustment of binance:

Modification of Binance API Route to Return Tron Tests

As a Developer Working with Ethereum and Tronom, You Probable Know the Public API Binance API to ObTain Shops. However, your current implementation will return shops from the binance platform. Instead, we need to make some adjustments to adjust this route and return trades from the tron ​​network.

Step 1: Identify the Tron Api Endpoints

Before we start, let’s Identify the corresponding endpoints on the blockchaine tron ​​to get stores:

* TRC-20 Token Trading API : get/API/V2/Trades (Returns Business Data for a particular token and pair)

* TRX token Trading API : Get/API/V1/Trades (Returns Commercial Data for a particular token and pair)

We will use the trx trx trading api end point as the starting point.

Step 2: Adjust the Binance API Path to Return Tron Tradees

Ethereum: Get Binance USDT trc-20 trades (ETH/USDT)?

To Return Tron Stores, We Need to Make the Following Changes in Your Existing Route:

  • Update the endpoint 'parameter in response' Get/API/V3/Trades' Include a New End Point.

Javascript

Contronse = Acait Client.get ($ {endpoint}/shops');

  • Edit object params to hand over the appropriate querry parameters Such as:

* From ': determines token and couple for which you want to get shops (EG TRX/ETH)

*To: determines token and pair that you are interested in getting shops

Javascript

Response = await client.get ($ {endpoint}/stores? Z = trx & do = eth);

`

  • Update the feature of the “data” or each retail object to contain the appropriate information, such as a traded amount.

Step 3: Update Node.js Route code **

Here is an Example of a scrap of code that demonstrates how you can edit your existing way to return trades from tron:

`Javascript

Contress = Requires (‘Express’);

Const app = Express ();

Const {Client} = Require (‘@Truffles/Truffles client’); // Import the Truffle Client Library

// Set A New API Client Instance with TRX TRX Trading API and Token

Const TRXClient = New Client ({{{{

Host: ‘

Token: ‘Your_tron_token’

});

App.get (‘/stores’, async (REQ, res) => {

Try {

Const tradesresponse = Await trxclient.get ($ {process.env.trx_api_endpoint}/shops');

// Loop through Each Store and Extract the Appropriate Information

Travesressesponse.data.foreach ((store) => {

// Provied that the business object has assets 'amounts' with the amount traded

Console.log (Trade: $ {trade.id} – from: trx, to: et, amount: $ {shop.amount`);

});

Res.json (tradesversponse);

} Catch (Error) {

Console.error (error);

Res. status (500) .json ({Message: 'Error Retrieveing ​​Trades'});

}

});

App.listeten (process.env.port, () => {{

Console.log (server listening to port $ {process.env.port});

});

In this modified code sketch:

  • We create a new instance of the api client with the trx trx trading api and token end point.

  • We define the route /stores that returns from tron ​​stores by calling the" get at the trx client’s end point for the specific store type (in this case trx/eth).

  • Welas through Each Trading Building and Extracts The Appropriate Information, Such As A Traded Amount.

  • Finally, we will return the extracted data in the Json Answer.

This excerpert of the code demonstrates how you can adjust your existing way to return trades from tron. Be sure to replace your_tron_teken for the real tron ​​token symbol (EG TRX).

More Posts

Share:

Send Us A Message