Official SDK
SDK Clients
Integrate real-time market prices, OHLCV candles, historical data, technical indicators, WebSocket streaming, and MCP support into your application in minutes.
.NET 10NuGet PackageREST + WebSocket + MCP
Requirements
- .NET 10 SDK or later
- A valid RealMarketAPI key — get yours in the dashboard
Installation
Install the package from NuGet using the .NET CLI:
.NET CLI
dotnet add package RealMarketAPI.Sdk
Or via the Package Manager Console in Visual Studio:
Package Manager Console
Install-Package RealMarketAPI.Sdk
Or add directly to your .csproj:
YourProject.csproj
<PackageReference Include="RealMarketAPI.Sdk" Version="1.0.0" />
Quick Start
Register the client in your dependency injection container:
Program.cs
// Minimal setup — pass your API key directly
builder.Services.AddRealMarketApiClient("YOUR_API_KEY");Or with full options for custom configuration:
Program.cs
builder.Services.AddRealMarketApiClient(options =>
{
options.ApiKey = "YOUR_API_KEY";
options.BaseUrl = "https://api.realmarketapi.com/"; // default
});Inject and Use
Inject IRealMarketApiClient into your services or controllers:
MarketService.cs
public class MarketService(IRealMarketApiClient client)
{
public async Task PrintPriceAsync()
{
// Real-time price for EURUSD on the M1 timeframe
var price = await client.Ticker.GetPriceAsync("EURUSD", "M1");
Console.WriteLine($"EURUSD Close: {price.ClosePrice}");
// Latest OHLCV candles for BTCUSDT on H1
var candles = await client.Ticker.GetCandlesAsync("BTCUSDT", "H1");
foreach (var c in candles.Data)
Console.WriteLine(
$"{c.OpenTime}: O={c.OpenPrice} H={c.HighPrice} " +
$"L={c.LowPrice} C={c.ClosePrice}");
// Technical indicators
var sma = await client.Indicators.GetSmaAsync("EURUSD", "H1", period: 20);
var rsi = await client.Indicators.GetRsiAsync("EURUSD", "H1");
var macd = await client.Indicators.GetMacdAsync("EURUSD", "H1");
// All available symbols for your plan
var symbols = await client.Symbols.GetSymbolsAsync();
}
public async Task StreamPricesAsync(CancellationToken ct)
{
// Real-time WebSocket streaming (requires WebSocket-enabled plan)
await foreach (var tick in client.WebSocket.StreamPriceAsync("EURUSD", "M1", ct))
Console.WriteLine($"[WS] {tick.OpenTime}: Close={tick.ClosePrice}");
}
}Storing Your API Key Securely
Never hard-code secrets in source. Store your key in appsettings.json or environment variables and read it at startup:
appsettings.json
{
"RealMarketApi": {
"ApiKey": "YOUR_API_KEY"
}
}Program.cs
builder.Services.AddRealMarketApiClient(options =>
{
options.ApiKey = builder.Configuration["RealMarketApi:ApiKey"]!;
});Ticker — client.Ticker
| Method | Description |
|---|---|
| GetPriceAsync(symbol, timeframe) | Latest real-time ticker with bid/ask prices. |
| GetMarketPricesAsync() | Market overview for all symbols included in your plan. |
| GetCandlesAsync(symbol, timeframe) | Latest OHLCV candles for the given symbol and timeframe. |
| GetHistoryAsync(symbol, start, end, page, size) | Paginated historical candle data for a date range. |
Indicators — client.Indicators
Indicator endpoints require a Pro plan or higher.
| Method | Description |
|---|---|
| GetSmaAsync(symbol, timeframe, period) | Simple Moving Average. |
| GetEmaAsync(symbol, timeframe, period) | Exponential Moving Average. |
| GetRsiAsync(symbol, timeframe, period = 14) | Relative Strength Index. |
| GetMacdAsync(symbol, timeframe, fast=12, slow=26, signal=9) | MACD line, signal line, and histogram. |
| GetSupportResistanceAsync(symbol, timeframe) | Support and resistance levels. |
| GetFibonacciAsync(symbol, timeframe, lookback = 100) | Fibonacci retracement levels. |
Symbols — client.Symbols
| Method | Description |
|---|---|
| GetSymbolsAsync() | All available trading symbols for your plan. |
WebSocket — client.WebSocket
Requires a plan with WebSocket support enabled (
IsSocketSupport = true). Endpoint: wss://api.realmarketapi.com/price| Method | Description |
|---|---|
| StreamPriceAsync(symbol, timeframe, ct) | Stream real-time price ticks as IAsyncEnumerable<PriceTickerResult>. |
MCP — client.Mcp
Exposes the full RealMarket API as MCP tools, callable from AI assistants (GitHub Copilot, Claude, etc.) and from .NET code. Endpoint: https://api.realmarketapi.com/mcp
| Method | MCP Tool | Description |
|---|---|---|
| GetPriceAsync(symbol, timeframe) | get_price | Latest real-time price ticker. |
| GetCandlesAsync(symbol, timeframe) | get_candles | Latest OHLCV candles. |
| GetHistoryAsync(symbol, start, end, page, size) | get_history | Paginated historical candles. |
| GetSymbolsAsync() | get_symbols | All available trading symbols. |
| GetTimeframesAsync() | get_timeframes | Timeframe codes supported by your plan. |
| GetSmaAsync(symbol, timeframe, period=20) | get_sma | Simple Moving Average. |
| GetEmaAsync(symbol, timeframe, period=20) | get_ema | Exponential Moving Average. |
| GetRsiAsync(symbol, timeframe, period=14) | get_rsi | Relative Strength Index. |
| GetMacdAsync(symbol, timeframe, fast=12, slow=26, signal=9) | get_macd | MACD line, signal, and histogram. |
| GetSupportResistanceAsync(symbol, timeframe) | get_support_resistance | Support and resistance levels. |
| GetFibonacciAsync(symbol, timeframe, lookback=100) | get_fibonacci | Fibonacci retracement and extension levels. |
Indicator MCP tools require a Pro plan or higher.
Notes
- Indicator endpoints require a Pro plan or higher.
- WebSocket streaming requires a plan with
IsSocketSupport = true. - Historical data availability depends on your plan's
HistoricalRangeMonthlimit. - All async methods accept an optional
CancellationToken. - Targets .NET 10.