BinanceAPI.NET 26.1.0.35

dotnet add package BinanceAPI.NET --version 26.1.0.35
NuGet\Install-Package BinanceAPI.NET -Version 26.1.0.35
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.
<PackageReference Include="BinanceAPI.NET" Version="26.1.0.35" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BinanceAPI.NET --version 26.1.0.35
#r "nuget: BinanceAPI.NET, 26.1.0.35"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BinanceAPI.NET as a Cake Addin
#addin nuget:?package=BinanceAPI.NET&version=26.1.0.35

// Install BinanceAPI.NET as a Cake Tool
#tool nuget:?package=BinanceAPI.NET&version=26.1.0.35

alternate text is missing from this package README image Nuget

EXAMPLE Authentication

Create an Authentication Provider that can be used by multiple Rest Clients

AuthenticationProvider authenticationProvider = new AuthenticationProvider(api_key, api_secret);

EXAMPLE Create Rest Client

Change the Rest Client Options and create a new Rest Client using the Authentication Provider above

RestClientOptions restClientOptions = new()
{
    SyncUpdateTime = 5,
    GetCacheSize = 2048,
    PutCacheSize = 2048,
    PostCacheSize = 2048,
    DeleteCacheSize = 2048,
    ReceiveWindow = TimeSpan.FromMilliseconds(1000),
    DefaultApiController = BinanceApiController.DEFAULT
};

RestClient restClient = new RestClient(authenticationProvider, restClientOptions, CancellationToken.None);

EXAMPLE Create Socket Client

Create a Socket Client that can be used to Connect/Subscribe to Websocket Streams

Returns a SocketClientHost that can be used to manage the connection.

SocketClient socketClient = new SocketClient(50);

SocketClientHost example = socketClient.Subscribe.SymbolMiniTickerUpdates(...);
example.ConnectionStatusChanged += BinanceSocket_StatusChanged;
example.ReconnectSocket();
example.DestroySocket();

50 is the default number of Reconnect Attempts before the socket will Fail


Server Time Client

The Server Time Client is used to produce high quality Timestamps for requests by guessing the Server Time

You don't need to sync your clock or use any external tools, etc.


Wait for Start

You must wait for the Server Time Client to start before you can make requests that require a Timestamp

if (!ServerTimeClient.IsReady())
{
    await ServerTimeClient.WaitForStart(serverTimeStartWaitToken.Token).ConfigureAwait(false);
}

Requests will automatically use the ServerTimeClient, you don't need to do anything.


Get Server Time

Get the current Server Time Guess according to the Server Time Client so you can display it on a UI

ServerTimeClient.ServerTimeTicks

Cache Client

The library provides objects so that certain data about orders can be cached for fast access to order placement endpoints.

You are responsible for creating the cache and storing the Cachable objects for orders


CachableSpotRequest

Create a spot order request so it can be cached and reused

CachableSpotRequest cachableSpotRequest = CacheClientSpot.CreateOrderLimit();

CachableMarginRequest

Create a margin order request so it can be cached and reused

CachableMarginRequest cachableMarginRequest = CacheClientMargin.CreateMarginOrderLimit();

Order Endpoints

Spot Orders

CreateOrderLimit

Create a new cachable limit order that can be used in multiple future requests

CachableSpotRequest order = CacheClientSpot.CreateOrderLimit();

CreateOrderMarket

Create a new cachable market order that can be used in multiple future requests

CachableSpotRequest order = CacheClientSpot.CreateOrderMarket();

POST PlaceOrderSpotCached

Place a Spot Order from data that can be cached

CachableSpotRequest order = CacheClientSpot.CreateOrderMarket(symbolName, orderSide, orderQuantity, recvWindow);

RestResult<BinancePlacedOrderSpot> result = restClient.Spot.Order.PlaceOrderSpot(ref order);

Place a Spot Order from data that can be cached and also return a copy of the raw response

RestResultRaw<BinancePlacedOrderSpot> result = restClient.Spot.Order.PlaceOrderSpotRaw(ref order, ref request);

POST PlaceTestOrder

Places a new test order.

Test orders are not actually being executed and just test the functionality.

CachableSpotRequest spotRequest = CacheClientSpot.CreateOrderMarket("BTCUSDT", OrderSide.Sell, 1, 1000);

RestResult<BinancePlacedOrderSpot> result = restClient.Spot.Order.PlaceTestOrder(ref spotRequest);

GET GetOrder

Retrieves data for a specific order.

Either orderId or origClientOrderId should be provided.

