Class BinanceApiClient
Provides access to non-streaming Binance market data via the rest api.
Inheritance
System.Object
BinanceApiClient
Assembly: FFT.Binance.dll
Syntax
public sealed class BinanceApiClient : DisposeBase, IDisposable
Constructors
|
Improve this Doc
View Source
BinanceApiClient(Nullable<BinanceApiClientOptions>)
Initializes a new instance of the BinanceApiClient class
and triggers immediate connection to the streaming websocket.
Declaration
public BinanceApiClient(BinanceApiClientOptions? options = null)
Parameters
| Type |
Name |
Description |
| System.Nullable<BinanceApiClientOptions> |
options |
Configures the client, particularly for
authentication. Can be left null if you are only accessing
functions that do not require authentication and are happy with all
default values..
|
Properties
|
Improve this Doc
View Source
Options
Declaration
public BinanceApiClientOptions Options { get; }
Property Value
| Type |
Description |
| BinanceApiClientOptions |
|
|
Improve this Doc
View Source
RetryAfterSeconds
The number of seconds required to wait, in the case of a 429, to prevent
a ban, or, in the case of a 418, until the ban is over.
Declaration
public int RetryAfterSeconds { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
|
Improve this Doc
View Source
UsedWeight
Current used weight for the local IP for all request rate limiters
defined.
Declaration
public int UsedWeight { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Methods
|
Improve this Doc
View Source
CustomDispose()
Declaration
protected override void CustomDispose()
|
Improve this Doc
View Source
GetAggregateTrades(String, TimeStamp, TimeStamp, CancellationToken)
Get compressed, aggregate trades. Trades that fill at the time, from the
same taker order, with the same price will have the quantity aggregated.
Declaration
public Task<ImmutableList<AggregateTrade>> GetAggregateTrades(string symbol, TimeStamp from, TimeStamp until, CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| System.String |
symbol |
|
| TimeStamp |
from |
|
| TimeStamp |
until |
|
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<ImmutableList<AggregateTrade>> |
|
|
Improve this Doc
View Source
Gets general information from the exchange.
Declaration
public Task<ExchangeInfoResponse> GetExchangeInformation(CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<ExchangeInfoResponse> |
|
|
Improve this Doc
View Source
GetLastPrice(String, CancellationToken)
Get the last trade price for the given symbol.
Declaration
public Task<LastPrice> GetLastPrice(string symbol, CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| System.String |
symbol |
|
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
GetLastPrices(CancellationToken)
Get the last traded price for all instruments on the exchange.
Declaration
public Task<ImmutableList<LastPrice>> GetLastPrices(CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| CancellationToken |
cancellationToken |
|
Returns
| Type |
Description |
| Task<ImmutableList<LastPrice>> |
|
|
Improve this Doc
View Source
GetOrderBook(String, Int32, CancellationToken)
Gets the current order book for the given symbol to a
maximum depth of limit values.
Declaration
public Task<OrderBookResponse> GetOrderBook(string symbol, int limit = 100, CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| System.String |
symbol |
|
| System.Int32 |
limit |
|
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
GetServerTime(CancellationToken)
Gets the current time on the Binance api server.
Declaration
public Task<ServerTimeResponse> GetServerTime(CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
GetTopOrderBook(String, CancellationToken)
Get the top order book for the given symbol.
Declaration
public Task<TopOrderBook> GetTopOrderBook(string symbol, CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| System.String |
symbol |
|
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
GetTopOrderBooks(CancellationToken)
Get the top order book for all instruments.
Declaration
public Task<ImmutableList<TopOrderBook>> GetTopOrderBooks(CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
GetTrades(String, Int32, CancellationToken)
Gets the most recent trades for the given symbol up
to maximum limit number of values. Values are
returned in ascending chronological order.
Declaration
public Task<ImmutableList<HistoricalTrade>> GetTrades(string symbol, int limit = 500, CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| System.String |
symbol |
|
| System.Int32 |
limit |
|
| CancellationToken |
cancellationToken |
|
Returns
|
Improve this Doc
View Source
TestConnectivity(CancellationToken)
This method completes successfully if a connection ping test succeeded.
Declaration
public Task TestConnectivity(CancellationToken cancellationToken = null)
Parameters
| Type |
Name |
Description |
| CancellationToken |
cancellationToken |
|
Returns
Implements
IDisposable