BI.PersianCryotoExchange.Wallex.Net
1.0.0
dotnet add package BI.PersianCryotoExchange.Wallex.Net --version 1.0.0
NuGet\Install-Package BI.PersianCryotoExchange.Wallex.Net -Version 1.0.0
<PackageReference Include="BI.PersianCryotoExchange.Wallex.Net" Version="1.0.0" />
<PackageVersion Include="BI.PersianCryotoExchange.Wallex.Net" Version="1.0.0" />
<PackageReference Include="BI.PersianCryotoExchange.Wallex.Net" />
paket add BI.PersianCryotoExchange.Wallex.Net --version 1.0.0
#r "nuget: BI.PersianCryotoExchange.Wallex.Net, 1.0.0"
#:package BI.PersianCryotoExchange.Wallex.Net@1.0.0
#addin nuget:?package=BI.PersianCryotoExchange.Wallex.Net&version=1.0.0
#tool nuget:?package=BI.PersianCryotoExchange.Wallex.Net&version=1.0.0
Wallex API Wrapper for .NET
A comprehensive .NET library for interacting with the Wallex cryptocurrency exchange API. This library provides a strongly-typed, async/await-based interface for all Wallex API endpoints including market data, account management, order execution, and real-time WebSocket connections.
Features
- ✅ Complete API Coverage: All public and authenticated endpoints
- ✅ Strongly Typed Models: Full IntelliSense support with strongly-typed DTOs
- ✅ Async/Await: Modern asynchronous programming patterns
- ✅ WebSocket Support: Real-time market data via Socket.IO
- ✅ Error Handling: Comprehensive error handling with detailed error messages
- ✅ Pagination Support: Built-in support for paged API responses
- ✅ Flexible JSON Deserialization: Handles various JSON formats (string/number conversions)
- ✅ IDisposable Pattern: Proper resource cleanup
Installation
Using NuGet Package Manager
Install-Package BI.PersianCryotoExchange.Wallex.Net
Using .NET CLI
dotnet add package BI.PersianCryotoExchange.Wallex.Net
Manual Installation
- Clone this repository
- Add the project to your solution
- Reference the project in your application
Quick Start
Basic Usage (Public Endpoints)
using BI.PersianCryotoExchange.Wallex.Net;
// Create client (no API key needed for public endpoints)
var client = new WallexApiClient();
// Get market list
var markets = await client.Markets.GetMarketsAsync();
if (markets.Success && markets.Result != null)
{
foreach (var market in markets.Result.Symbols)
{
Console.WriteLine($"{market.Key}: {market.Value.Symbol}");
}
}
// Get order book
var orderBook = await client.Markets.GetOrderBookAsync("BTCUSDT");
if (orderBook.Success && orderBook.Result != null)
{
Console.WriteLine($"Bids: {orderBook.Result.Bids.Count}");
Console.WriteLine($"Asks: {orderBook.Result.Asks.Count}");
}
// Get latest trades
var trades = await client.Markets.GetLatestTradesAsync("BTCUSDT");
if (trades.Success && trades.Result != null)
{
foreach (var trade in trades.Result.LatestTrades.Take(10))
{
Console.WriteLine($"Price: {trade.Price}, Quantity: {trade.Quantity}");
}
}
Authenticated Endpoints
using BI.PersianCryotoExchange.Wallex.Net;
// Create client with API key
var client = new WallexApiClient("your-api-key-here");
// Get account profile
var profile = await client.Account.GetProfileAsync();
if (profile.Success && profile.Result != null)
{
Console.WriteLine($"Email: {profile.Result.Email}");
Console.WriteLine($"Phone: {profile.Result.Phone}");
}
// Get balances
var balances = await client.Account.GetBalancesAsync();
if (balances.Success && balances.Result != null)
{
foreach (var balance in balances.Result.Balances)
{
Console.WriteLine($"{balance.Key}: {balance.Value.Value}");
}
}
// Place an order
var orderRequest = new PlaceOrderRequest
{
Symbol = "BTCUSDT",
Side = "BUY",
Type = "LIMIT",
Quantity = "0.001",
Price = "50000",
ClientId = Guid.NewGuid().ToString()
};
var order = await client.Orders.PlaceOrderAsync(orderRequest);
if (order.Success && order.Result != null)
{
Console.WriteLine($"Order placed: {order.Result.ClientOrderId}");
}
// Get active orders
var activeOrders = await client.Orders.GetActiveOrdersAsync();
if (activeOrders.Success && activeOrders.Result != null)
{
foreach (var order in activeOrders.Result.Orders)
{
Console.WriteLine($"Order: {order.Symbol} - {order.Side} - {order.Status}");
}
}
WebSocket Real-Time Data
using BI.PersianCryotoExchange.Wallex.Net;
var client = new WallexApiClient();
var webSocket = client.WebSocket;
// Subscribe to connection events
webSocket.OnConnected += () => Console.WriteLine("Connected to WebSocket");
webSocket.OnDisconnected += (reason) => Console.WriteLine($"Disconnected: {reason}");
webSocket.OnError += (error) => Console.WriteLine($"Error: {error}");
// Connect
await webSocket.ConnectAsync();
// Subscribe to trade updates
await webSocket.SubscribeTradeAsync("BTCUSDT", trade =>
{
Console.WriteLine($"Trade: {trade.Price} x {trade.Quantity}");
});
// Subscribe to buy depth
await webSocket.SubscribeBuyDepthAsync("BTCUSDT", depth =>
{
Console.WriteLine($"Buy Depth: {depth.Entries.Count} entries");
});
// Subscribe to sell depth
await webSocket.SubscribeSellDepthAsync("BTCUSDT", depth =>
{
Console.WriteLine($"Sell Depth: {depth.Entries.Count} entries");
});
// Cleanup
client.Dispose();
API Reference
Market Service
| Method | Description | Requires API Key |
|---|---|---|
GetMarketsAsync() |
Get list of all available markets | No |
GetCurrencyStatsAsync() |
Get global cryptocurrency statistics | No |
GetOrderBookAsync(symbol) |
Get order book for a specific market | No |
GetAllOrderBooksAsync() |
Get order books for all markets | No |
GetLatestTradesAsync(symbol) |
Get latest trades for a market | No |
GetOhlcDataAsync(symbol, resolution, from, to) |
Get OHLC (candles) data | No |
Account Service
| Method | Description | Requires API Key |
|---|---|---|
GetProfileAsync() |
Get user profile information | Yes |
GetFeeAsync() |
Get user level and fees | Yes |
GetCardNumbersAsync() |
Get bank card numbers | Yes |
GetIbansAsync() |
Get bank IBANs | Yes |
GetBalancesAsync() |
Get wallet balances | Yes |
GetCryptoDepositsAsync(page, perPage) |
Get crypto deposits list | Yes |
GetCryptoWithdrawalsAsync(page, perPage) |
Get crypto withdrawals list | Yes |
RegisterCryptoWithdrawalAsync(request) |
Register crypto withdrawal | Yes |
RegisterTomanWithdrawalAsync(request) |
Register Toman withdrawal | Yes |
Order Service
| Method | Description | Requires API Key |
|---|---|---|
PlaceOrderAsync(request) |
Place a new order | Yes |
GetOrderAsync(clientOrderId) |
Get order information | Yes |
CancelOrderAsync(clientOrderId) |
Cancel an order | Yes |
GetActiveOrdersAsync(symbol) |
Get active orders | Yes |
GetUserTradesAsync(symbol, side) |
Get user's latest trades | Yes |
OTC Service
| Method | Description | Requires API Key |
|---|---|---|
GetOtcMarketsAsync() |
Get instant trade markets list | Yes |
GetOtcPriceAsync(symbol, side) |
Get instant trade price | Yes |
PlaceOtcOrderAsync(request) |
Place instant order | Yes |
WebSocket Service
| Method | Description | Requires API Key |
|---|---|---|
ConnectAsync() |
Connect to WebSocket server | No |
DisconnectAsync() |
Disconnect from WebSocket server | No |
SubscribeTradeAsync(symbol, callback) |
Subscribe to trade updates | No |
SubscribeBuyDepthAsync(symbol, callback) |
Subscribe to buy depth | No |
SubscribeSellDepthAsync(symbol, callback) |
Subscribe to sell depth | No |
SubscribeMarketCapAsync(symbol, callback) |
Subscribe to market cap | No |
Unsubscribe(channel) |
Unsubscribe from a channel | No |
Error Handling
All API methods return an ApiResponse<T> object with the following structure:
public class ApiResponse<T>
{
public bool Success { get; set; }
public string? Message { get; set; }
public T? Result { get; set; }
public int? ErrorCode { get; set; }
}
Example error handling:
var response = await client.Markets.GetMarketsAsync();
if (!response.Success)
{
Console.WriteLine($"Error: {response.Message}");
Console.WriteLine($"Error Code: {response.ErrorCode}");
}
else if (response.Result != null)
{
// Process successful response
}
Requirements
- .NET 9.0 or higher
- SocketIOClient 3.1.0 (for WebSocket support)
Support
For issues, questions, or contributions, please open an issue on GitHub.
Disclaimer
This library is not officially affiliated with Wallex. Use at your own risk. Always test thoroughly before using in production.
| 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. |
-
net9.0
- SocketIOClient (>= 3.1.0)
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.0 | 166 | 12/29/2025 |