EasyTrading.Core
1.2.2
See the version list below for details.
dotnet add package EasyTrading.Core --version 1.2.2
NuGet\Install-Package EasyTrading.Core -Version 1.2.2
<PackageReference Include="EasyTrading.Core" Version="1.2.2" />
<PackageVersion Include="EasyTrading.Core" Version="1.2.2" />
<PackageReference Include="EasyTrading.Core" />
paket add EasyTrading.Core --version 1.2.2
#r "nuget: EasyTrading.Core, 1.2.2"
#:package EasyTrading.Core@1.2.2
#addin nuget:?package=EasyTrading.Core&version=1.2.2
#tool nuget:?package=EasyTrading.Core&version=1.2.2
EasyTrading
A .NET client for decentralised perpetual and spot exchanges. One IExchangeClient interface across every supported DEX; per-DEX clients add only what's venue-specific (e.g. vaults and staking on HyperLiquid).
- Targets:
net8.0,net9.0 - API reference: polius2007.github.io/EasyTrading (auto-generated DocFX site)
- Source: github.com/polius2007/EasyTrading
- License: MIT — see LICENSE
Status
| Exchange | Package | REST | WebSocket | Signing | Latest |
|---|---|---|---|---|---|
| HyperLiquid | EasyTrading.HyperLiquid |
✅ | ✅ | ✅ | 1.2.0 |
| Aster | EasyTrading.Aster |
✅ | ✅ | ✅ | 1.2.0 |
| dYdX v4 | EasyTrading.Dydx |
✅ | ✅ | ✅ | 1.2.0 |
Coverage summary:
- HyperLiquid is stable. All Info (read) and Exchange (write) endpoints, including TWAP,
scheduled cancel, sub-accounts, vaults, and staking. EIP-712 L1 and user-signed actions;
byte-identical msgpack encoding with the Python reference SDK. WebSocket: 9 channels,
per-subscriber back-pressure, automatic reconnect with exponential backoff. Pre-flight
order validation (tick / lot / min-notional). REST retry policy with backoff + jitter,
honours
Retry-Afteron 429. WebSocket gap recovery: on reconnect, user streams auto-fetch missed events via REST and deduplicate against the live feed. - Aster Finance is stable. Same surface, EIP-712 signing with
AsterSignTransactiondomain. Pre-flight validator wired to/fapi/v3/exchangeInfofilters (PRICE_FILTER / LOT_SIZE / MIN_NOTIONAL). WebSocket: Binance-style multiplex (market + listenKey-bound user streams with 30-min keepalive). - dYdX v4 is stable. Indexer REST + public WebSocket + signed Indexer reads + full
Cosmos SDK transaction assembly (BIP-39 → BIP-32 → secp256k1 → bech32 → protobuf
TxRaw→ REST broadcast). End-to-end verified on testnet:Testnet_PlaceLimit_and_Cancelplaces a far-from-market post-only BTC-USD buy from a freshly-faucet-funded wallet and cancels it; the chain accepts both.dydx-mainnet-1anddydx-testnet-4chain IDs supported out of the box.
Tests: 146 unit + 16 integration (live mainnet across HL, Aster, dYdX, plus dYdX testnet PlaceLimit + Cancel write verification), all green.
Install
dotnet add package EasyTrading.HyperLiquid
# or
dotnet add package EasyTrading.Aster
Either pulls EasyTrading.Abstractions and EasyTrading.Core transitively.
Quick start
using EasyTrading.Abstractions;
using EasyTrading.Aster;
using EasyTrading.HyperLiquid;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var host = Host.CreateApplicationBuilder(args);
host.Services
.AddEasyTrading()
.AddHyperLiquid(o =>
{
o.Network = HyperLiquidNetwork.Mainnet;
o.Credentials = new HyperLiquidCredentials(
masterAddress: "0xYourMasterAddress",
privateKey: Environment.GetEnvironmentVariable("HL_AGENT_KEY")!,
agentName: "easy-bot");
})
.AddAster(o =>
{
o.Network = AsterNetwork.Mainnet;
o.Credentials = new AsterCredentials(
MasterAddress: "0xYourMasterAddress",
SignerAddress: "0xYourSignerAddress",
PrivateKey: Environment.GetEnvironmentVariable("ASTER_SIGNER_KEY")!);
});
using var app = host.Build();
var hl = app.Services.GetRequiredService<IHyperLiquidExchange>();
var aster = app.Services.GetRequiredService<IAsterExchange>();
// Read — works without credentials.
var mids = await hl.Markets.GetAllMidsAsync();
var book = await aster.Markets.GetOrderBookAsync("BTCUSDT", depth: 20);
// Write — signed.
var placed = await hl.Orders.PlaceLimitAsync(
symbol: "BTC", side: OrderSide.Buy,
price: 60_000m, size: 0.01m,
tif: TimeInForce.Alo);
// Stream.
await foreach (var trade in hl.Streams.TradesAsync("BTC", default))
Console.WriteLine($"{trade.Trade.Price} {trade.Trade.Size}");
To write a strategy that doesn't care which venue it runs against, inject IExchangeClient
instead of the venue-specific surface — every supported DEX implements the same shape.
A more complete walk-through with credential setup, agent wallets, and testnet-first guidance lives in docs/getting-started.md. Common patterns are collected in docs/recipes.md.
API surface
Methods are grouped by entity. Everything about orders is on Orders; everything about positions is on Positions; and so on.
| Group | What it covers |
|---|---|
Markets |
Symbols, order book, candles, mids, funding |
Orders |
Place / modify / cancel / batch / TWAP / open / history |
Positions |
Read positions, set leverage, add/reduce margin, close |
Trades |
Your fills (by symbol, by order, by time) |
Account |
Balances, fees, portfolio, sub-accounts, agents, rate limit |
Transfers |
Withdraw, internal transfers, spot ↔ perp, sub-account moves |
Streams |
WebSocket subscriptions (public + user) via IAsyncEnumerable |
Vaults (HL only) |
Vault details, deposit, withdraw |
Staking (HL only) |
Delegate / undelegate / rewards |
Design notes
decimaleverywhere for money — neverdouble/float.- DTOs are immutable
recordtypes. - Async methods end with
Async;CancellationToken ct = defaultis the last parameter on every method. - WebSocket subscriptions are
IAsyncEnumerable<T>— iterate withawait foreachand cancel by cancelling the token. - Optional venue features are gated by
client.Capabilities.HasFlag(ExchangeCapabilities.X). - Typed exceptions only:
RateLimitException,InsufficientFundsException,InvalidOrderException,AuthenticationException,SigningException,ExchangeApiException.
Roadmap
- HyperLiquid — REST + WebSocket + EIP-712 signing + hardening →
1.2.0 - Aster — REST + WebSocket + EIP-712 signing →
1.2.0 - dYdX v4 — Indexer REST + WebSocket + Cosmos SDK signing (BIP-39 → BIP-32 → secp256k1 → bech32, full proto stack, REST broadcast), end-to-end verified on testnet →
1.2.0
Documentation
| Getting started (tutorial) | docs/getting-started.md |
| Recipes (common patterns) | docs/recipes.md |
| API reference (auto-generated) | polius2007.github.io/EasyTrading |
| Changelog | CHANGELOG.md |
| Contributing | CONTRIBUTING.md |
| Security policy | SECURITY.md |
For AI coding assistants
The repo ships first-class instructions so IDE assistants generate correct code without prompting:
| Tool | File |
|---|---|
| Universal (any AI) | AGENTS.md |
| Claude Code | CLAUDE.md |
| GitHub Copilot | .github/copilot-instructions.md |
| Cursor IDE | .cursor/rules/easytrading.mdc |
| LLM crawlers / RAG | llms.txt |
These files travel with the source; any fork or clone inherits the same guidance.
Disclaimer
This software is provided "as is", without warranty of any kind. Trading derivatives carries significant financial risk; use at your own responsibility. The authors are not affiliated with HyperLiquid, Aster, dYdX, or any other exchange.
The HyperLiquid client attaches a 0.5 bps (0.005%) builder fee to every order by default — this funds continued development. The fee is well below typical taker rates and visible on-chain as a separate field on each order action. The library calls approveBuilderFee once per account on the first order; nothing else is required from the consumer. To route fees to your own address set HyperLiquidClientOptions.BuilderFee; to opt out entirely, set its FeeRate to 0m.
Note on agent wallets and builder approval. HyperLiquid requires
approveBuilderFeeto be signed by the master wallet, not an agent wallet. If you initialise the client with an agent key (the recommended production setup), you have two options:
- Manual one-time approval (simplest): visit
app.hyperliquid.xyz/builderCodes, connect your master wallet, and approve the EasyTrading builder address with at least the default 0.5 bps rate. Subsequent orders will pick up the approval automatically.- Pass
MasterPrivateKeyin credentials for the first run only, then remove it once approval has been recorded on-chain.Until approval is in place, orders are placed without builder routing (a warning is logged); placement itself is not blocked.
License
MIT © 2026 Elinesoft
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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. |
-
net8.0
- EasyTrading.Abstractions (>= 1.2.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Polly (>= 8.5.0)
- System.Text.Json (>= 8.0.5)
-
net9.0
- EasyTrading.Abstractions (>= 1.2.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Polly (>= 8.5.0)
- System.Text.Json (>= 8.0.5)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on EasyTrading.Core:
| Package | Downloads |
|---|---|
|
EasyTrading.HyperLiquid
HyperLiquid DEX client for .NET — REST (Info + Exchange) and WebSocket with EIP-712 signing (L1 action-signed via the phantom-agent struct, plus user-signed flavour for transfers/approvals), pre-flight order validation (tick / lot / min-notional), REST retry policy with backoff + jitter (honours Retry-After on 429), automatic builder-fee routing with one-shot approveBuilderFee, and WebSocket gap recovery on user streams (REST catch-up + dedup on reconnect). Implements EasyTrading.Abstractions plus HyperLiquid-specific surface (vaults, staking, builder fees). |
|
|
EasyTrading.Aster
Aster Finance (asterdex.com) perpetual DEX client for .NET — REST V3 + Binance-style WebSocket (multiplex market data + listenKey-bound user streams with 30-min keepalive), EIP-712 signing under the AsterSignTransaction domain, pre-flight order validation against /fapi/v3/exchangeInfo filters (PRICE_FILTER / LOT_SIZE / MIN_NOTIONAL), REST retry policy with backoff + jitter. Implements EasyTrading.Abstractions for cross-DEX strategies. |
|
|
EasyTrading.Dydx
dYdX v4 perpetual DEX client for .NET — Indexer REST + public WebSocket + signed Indexer reads + full Cosmos SDK transaction signing (BIP-39 mnemonic → BIP-32 derivation at Cosmos default path m/44'/118'/0'/0/0 → secp256k1 with RFC-6979 deterministic-k → bech32 `dydx1…` address → protobuf TxRaw → REST broadcast to the validator). End-to-end verified on testnet. Implements EasyTrading.Abstractions for cross-DEX strategies. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.3 | 42 | 5/17/2026 |
| 1.2.2 | 46 | 5/17/2026 |
| 1.2.1 | 39 | 5/17/2026 |
| 1.2.0 | 51 | 5/15/2026 |
| 1.1.1 | 54 | 5/14/2026 |
| 1.1.0 | 51 | 5/14/2026 |
| 1.0.3 | 49 | 5/14/2026 |
| 1.0.2 | 37 | 5/14/2026 |
| 1.0.1 | 43 | 5/14/2026 |
| 1.0.0 | 39 | 5/14/2026 |
| 1.0.0-rc.2 | 37 | 5/14/2026 |
| 1.0.0-rc.1 | 34 | 5/14/2026 |
| 0.4.0-alpha.1 | 42 | 5/14/2026 |