Repository navigation
Expand file tree
/
Copy pathcontext7.json
More file actions
29 lines (29 loc) · 3.32 KB
/
Copy pathcontext7.json
File metadata and controls
29 lines (29 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
"$schema": "https://context7.com/schema/context7.json",
"projectTitle": "Market Data C#/.NET SDK",
"description": "Official C#/.NET SDK for the Market Data API. Async access to real-time and historical stock, option, fund, and market-status data. Multi-targets .NET 8 and .NET 10.",
"branch": "main",
"excludeFolders": [
".github",
"release-readiness",
"src/MarketDataApp.Tests",
"src/MarketDataApp.IntegrationTests"
],
"rules": [
"The package id, the assembly and the root namespace are all `MarketDataApp`: `dotnet add package MarketDataApp`, then `using MarketDataApp;`. There is one name, not two.",
"Install with `dotnet add package MarketDataApp`. The package is stable from 1.0.0, so no `--prerelease` flag is needed.",
"Prefer `await MarketDataClient.CreateAsync(...)` over the constructor. It validates the token against `/user/` and seeds the rate-limit snapshot without blocking. Set `ValidateTokenOnStartup = false` to skip that call.",
"In ASP.NET Core, register with `services.AddMarketDataClient(...)`. It adds `MarketDataClient` as a singleton over an `IHttpClientFactory`-managed HttpClient.",
"`MarketDataClient` is `IDisposable`. It disposes an `HttpClient` it created itself, and never disposes one the caller supplied — a supplied client keeps its own handler and `Timeout`.",
"Every endpoint method is asynchronous, ends in `Async`, and accepts an optional `CancellationToken`. CSV variants end in `CsvAsync` and return a `CsvResponse` whose text is on `.Csv`.",
"Endpoint methods return a response wrapper, not the rows. Read the data from `.Values` — for example `foreach (var q in response.Values)`. Check `.IsNoData` before indexing, because a valid request can return zero rows.",
"Every field on a data record is nullable. The `columns` parameter can project a field away, and the backend maps NaN to null for closed or illiquid markets. Always null-check before formatting or arithmetic.",
"Data records override `ToString()` to render their data concisely: `Console.WriteLine(quote)` prints `AAPL mid=311.94 last=311.92`. Use it to display a row instead of hand-writing a format string. Missing values render as `n/a`.",
"Records carrying a concise `ToString()`: StockQuote, StockCandle, StockPrice, StockNewsArticle, FundCandle, OptionQuote, MarketStatus, StockEarning, ServiceStatus, User.",
"Response wrappers render a diagnostic summary instead of data — `Console.WriteLine(response)` prints `StockQuotesResponse: 1 item, HTTP 200`. That is intentional. Never parse either `ToString()`; read the typed properties.",
"Errors derive from `MarketDataException`: `AuthenticationException`, `BadRequestException`, `NotFoundException`, `RateLimitException`, `ServerException`, `NetworkException`, `ParseException`. Catch the specific type you can act on.",
"Every `MarketDataException` carries `.SupportInfo`, a formatted block with the request id, URL, status code and timestamp. Ask users for it when diagnosing an issue. It never contains the API token.",
"Supply the API token through the `MARKETDATA_TOKEN` environment variable, `IConfiguration`, or user-secrets — never as a literal in source.",
"The SDK sends the token as an `Authorization: Bearer` header, never as a query parameter, and redacts it to at most four trailing characters in any log output."
]
}