restClient.Spot.Order.GetOrder();

GET GetOrders

Gets all orders for the provided symbol

restClient.Spot.Order.GetOrders();

GET GetOpenOrders

Gets a list of open orders

restClient.Spot.Order.GetOpenOrders();

GET GetUserTrades

Gets all user trades for provided symbol

restClient.Spot.Order.GetUserTrades();

DELETE CancelOrder

Cancels a pending order on a symbol

restClient.Spot.Order.CancelOrder();

DELETE CancelAllOpenOrders

Cancels all open orders on a symbol

restClient.Spot.Order.CancelAllOpenOrders()

Margin/Isolated Orders

CreateOrderLimit

Create a new cachable limit order that can be used in multiple future requests

CachableMarginRequest order = CacheClientMargin.CreateMarginOrderLimit();

CreateOrderMarket

Create a new cachable market order that can be used in multiple future requests

CachableMarginRequest order = CacheClientMargin.CreateMarginOrderMarket();

POST PlaceOrderMarginCached

Place a Margin Order from data that can be cached

CachableMarginRequest order = CacheClientMargin.CreateMarginOrderMarket(symbolName, orderSide, orderQuantity, recvWindow);

RestResult<BinancePlacedOrderMargin> result = restClient.Margin.Order.PlaceOrderMargin(ref order);

Place a Margin Order from data that can be cached and also return a copy of the raw response

RestResultRaw<BinancePlacedOrderMargin> result = restClient.Margin.Order.PlaceOrderMarginRaw(ref order, ref request);

GET GetMarginAccountOrder

Retrieves data for a specific margin account order.

Either orderId or origClientOrderId should be provided.

restClient.Margin.Order.GetMarginAccountOrder();

GET GetMarginAccountOrders

Gets all margin account orders for the provided symbol

restClient.Margin.Order.GetMarginAccountOrders();

GET GetMarginAccountOpenOrders

Gets a list of open margin account orders

restClient.Margin.Order.GetMarginAccountOpenOrders();

GET GetMarginAccountUserTrades

Gets all user margin account trades for provided symbol

restClient.Margin.Order.GetMarginAccountUserTrades();

DELETE CancelMarginOrder

Cancel an active order for margin account

restClient.Margin.Order.CancelMarginOrder();

DELETE CancelOpenMarginOrders

Cancel all active orders for a symbol

restClient.Margin.Order.CancelOpenMarginOrders();

Account Endpoints

General

Get GetAccountInfo

Gets the account information, including balances

restClient.General.GetAccountInfo();

Get GetAccountStatus

Gets the status of the account associated with the api key/secret

restClient.General.GetAccountStatus();

Get GetDailySpotAccountSnapshot

Get a daily account snapshot (balances)

restClient.General.GetDailySpotAccountSnapshot();

Margin

POST Transfer

Execute transfer between spot account and cross margin account.

restClient.Margin.System.Transfer();

Get GetMarginAccountInfo

Query margin account details

restClient.Margin.System.GetMarginAccountInfo();

Get GetMarginLevelInformation

Get personal margin level information for your account

restClient.Margin.System.GetMarginLevelInformation();

Get GetTransferHistory

Get history of transfers

restClient.Margin.System.GetTransferHistory();

Get GetForceLiquidationHistory

Get history of forced liquidations

restClient.Margin.System.GetForceLiquidationHistory();

Get GetMaxTransferAmount

Query max transfer-out amount

restClient.Margin.System.GetMaxTransferAmount();

Isolated

POST EnableIsolatedMarginAccount

Enable an isolated margin account

restClient.Margin.System.EnableIsolatedMarginAccount();

Get GetIsolatedMarginAccount

Isolated margin account info

restClient.Margin.System.GetIsolatedMarginAccount();

Get GetEnabledIsolatedMarginAccountLimit

Get max number of enabled isolated margin accounts

restClient.Margin.System.GetEnabledIsolatedMarginAccountLimit();

Get GetInterestIsolatedMarginData

Get interest isolated margin data

restClient.Margin.System.GetInterestIsolatedMarginData();

DELETE DisableIsolatedMarginAccount

Disable an isolated margin account

restClient.Margin.System.DisableIsolatedMarginAccount();

Lending Endpoints

POST Borrow

Borrow. Apply for a loan.

restClient.Lending.Borrow();

POST Repay

Repay loan for margin account.

restClient.Lending.Repay();

Get GetLoans

Query loan records

restClient.Lending.GetLoans();

Get GetRepays

Query repay records

restClient.Lending.GetRepays();

