-
Notifications
You must be signed in to change notification settings - Fork 77
Authentication
For REST API methods that require authentication, create a user instance (IBinanceApiUser
) providing your Binance account API-Key and API-Secret. The interface is IDisposable
due to an internal HMAC
used for signing requests (subsequently, the API-Secret is not stored as a property in the BinanceApiUser
class privately or otherwise).
NOTE: The IBinanceApiUserProvider
service allows for configurable dependency injection of the IApiRateLimiter
and IOptions<BinanceApiOptions>
implementations.
var userProvider = serviceProvider.GetService<IBinanceApiUserProvider>();
using (var user = userProvider.CreateUser("API-Key", "API-Secret"))
{
// ...
}
Optionally, without dependecy injection (and IBinanceApiUserProvider
).
using (var user = new BinanceApiUser("API-Key", "API-Secret"))
{
// ...
}
NOTE: User authentication is method injected -- only where required -- so a single Binance API instance supports multiple users.
NOTE: This 'user' variable is referenced in other examples.
When using the BinanceConsoleApp
sample you may see this message when accessing non-public API methods:
To access some Binance endpoint features, your API Key and Secret may be required. You can either modify the 'ApiKey' and 'ApiSecret' configuration values in appsettings.json.
Or use the following commands to configure the .NET user secrets for the project:
dotnet user-secrets set BinanceApiKey <your api key>
dotnet user-secrets set BinanceApiSecret <your api secret>
For more information: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets
- Verify connection to the Binance server (minimal examples).
- Get the market depth (order book) for a symbol.
- Maintain a real-time order book cache for a symbol.
- Get the aggregate trades for a symbol.
- Maintain a real-time trade history cache for a symbol.
- Get the candlesticks for a symbol.
- Maintain a real-time price chart cache for a symbol.
- Get the 24-hour statistics for a symbol.
- Get current prices for all symbols for a price ticker.
- Get best price and quantity on the order book for all symbols.
- Get a list of all current symbols.
- Place a LIMIT order.
- Place a MARKET order.
- Place a TEST order to verify client order properties.
- Look-up an existing order to check status.
- Cancel an open order.
- Get all open orders for a symbol.
- Get all orders for a symbol.
- Get current account information.
- Get account trades for a symbol.
- Submit a withdraw request.
- Get deposit history.
- Get withdraw history.
- Donate BTC to the creator of this library.