HitBTC.Connector
1.0.1
dotnet add package HitBTC.Connector --version 1.0.1
NuGet\Install-Package HitBTC.Connector -Version 1.0.1
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="HitBTC.Connector" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HitBTC.Connector" Version="1.0.1" />
<PackageReference Include="HitBTC.Connector" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HitBTC.Connector --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HitBTC.Connector, 1.0.1"
#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.
#:package HitBTC.Connector@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HitBTC.Connector&version=1.0.1
#tool nuget:?package=HitBTC.Connector&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HitBTC.Connector
.NET License
High-performance, lock-free C# connector for HitBTC cryptocurrency exchange API v3.
โจ Features
๐ High Performance โ Lock-free data structures, zero-allocation hot paths, ArrayPool usage
๐ Thread-Safe โ MPSC queues, concurrent collections, safe for multi-threaded trading
๐ก REST API โ Full support for public, spot, and futures endpoints
๐ WebSocket โ Real-time market data and order updates
๐ Authentication โ HS256 HMAC signature with automatic request signing
๐ช Robust โ Safe decimal parsing, comprehensive error handling
๐งช Tested โ Unit, integration, and stress tests included
๐ฆ Installation
dotnet add package HitBTC.Connector
Or add to your .csproj:
<PackageReference Include="HitBTC.Connector" Version="1.0.0" />
๐ Quick Start
REST Client โ Public Data
using HitBTC.Connector.Rest;
using HitBTC.Connector.Core.Models;
// Public API (no authentication required)
await using var client = new HitBtcRestClient("", "");
// Get symbols
var symbols = await client.GetSymbolsAsync();
var btcUsdt = symbols["BTCUSDT"];
Console.WriteLine($"BTCUSDT tick size: {btcUsdt.TickSize}");
// Get order book
using var orderBook = await client.GetOrderBookAsync("BTCUSDT", depth: 10);
Console.WriteLine($"Best bid: {orderBook.Bids[0].Price}, Best ask: {orderBook.Asks[0].Price}");
Console.WriteLine($"Spread: {orderBook.Asks[0].Price - orderBook.Bids[0].Price}");
// Get candles
var candles = await client.GetCandlesAsync("BTCUSDT", CandlePeriod.H1, limit: 24);
foreach (var c in candles)
{
Console.WriteLine($"{c.Timestamp:HH:mm} O:{c.Open} H:{c.High} L:{c.Low} C:{c.Close}");
}
REST Client โ Spot Trading
await using var client = new HitBtcRestClient("YOUR_API_KEY", "YOUR_SECRET_KEY");
// Get active orders
var orders = await client.GetActiveSpotOrdersAsync();
// Place limit order
var order = await client.CreateSpotOrderAsync(new CreateSpotOrderRequest
{
Symbol = "BTCUSDT",
Side = OrderSide.Buy,
Quantity = 0.001m,
Price = 50000m,
Type = OrderType.Limit,
TimeInForce = TimeInForce.GTC,
PostOnly = true
});
Console.WriteLine($"Order placed: {order.ClientOrderId}");
// Replace order
var replaced = await client.ReplaceSpotOrderAsync(order.ClientOrderId, new ReplaceSpotOrderRequest
{
Quantity = 0.002m,
Price = 49000m
});
// Cancel order
var canceled = await client.CancelSpotOrderAsync(replaced.ClientOrderId);
// Cancel all orders
await client.CancelAllSpotOrdersAsync(symbol: "BTCUSDT");
REST Client โ Futures Trading
await using var client = new HitBtcRestClient("YOUR_API_KEY", "YOUR_SECRET_KEY");
// Get futures balance
var balances = await client.GetFuturesBalanceAsync();
foreach (var b in balances)
{
Console.WriteLine($"{b.Currency}: {b.Available} available");
}
// Create/update margin account
var account = await client.CreateOrUpdateMarginAccountAsync(
MarginMode.Isolated,
"BTCUSDT_PERP",
marginBalance: 100m,
leverage: 25m
);
// Place futures order
var futuresOrder = await client.CreateFuturesOrderAsync(new CreateFuturesOrderRequest
{
Symbol = "BTCUSDT_PERP",
Side = OrderSide.Buy,
Quantity = 0.01m,
Price = 50000m,
Type = OrderType.Limit,
MarginMode = MarginMode.Isolated,
ReduceOnly = false
});
// Close position
await client.CloseFuturesPositionAsync(
MarginMode.Isolated,
"BTCUSDT_PERP",
new ClosePositionRequest { Price = 51000m }
);
// Close margin account (withdraw all funds)
await client.CloseMarginAccountAsync(MarginMode.Isolated, "BTCUSDT_PERP");
๐ API Coverage
REST API
| Category | Endpoints | Status |
|---|---|---|
| Public | Symbols, OrderBook, Candles, Trades | โ |
| Spot Trading | Get/Create/Replace/Cancel Orders | โ |
| Futures Trading | Orders, Positions, Margin Accounts | โ |
| Futures Balance | Get Balance by Currency | โ |
| Margin Management | Create/Update/Close Accounts, Leverage | โ |
โก Performance Features
- Lock-Free Object Pool โ Reuse objects without locks
- MPSC Queue โ Multi-producer single-consumer for WebSocket messages
- ValueStringBuilder โ Stack-allocated string building
- ArrayPool โ Rent/return buffers for OrderBook levels
- Span/Memory โ Zero-copy data access where possible
- SocketsHttpHandler โ HTTP/2, connection pooling
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release v1.0.0:
โข Full HitBTC API v3 support (REST + WebSocket)
โข Spot trading (orders, balances)
โข Futures trading (margin accounts, positions, leverage)
โข Real-time market data (order book, trades, candles)
โข Lock-free high-performance architecture
โข HS256 HMAC authentication
โข Comprehensive unit and integration tests