-1

I'd like to get only the BTC pairs of Binance. I use this code to get all currencies current prices

List<TickerPrice> allPrices = client.getAllPrices();
System.out.println(allPrices);

How do I turn only BTC pairs?

halfer
  • 19,824
  • 17
  • 99
  • 186
ken4ward
  • 2,246
  • 5
  • 49
  • 89

1 Answers1

0

Try and catch BinanceAPIException around .. example of grabbing a pair

          BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance();
          BinanceApiRestClient client = factory.newRestClient();
           
          // BinanceApiAsyncRestClient client = factory.newAsyncRestClient();
               

            // Test connectivity
            client.ping();

           long serverTime = client.getServerTime();
           out.println("<p> Time of ticker from Binance - its Servertime : " + serverTime + "</p>");
        
            
            TickerStatistics tickerStatistics = client.get24HrPriceStatistics("NEOETH");
            out.println("<p> NEO ETH : " + tickerStatistics.getLastPrice() + "</p>");
                        
        
            String price = tickerStatistics.getLastPrice().toString();
            out.println("<p> as string .. " + price + "</p>");
            
            TickerStatistics tickerStatistics2 = client.get24HrPriceStatistics("HBARUSDT");
            out.println("<p> HBAR USDT : " + tickerStatistics2.getLastPrice() + "</p>");
        
 
halfer
  • 19,824
  • 17
  • 99
  • 186
johnda98
  • 1
  • 2