Configuration
appsettings.json, rate-limit defaults, and how the node registers itself
appsettings.json
The node reads its HTTP client and rate-limit settings from a Binance section, bound
via IOptions<BinanceApiClientOptions>:
"Binance": {
"BaseUrl": "https://api.binance.com/",
"RecvWindowMs": 5000,
"WeightLimitPerMinute": 6000,
"ProactiveThrottleThreshold": 0.8
}
| Key | Type | Default | Description |
|---|---|---|---|
BaseUrl | text | https://api.binance.com/ | Spot v3 REST base URL. Override to point at a different environment (e.g. https://testnet.binance.vision/api) without a code change — see Roadmap for why there's no dedicated environment toggle yet. |
RecvWindowMs | number | 5000 | Binance's documented recvWindow — guards signed requests against replay/clock-skew. |
WeightLimitPerMinute | number | 6000 | Binance's per-IP request-weight budget for the rolling 1-minute window (standard tier). See Rate Limiting. |
ProactiveThrottleThreshold | number (0-1) | 0.8 | Fraction of WeightLimitPerMinute at which the node starts proactively delaying requests, based on the most recent X-MBX-USED-WEIGHT-1M response header. |
Properties use
set, not init: required for
Microsoft.Extensions.Configuration's binder to populate BinanceApiClientOptions
via AddOptions().BindConfiguration("Binance"). When the Binance section is
absent entirely, the hardcoded production defaults above apply.
Registration
BinanceDependency.RegisterDefaults(services) registers everything the node needs:
- The
BinancenamedHttpClient, withBinanceRateLimitHandlerchained on as aDelegatingHandler BinanceApiClient— Singleton (safe: it holds no credential state; every call takes aBinanceApiCredentialas a plain parameter)BinanceAccountService,BinanceOrderService,BinanceMarketDataService— Scoped- The executor itself — Scoped
- The
ExecutorRegistryentry forbinance
Host apps must also add an explicit registration call: referencing this project's
assembly is not sufficient on its own. This codebase's composition root
(
ServiceCollectionExtensionsForAI.cs, Plugins_RegisterAllNodes()) is a
hardcoded list of new {X}Dependency().RegisterDefaults(services) calls — there is no
assembly-scanning auto-discovery. A new BinanceDependency().RegisterDefaults(services);
line must be added there, alongside a project reference from the host to this executor's csproj, or
the node type won't appear in the workflow designer even though the package is referenced.
Project Layout
The node ships as three .NET 9 projects:
| Project | Responsibility |
|---|---|
BizFirst.Integration.Binance.Domain | Pure data contracts — 11 sealed result records (one per operation) plus shared value/request records. Zero logic, zero I/O, zero project/NuGet references. |
BizFirst.Integration.Binance.Services | HTTP client, HMAC-SHA256 request signing, rate-limit handling, response parsing, and one service per resource. |
BizFirst.Ai.ExecutionNodes.Blockchain.Binance | The executor: operation routing, credential resolution, config parsing, operation-info DTOs. |