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" />
                    
Directory.Packages.props
<PackageReference Include="HitBTC.Connector" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=HitBTC.Connector&version=1.0.1
                    
Install as a Cake Tool

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 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.

Version Downloads Last Updated
1.0.1 90 4/6/2026
1.0.0 81 4/5/2026

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