Binance.Spot 1.8.0

.NET Standard 2.0
NuGet\Install-Package Binance.Spot -Version 1.8.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Binance.Spot --version 1.8.0
<PackageReference Include="Binance.Spot" Version="1.8.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Binance.Spot --version 1.8.0
#r "nuget: Binance.Spot, 1.8.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Binance.Spot as a Cake Addin
#addin nuget:?package=Binance.Spot&version=1.8.0

// Install Binance.Spot as a Cake Tool
#tool nuget:?package=Binance.Spot&version=1.8.0

Binance Public API Connector DotNET

[Nuget] License: MIT

This is a lightweight library that works as a connector to Binance public API

  • Supported APIs:
    • /api/*
    • /sapi/*
    • Spot Websocket Market Stream
    • Spot User Data Stream
  • Test cases and examples
  • Customizable base URL, request timeout and HTTP proxy
  • Response Metadata


dotnet add package Binance.Spot


Usage example

using System;
using System.Threading.Tasks;
using Binance.Spot;

class Program
    static async Task Main(string[] args)
        Wallet wallet = new Wallet();

        string status = await wallet.SystemStatus();


Please find more examples folder to check for more endpoints.


using System;
using System.Threading;
using System.Threading.Tasks;
using Binance.Spot;

class Program
    static async Task Main(string[] args)
        var websocket = new MarketDataWebSocket("btcusdt@aggTrade");

            (data) =>

            return Task.CompletedTask;
        }, CancellationToken.None);

        await websocket.ConnectAsync(CancellationToken.None);

More websocket examples are available in the Examples folder


Once connected, the websocket server sends a ping frame every 3 minutes and requires a response pong frame back within a 10 minutes period. This package handles the pong responses automatically.


While /sapi/* endpoints don't have testnet environment yet, /api/* endpoints can be tested in Spot Testnet.

using Binance.Spot;

Wallet wallet = new Wallet(baseUrl: "");

Base URL

If baseUrl is not provided, it defaults to

It's recommended to pass in the baseUrl parameter, even in production as Binance provides alternative URLs in case of performance issues:


RecvWindow parameter

Additional parameter recvWindow is available for endpoints requiring signature.

It defaults to 5000 (milliseconds) and can be any value lower than 60000(milliseconds). Anything beyond the limit will result in an error response from Binance server.

using Binance.Spot;

Wallet wallet = new Wallet();

await wallet.AccountStatus(recvWindow=4000)


The default timeout is 100,000 milliseconds (100 seconds).

Usage Example

using System;
using System.Net.Http;
using Binance.Spot;

HttpClient httpClient = new HttpClient() { 
    Timeout = TimeSpan.FromSeconds(10)

Wallet wallet = new Wallet(httpClient: httpClient);


Usage Example

using System;
using System.Net;
using System.Net.Http;
using Binance.Spot;

WebProxy proxy = new WebProxy(new Uri(""));
HttpClientHandler proxyHandler = new HttpClientHandler { Proxy = proxy };
HttpClient httpClient = new HttpClient(handler: proxyHandler);

Wallet wallet = new Wallet(httpClient: httpClient);


There are 2 types of exceptions returned from the library:

  • Binance.Common.BinanceClientException
    • This is thrown when server returns 4XX, it's an issue from client side.
    • Properties:
      • Code - Server's error code, e.g. -1102
      • Message - Server's error message, e.g. Unknown order sent.
  • Binance.Common.BinanceServerException
    • This is thrown when server returns 5XX, it's an issue from server side.

Both exceptions inherit Binance.Common.BinanceHttpException along with the following properties:

  • StatusCode - Response http status code, e.g. 401
  • Headers - Dictionary with response headers


This library implements the .NET logging API that works with a variety of built-in and third-party logging providers.

For more information on how to configure logging in .NET, visit Microsoft's logging article

Usage Example

using System;
using System.Net;
using System.Net.Http;
using Binance.Spot;

public async Task LoggingExample(ILogger logger) {
    BinanceLoggingHandler loggingHandler = new BinanceLoggingHandler(logger: logger);
    HttpClient httpClient = new HttpClient(handler: loggingHandler);

    Wallet wallet = new Wallet(httpClient: httpClient);

    await wallet.SystemStatus();

Sample Output

Method: GET, RequestUri: '', Version: 1.1, Content: <null>, Headers: { }
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: <null>, Headers: {}
{"status": 0,"msg": "normal"}

Test Cases

dotnet test


Futures and Vanilla Options APIs are not supported:

  • /fapi/*
  • /dapi/*
  • /vapi/*
  • Associated Websocket Market and User Data Streams


Contributions are welcome.

If you've found a bug within this project, please open an issue to discuss what you would like to change.

If it's an issue with the API, please open a topic at Binance Developer Community

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Binance.Spot:

Package Downloads

connector to api

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.8.0 724 8/12/2022
1.7.0 280 7/19/2022
1.6.0 824 7/4/2022
1.5.0 418 5/27/2022
1.4.0 1,326 4/20/2022
1.3.1 1,024 3/8/2022
1.3.0 138 3/2/2022
1.2.0 216 2/16/2022
1.1.0 301 1/19/2022
1.0.0 251 12/2/2021