All Projects → sonvister → Binance

sonvister / Binance

Licence: mit
A .NET Standard Binance API library.

Projects that are alternatives of or similar to Binance

Coingecko Api
A Node.js wrapper for the CoinGecko API with no dependencies.
Stars: ✭ 159 (-20.1%)
Mutual labels:  api, api-client, api-wrapper, cryptocurrency
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+300%)
Mutual labels:  api, api-client, api-wrapper
Python Poloniex
Poloniex API wrapper for Python 2.7 & 3
Stars: ✭ 557 (+179.9%)
Mutual labels:  api, api-wrapper, cryptocurrency
Python Binance Chain
Binance Chain Exchange API python implementation for automated trading
Stars: ✭ 96 (-51.76%)
Mutual labels:  api, cryptocurrency, binance
Crypto Exchanges Gateway
Your gateway to the world of crypto !
Stars: ✭ 343 (+72.36%)
Mutual labels:  api, cryptocurrency, binance
Binance.net
.Net API wrapper for the Binance web API
Stars: ✭ 349 (+75.38%)
Mutual labels:  api-wrapper, cryptocurrency, binance
Apipie
Transform api declaration to js object for frontend. Inspired by VueRouter, koa-middleware and axios.
Stars: ✭ 29 (-85.43%)
Mutual labels:  api, api-client, api-wrapper
Php Bitcoinrpc
Fully unit-tested Bitcoin JSON-RPC client based on GuzzleHttp.
Stars: ✭ 231 (+16.08%)
Mutual labels:  api, api-client, cryptocurrency
Binancedotnet
Official C# Wrapper for the Binance exchange API, with REST and WebSocket endpoints
Stars: ✭ 102 (-48.74%)
Mutual labels:  api-wrapper, cryptocurrency, binance
Coinbase Pro Node
Coinbase Pro API written in TypeScript and covered by tests.
Stars: ✭ 116 (-41.71%)
Mutual labels:  api, api-client, cryptocurrency
Virustotal Api
Virus Total Public/Private/Intel API
Stars: ✭ 189 (-5.03%)
Mutual labels:  api, api-client, api-wrapper
Pycoingecko
Python wrapper for the CoinGecko API
Stars: ✭ 270 (+35.68%)
Mutual labels:  api, api-wrapper, cryptocurrency
Hubspot Php
HubSpot PHP API Client
Stars: ✭ 273 (+37.19%)
Mutual labels:  api, api-client, api-wrapper
Python Binance
Binance Exchange API python implementation for automated trading
Stars: ✭ 4,114 (+1967.34%)
Mutual labels:  api, cryptocurrency, binance
Bittrex.net
A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable
Stars: ✭ 131 (-34.17%)
Mutual labels:  api, api-wrapper, cryptocurrency
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+353.77%)
Mutual labels:  api, api-client, api-wrapper
Binance.api.csharp.client
C#.NET client for Binance Exchange API.
Stars: ✭ 98 (-50.75%)
Mutual labels:  api, cryptocurrency, binance
Anyapi
AnyAPI is a library that helps you to write any API wrappers with ease and in pythonic way.
Stars: ✭ 126 (-36.68%)
Mutual labels:  api, api-client, api-wrapper
Cryptocurrency Portfolio
Google Sheets automatic creation with Google Apps Script (GAS) for managing a cryptocurrency tracking spreadsheet with multi exchanges
Stars: ✭ 134 (-32.66%)
Mutual labels:  api, cryptocurrency, binance
Mobx Rest
REST conventions for Mobx
Stars: ✭ 164 (-17.59%)
Mutual labels:  api, api-client

Binance

A .NET API library (a.k.a. wrapper) for the official Binance web API.

Compatible with .NET Standard 2.0 and .NET Framework 4.7.1

Built using TAP (Task-based Asynchronous Pattern).

Features

  • Beta release with majority coverage of the official Binance API including REST API and Web Sockets.
    • NOTE: Not actively adding new features or providing support...
    • Binance account API-Key is not required to access the public REST and Web Socket endpoints (most market data).
  • Easy-to-use Web Socket managers (with combined streams) and in-memory cache implementations (with events).
  • Convenient assets and symbols (e.g. Symbol.BTC_USDT) with exchange info (price/quantity: min, max, etc.).
    • With methods for validating (w/ or w/o exceptions) client order price, quantity, and type for a symbol.
  • REST API includes automatic rate limiting and system-to-server time synchronization for reliability.
    • Advanced rate limiting includes distinct (request and order) rate limiters with endpoint weights incorporated.
  • Unique REST API implementation supports multiple users and requires user authentication only where necessary.
  • REST API exceptions provide the Binance server response ERROR code and message for easier troubleshooting.
  • REST API (low-level) utilizes a single, cached HttpClient for performance (implemented as singleton).
  • Simple API abstraction using domain/value objects that do not expose underlying (HTTP/REST) behavior.
    • Consistent use of domain models between REST API queries and real-time Web Socket client events.
  • Customizable multi-layer API with access to (low-level) JSON responses or deserialized domain/value objects.
    • Same serializers used in BinanceApi are available for application-level deserialization of JSON data.
  • Limited dependencies with use of Microsoft extensions for dependency injection, logging, and options.
  • Multiple .NET sample applications including live displays of market depth, trades, and candlesticks for a symbol.
    • Alternative IWebSocketClients for using WebSocketSharp or WebSocket4Net (for Windows 7 compatibility).
    • How to efficiently use combined streams with a single, application-wide, web socket (BinanceWebSocketStream).