Get GetMaxBorrowAmount

Query max borrow amount

restClient.Lending.GetMaxBorrowAmount();

Get GetInterestHistory

Get history of interest

restClient.Lending.GetInterestHistory();

Get GetInterestRateHistory

Get history of interest rates

restClient.Lending.GetInterestRateHistory();

Get GetInterestMarginData

Get interest margin data

restClient.Lending.GetInterestMarginData();

Market Endpoints

Spot

GET GetTicker

Get data regarding the last 24 hours for the provided symbol

restClient.Spot.Market.GetTicker();

GET GetTickers

Get data regarding the last 24 hours for all symbols

restClient.Spot.Market.GetTickers();

GET GetAggTradeHistory

Gets compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

restClient.Spot.Market.GetAggregatedTradeHistory();

GET GetCurrentAvgPrice

Gets current average price for a symbol

restClient.Spot.Market.GetCurrentAvgPrice();

GET GetKlines

Get candlestick data for the provided symbol

restClient.Spot.Market.GetKlines();

GET GetTradeHistory

Gets the historical trades for a symbol

restClient.Spot.Market.GetTradeHistory();

GET GetRecentTradeHistory

Gets the recent trades for a symbol

restClient.Spot.Market.GetRecentTradeHistory();

GET GetBookPrice

Gets the best price/quantity on the order book for a symbol.

restClient.Spot.Market.GetBookPrice();

GET GetAllBookPrices

Gets the best price/quantity on the order book for all symbols.

restClient.Spot.Market.GetAllBookPrices();

GET GetPrice

Gets the price of a symbol

restClient.Spot.Market.GetPrice();

GET GetAllPrices

Get a list of the prices of all symbols

restClient.Spot.Market.GetAllPrices();

GET GetTradeFee

Gets the trade fee for a symbol

restClient.Spot.Market.GetTradeFee();

Margin

GET GetMarginAsset

Get a margin asset

restClient.Margin.Market.GetMarginAsset();

GET GetAllMarginAssets

Get all assets available for margin trading

restClient.Margin.Market.GetAllMarginAssets();

GET GetMarginPair

Get a margin pair

restClient.Margin.Market.GetMarginPair();

GET GetAllMarginPairs

Get all asset pairs available for margin trading

restClient.Margin.Market.GetAllMarginPairs();

GET GetMarginPriceIndex

Get margin price index

restClient.Margin.Market.GetMarginPriceIndex();

Isolated

GET GetIsolatedSymbol

Isolated margin symbol info for a specific symbol

restClient.Margin.Market.GetIsolatedMarginSymbol();

GET GetAllIsolatedSymbols

Isolated margin symbol info for all symbols

restClient.Margin.Market.GetAllIsolatedMarginSymbols();

Userstream Endpoints

Spot

POST StartUserStream

Starts a user stream by requesting a listen key.

This listen key can be used in subsequent requests to SubscribeToUserDataUpdates

The stream will close after 60 minutes unless a keep alive is send.

restClient.Spot.UserStream.StartUserStream();

PUT KeepAliveUserStream

Sends a keep alive for the current user stream listen key to keep the stream from closing.

Stream auto closes after 60 minutes if no keep alive is send.

30 minute interval for keep alive is recommended.

restClient.Spot.UserStream.KeepAliveUserStream();

DELETE StopUserStream

Stops the current user stream

restClient.Spot.UserStream.StopUserStream();

Margin

POST StartUserStream

Starts a user stream for margin account by requesting a listen key.

This listen key can be used in subsequent requests to SubscribeToUserDataUpdates

The stream will close after 60 minutes unless a keep alive is send.

restClient.Margin.UserStream.StartUserStream();

PUT KeepAliveUserStream

Sends a keep alive for the current user stream for margin account listen key to keep the stream from closing.

Stream auto closes after 60 minutes if no keep alive is send. 30 minute interval for keep alive is recommended.

restClient.Margin.UserStream.KeepAliveUserStream();

DELETE StopUserStream

Close the user stream for the cross margin account

restClient.Margin.UserStream.StopUserStream();

Isolated

POST StartIsolatedUserStream

Starts a user stream for margin account by requesting a listen key.

This listen key can be used in subsequent requests to SubscribeToUserDataUpdates

The stream will close after 60 minutes unless a keep alive is send.

restClient.Margin.IsolatedUserStream.StartIsolatedMarginUserStream();

PUT KeepAliveIsolatedUserStream

Sends a keep alive for the current user stream for margin account listen key to keep the stream from closing.

