RedoxNet.LsOpenApi.Core
1.2.0
dotnet add package RedoxNet.LsOpenApi.Core --version 1.2.0
NuGet\Install-Package RedoxNet.LsOpenApi.Core -Version 1.2.0
<PackageReference Include="RedoxNet.LsOpenApi.Core" Version="1.2.0" />
<PackageVersion Include="RedoxNet.LsOpenApi.Core" Version="1.2.0" />
<PackageReference Include="RedoxNet.LsOpenApi.Core" />
paket add RedoxNet.LsOpenApi.Core --version 1.2.0
#r "nuget: RedoxNet.LsOpenApi.Core, 1.2.0"
#:package RedoxNet.LsOpenApi.Core@1.2.0
#addin nuget:?package=RedoxNet.LsOpenApi.Core&version=1.2.0
#tool nuget:?package=RedoxNet.LsOpenApi.Core&version=1.2.0
RedoxNet.LsOpenApi.Core
.NET SDK for the LS증권 OpenAPI (REST). Provides the auth, HTTP, TR catalog, and indicator primitives used by the RedoxNet.Mcp.LsOpenApi MCP server, and usable on its own as a Korean stock market data SDK.
Unofficial third-party SDK. Not affiliated with or endorsed by LS Securities Co., Ltd. (LS증권). Read-only market-data scope.
Install
dotnet add package RedoxNet.LsOpenApi.Core
Quick start
Wire the services into the DI container, then resolve LsApiClient and call any TR:
using Microsoft.Extensions.DependencyInjection;
using RedoxNet.LsOpenApi.Core;
using RedoxNet.LsOpenApi.Core.Http;
using System.Text.Json.Nodes;
var services = new ServiceCollection();
services
.AddLogging()
.AddLsOpenApiCore()
.ConfigureLsOptionsFromEnvironment(); // reads LS_APPKEY / LS_APPSECRETKEY / LS_MARKET
var provider = services.BuildServiceProvider();
var client = provider.GetRequiredService<LsApiClient>();
// Call any TR (here: t1101 — 주식 현재가 호가조회 for Samsung Electronics).
var response = await client.CallTrAsync(
"t1101",
new JsonObject { ["shcode"] = "005930" });
if (response.IsSuccess)
{
var quote = response.GetBlock("t1101OutBlock");
// ... read fields from quote ...
}
What's in the box
| Layer | What it provides |
|---|---|
| Auth | LsTokenIssuer — OAuth2 client_credentials, with LsTokenCache (SQLite WAL, key = SHA256(appkey):market — raw app key never on disk). Auto-refresh 5 min pre-expiry; concurrent issuance is serialized. |
| HTTP | LsApiClient.CallTrAsync with Polly retries on 408/429/5xx + per-TR rate limiter + dual continuation modes (header tr_cont_key and body field continuation). |
| Catalog | TrCatalog.Default — 53-TR catalog as an embedded resource (시세 / 차트 / 지수 / 업종 / 테마 / ETF / 스크리너 / 종목조회 / 기타). Search ranks by exact-code, name, category, description, and field-level matches. |
| Indicators | IndicatorService over Skender.Stock.Indicators (SMA, EMA, RSI, MACD, Bollinger). Compact spec parser (ma:5, bb:20,2, macd:12,26,9). |
| Chart context | ChartContextBuilder — pre-computed analysis block (divergence from each MA, volume averages, drawdown from period high, MA trend, tristate bullish_alignment with null during MA warm-up). |
| Analytical summary | AnalyticalSummaryBuilder — token-efficient model-facing snapshot (period-aware MA snapshots, MA60 deviation + slope via least-squares fit, drawdown from peak, 1Y/5Y change, ZigZag-based key_turns with strict peak/trough alternation, and an IndicatorCoverage block that reports each indicator as ok / insufficient_data / disabled with a human-readable note when a window is too narrow). |
| ZigZag | Threshold-reversal swing detector (ZigZag.Compute) with Percent or AtrMultiple modes. Triggers on the close (no intrabar self-trigger), strictly alternating peak/trough pivots, and a trailing tentative pivot at the latest bar for the in-progress swing. |
| Hygiene | SecretMasker.Mask("...XYZW") → "****XYZW". App secret never logged. POSIX chmod 0600 on the token cache file + WAL/SHM siblings. |
Credentials
LS_APPKEY and LS_APPSECRETKEY are read from the process environment via ConfigureLsOptionsFromEnvironment(). By design there is no other input path: MCP elicitation is explicitly avoided for static secrets, since prompting through chat would either log them or train callers to share them in transcripts.
Documentation & source
- Project home: https://github.com/redoxnet/mcp-lsopenapi
- Release notes: https://github.com/redoxnet/mcp-lsopenapi/blob/main/RELEASENOTES.Core.md
- TR inventory: https://github.com/redoxnet/mcp-lsopenapi/blob/main/docs/LS-TR-INVENTORY.md
- License: MIT
| 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 was computed. 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
- Microsoft.Data.Sqlite (>= 8.0.27)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Polly (>= 8.6.6)
- Skender.Stock.Indicators (>= 2.7.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.1.0 — program-trading support. The embedded TR catalog grows from 46 to 53 TRs (the /stock/program family). New internal chart-spec builders and an Analysis layer (ProgramFootprintAnalyzer) back the MCP server's program-trading tools; the public Core API is unchanged. Versioned in lockstep with RedoxNet.Mcp.LsOpenApi 1.1.0. See https://github.com/redoxnet/mcp-lsopenapi/blob/main/RELEASENOTES.Core.md for full notes.