3
3
3Create2021-09-20 21:21:11
C++ / C#
3Create, 2021-09-20 21:21:11

What is the correct way to receive a request from the Binance API?

I'm trying to make a request to the exchange API ... But it doesn't turn out exactly what I need ...

using Binance.NetCore;
using System.Threading;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Binance1
{
    public class Program
    {
        static void Main(string[] args)
        {
            var binance = new BinanceApiClient("***********","**********");
            
            var limits =  binance.GetOrderBook("ETHBTC",100);
            
            Console.WriteLine(limits);
            Console.ReadKey();
        }
    }
}

I run the code, in the terminal it comes out:
Binance.NetCore.Entities.OrderBook
And something like this should come out:
{
  "lastUpdateId": 1027024,
  "E": 1589436922972,   // Message output time
  "T": 1589436922959,   // Transaction time
  "bids": [
    [
      "4.00000000",     // PRICE
      "431.00000000"    // QTY
    ]
  ],
  "asks": [
    [
      "4.00000200",
      "12.00000000"
    ]
  ]
}

Through python, this came out without problems .. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oleg_ods, 2021-09-20
@3Create

Override the ToString method in the OrderBook class, or return a JSON string from the GetOrderBook method instead of an object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question