# Sgcwebsockets Dotnet Exchanges

> sgcWebSockets .NET Exchange Feeds

- Skill: `esegece-com/sgcwebsockets-dotnet-exchanges` (Agent Skill, multi-file: 316 files)
- Install (CLI): `npx skillmds@latest add esegece-com/sgcwebsockets-dotnet-exchanges`
- Raw SKILL.md: https://api.skillmd.com/api/skills/esegece-com/sgcwebsockets-dotnet-exchanges/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: esegece-com (https://skillmd.com/u/esegece-com)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/esegece-com/sgcwebsockets-dotnet-exchanges

---


# sgcWebSockets .NET Exchange Feeds

Twenty-five components that speak the WebSocket feed of a trading venue, one per
exchange. They handle the venue's own subscribe grammar, its authentication and
its reconnect replay, so the application deals in typed events instead of JSON.

Like every protocol component in this library, none of them owns a socket. Each
attaches to a `TsgcWebSocketClient` through `Client`, and the client is what
connects. Read `sgcwebsockets-dotnet` first for that and for the threading rule.

## When to use this skill

- Stream tickers, trades, candles or an order book from a crypto exchange
- Subscribe to a private user stream: balances, orders, fills
- Place or cancel orders through an exchange REST API alongside the feed
- Stream forex prices

## Components in this skill

| Venue | Component |
| --- | --- |
| Binance | `TsgcWSAPI_Binance`, `TsgcWSAPI_Binance_Futures` |
| Kraken | `TsgcWSAPI_Kraken`, `TsgcWSAPI_Kraken_Futures` |
| Coinbase | `TsgcWSAPI_Coinbase` |
| Bybit, OKX, Bitget, GateIO | `TsgcWSAPI_Bybit`, `TsgcWSAPI_OKX`, `TsgcWSAPI_Bitget`, `TsgcWSAPI_GateIO` |
| Kucoin | `TsgcWSAPI_Kucoin`, `TsgcWSAPI_Kucoin_Futures` |
| MEXC | `TsgcWSAPI_MEXC`, `TsgcWSAPI_MEXC_Futures` |
| Huobi and HTX | `TsgcWSAPI_Huobi`, `TsgcWSAPI_HTX` |
| Bitfinex, Bitstamp, Bitmex | `TsgcWSAPI_Bitfinex`, `TsgcWSAPI_Bitstamp`, `TsgcWSAPI_Bitmex` |
| Crypto.com, Deribit, Cex | `TsgcWSAPI_CryptoCom`, `TsgcWSAPI_Deribit`, `TsgcWSAPI_Cex`, `TsgcWSAPI_CexPlus` |
| 3Commas, XTB, Forex | `TsgcWSAPI_ThreeCommas`, `TsgcWSAPI_XTB`, `TsgcWSAPI_Forex` |

## Before you start, ask the developer

Use a structured question tool if your host has one, for example Claude Code's
`AskUserQuestion`. Otherwise ask in chat:

1. **Public data or private account data?** Public feeds need nothing. Private
   streams need an API key, and that changes what you build and what you must
   not write into source.
2. **Spot or futures?** They are separate components against separate endpoints.
   `TsgcWSAPI_Binance` will not carry a futures stream.
3. **Which streams, and how many symbols?** Every venue caps subscriptions per
   connection. A watchlist of five hundred symbols is a design question, not a
   loop.
4. **What happens on reconnect?** The component replays subscriptions, but the
   application still has to decide whether a gap in the book matters and
   whether to resynchronise from the REST snapshot.

## Quickstart, Binance

```csharp
using esegece.sgcWebSockets;

var client = new TsgcWebSocketClient();

var binance = new TsgcWSAPI_Binance();
binance.Client = client;                 // the socket lives on the client

client.OnConnect += (TsgcWSConnection connection) =>
{
    binance.SubscribeTicker("BTCUSDT");
    binance.SubscribeKLine("BTCUSDT", TsgcWSBinanceChartIntervals.bci1m);
};

client.Active = true;
```

The subscribe methods return an int, the subscription id the venue assigned.
Keep it if you intend to unsubscribe later.

The candle interval is an enum, and its members are short: `bci1m`, `bci5m`,
`bci1h`, `bci1d`, `bci1w`, `bci1Mo` and the rest. There is no `binance_1m`. The
full list is on `reference/types/TsgcWSBinanceChartIntervals.md`, and it is
worth reading rather than guessing, because a wrong member is a compile error
and a plausible-looking wrong string is a silent empty stream.

## Keys belong outside the source

A private stream needs an API key and secret. Put them in configuration, an
environment variable or a secret store, and read them at startup:

```csharp
binance.Binance.ApiKey = Environment.GetEnvironmentVariable("BINANCE_API_KEY");
```

Never write a key into a source file, an example or a commit. A key in a
repository is a key that has to be rotated, and on an exchange account that is
not a theoretical cost.

## Things that catch people out

- `Active` exists on the API component and on the client. The client's is the
  one that opens the socket.
- Symbols are venue-specific. `BTCUSDT` on Binance, `XBT/USD` on Kraken,
  `BTC-USD` on Coinbase. Passing one venue's spelling to another gets silence,
  not an error.
- Most venues rate-limit subscriptions and disconnect on a burst. Subscribing
  inside `OnConnect` in a tight loop over a large watchlist is the usual way to
  be disconnected immediately after connecting.
- The REST side lives on `REST_API`, a separate object with its own
  authentication. The WebSocket key is not automatically the REST key.
- A venue changing its API is normal. `reference/history.md` in the
  `sgcwebsockets-dotnet` skill records which release followed which change, and
  it is the first place to look when a feed stops matching the documentation.
- Exchange components move faster than most of the library. If a venue has
  shipped a v2 protocol, check the components index before assuming the
  existing component covers it.

## Routing

- **API detail**: `reference/api/<Component>.md` has the properties, events and methods, each with its C# signature.
- **Option / enum / delegate types**: property and event types link to `reference/types/<TypeName>.md`.
- **Examples**: `examples/<Component>.md` is a trimmed snippet from the shipped demo; `examples/index.md` maps every component to its demo.
- **Getting started**: `concepts/overview.md` covers the single `using`, the target frameworks and the naming.

## What is documented

Public instance properties, events and methods declared anywhere in the
library's own class chain. Members inherited from the .NET base classes are
left out, as are internals, so a page shows the surface a caller writes
against and nothing else.

If a component you need is not here, read `concepts/coverage.md` in the
`sgcwebsockets-dotnet` skill before assuming a different name for it.
This assembly carries fewer components than the Delphi library, and saying
so is more useful than guessing an API that does not exist.