Getting Started

Binance Sign-up

To use the private (authenticated) API methods you must have an account with Binance and create an API-Key. Please use my Referral ID: 10899093 when you Register (it's an easy way to give back at no cost to you).

NOTE: An account is not required to access the public market data.

Installation

Using Nuget Package Manager:

PM> Install-Package Binance


Example Usage

REST API

Test connectivity.

using Binance;

// Initialize REST API client.
var api = new BinanceApi();

// Check connectivity.
if (await api.PingAsync())
{
    Console.WriteLine("Successful!");
}

Place a TEST market order.

using Binance;

var api = new BinanceApi();

// Create user with API-Key and API-Secret.
using (var user = new BinanceApiUser("<API-Key>", "<API-Secret>"))
{
    // Create a client (MARKET) order.
    var clientOrder = new MarketOrder(user)
    {
        Symbol = Symbol.BTC_USDT,
        Side = OrderSide.Buy,
        Quantity = 0.01m
    };

    try
    {
        // Send the TEST order.
        await api.TestPlaceAsync(clientOrder);
        
        Console.WriteLine("TEST Order Successful!");
    }
    catch (Exception e)
    {
        Console.WriteLine($"TEST Order Failed: \"{e.Message}\"");
    }
}

Web Socket

Get real-time aggregate trades (with automatic web socket re-connect).

using Binance;
using Binance.WebSocket;

// Initialize web socket client (with automatic streaming).
var webSocketClient = new AggregateTradeWebSocketClient();

// Handle error events.
webSocketClient.Error += (s, e) => { Console.WriteLine(e.Exception.Message); };

// Subscribe callback to BTC/USDT (automatically begin streaming).
webSocketClient.Subscribe(Symbol.BTC_USDT, evt =>
{
    var side = evt.Trade.IsBuyerMaker ? "SELL" : "BUY ";
	
    // Handle aggregate trade events.
    Console.WriteLine($"{evt.Trade.Symbol} {side} {evt.Trade.Quantity} @ {evt.Trade.Price}");
});

// ...

// Unsubscribe (automatically end streaming).
webSocketClient.Unsubscribe();

Maintain real-time order book (market depth) cache.

using Binance;
using Binance.Cache;
using Binance.WebSocket;

// Initialize web socket cache (with automatic streaming).
var webSocketCache = new DepthWebSocketCache();

// Handle error events.
webSocketCache.Error += (s, e) => { Console.WriteLine(e.Exception.Message); };

// Subscribe callback to BTC/USDT (automatically begin streaming).
webSocketCache.Subscribe(Symbol.BTC_USDT, evt =>
{
    // Get symbol from cache (update cache if a symbol is missing).
    var symbol = Symbol.Cache.Get(evt.OrderBook.Symbol);

    var minBidPrice = evt.OrderBook.Bids.Last().Price;
    var maxAskPrice = evt.OrderBook.Asks.Last().Price;

    // Handle order book update events.
    Console.WriteLine($"Bid Quantity: {evt.OrderBook.Depth(minBidPrice)} {symbol.BaseAsset} - " +
                      $"Ask Quantity: {evt.OrderBook.Depth(maxAskPrice)} {symbol.BaseAsset}");
});

// ...

// Unsubscribe (automatically end streaming).
webSocketCache.Unsubscribe();

Documentation

See: Wiki

NOTE: The samples demonstrate up-to-date usage of this library.

Binance Exchange API (for reference)

REST/WebSocket details: Binance Official Documentation
REST/WebSocket questions: Binance Official API Telegram (not for questions about this library)

Development

The master branch is currently used for development and may differ from the latest release.
To get the source code for a particular release, first select the corresponding Tag.

Build Environment

Microsoft Visual Studio Community 2017

Build status

Donate

Decred (DCR): Dsd7amDBfC7n6G93NJzbaJjUdiSeN5D3tmR

Thank you.

Follow @sonvister

Donate NIM

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].