Stream auto closes after 60 minutes if no keep alive is send. 30 minute interval for keep alive is recommended.

restClient.Margin.IsolatedUserStream.KeepAliveIsolatedMarginUserStream();

DELETE CloseIsolatedUserStream

Close the user stream for the isolated margin account

restClient.Margin.IsolatedUserStream.StopIsolatedMarginUserStream();

Common Endpoints

POST SetBnbBurnStatus

Sets the status of the BNB burn switch for spot trading and margin interest

restClient.General.SetBnbBurnStatus();

POST DustTransfer

Converts dust (small amounts of) assets to BNB

restClient.General.DustTransfer();

POST GetFundingWallet

Get funding wallet assets

restClient.General.GetFundingWallet();

POST Transfer

Transfers between accounts

restClient.General.Transfer();

GET GetUserCoins

Gets information of coins for a user

restClient.General.GetUserCoins();

GET GetAssetDividendRecords

Get asset dividend records

restClient.General.GetAssetDividendRecords();

GET GetBnbBurnStatus

Gets the status of the BNB burn switch for spot trading and margin interest

restClient.General.GetBnbBurnStatus();

GET GetServerTimeTicks

Get the server time ticks as reported by the binance server

long stt = await ServerTimeClient.GetServerTimeTicks().ConfigureAwait(false);

GET GetDustLog

Gets the history of dust conversions

restClient.General.GetDustLog();

GET GetExchangeInfo

Get's information about the exchange including rate limits and information on the provided symbol or symbols

restClient.Spot.System.GetExchangeInfo();

GET GetSystemStatus

Gets the status of the Binance platform

restClient.Spot.System.GetSystemStatus();

GET Ping

Pings the Binance API

restClient.Spot.System.Ping();

GET GetTradingStatus

Gets the trading status for the current account

restClient.General.GetTradingStatus();

GET GetTransfers

Get universal transfer history

restClient.General.GetTransfers();

Websocket Streams

WSS-maroon User Data Streams

Subscribes to the account update stream. Prior to using this, one of the StartUserStream methods should be called.

socketClient.UserDataStreams.Updates();

WSS-maroon SymbolTickerUpdates

Subscribes to ticker updates stream for a specific symbol

socketClient.Subscribe.SymbolTickerUpdates()

WSS-maroon AggregatedTradeUpdates

Subscribes to the aggregated trades update stream for the provided symbol

socketClient.Subscribe.AggregatedTradeUpdates()

WSS-maroon TradeUpdates

Subscribes to the trades update stream for the provided symbol

socketClient.Subscribe.TradeUpdates()

WSS-maroon KlineUpdates

Subscribes to the candlestick update stream for the provided symbols and intervals

socketClient.Subscribe.KlineUpdates()

WSS-maroon SymbolMiniTickerUpdates

Subscribes to mini ticker updates stream for a specific symbol or symbols

socketClient.Subscribe.SymbolMiniTickerUpdates()

WSS-maroon AllSymbolMiniTickerUpdates

Subscribes to mini ticker updates stream for all symbols

socketClient.Subscribe.AllSymbolMiniTickerUpdates()

WSS-maroon BookTickerUpdates

Subscribes to the book ticker update stream for the provided symbol or symbols

socketClient.Subscribe.BookTickerUpdates()

WSS-maroon AllBookTickerUpdates

Subscribes to the book ticker update stream for all symbols

socketClient.Subscribe.AllBookTickerUpdates()

WSS-maroon SymbolTickerUpdates

Subscribes to ticker updates stream for a specific symbol or symbols

socketClient.Subscribe.SymbolTickerUpdates()

WSS-maroon AllSymbolTickerUpdates

Subscribes to ticker updates stream for all symbols

socketClient.Subscribe.AllSymbolTickerUpdates()

Copyright S Christison ©2020-2024

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
26.1.0.35 20 4/28/2024
26.1.0.33 325 4/26/2024

This update
-----
Small optimization to RestClient
Update BinanceObjects package to v1.0.7.62

Recent
-----
CachableHttpRequestMessagePost is no longer required when placing orders

Improved CacheClient

Add Exception to RestError, Exception will have a value if the error was caused by an Exception

Add GetCacheSize to RestClientOptions
Add PostCacheSize to RestClientOptions
Add PutCacheSize to RestClientOptions
Add DeleteCacheSize to RestClientOptions

Add DeleteCache
Add GetCache
Add PostCache
Add PutCache

Remove SetNewAuthentication

Breaking changes can be fixed by looking at the Documentation/README for this version