Devreon.MtSuite.Client 1.0.1

dotnet add package Devreon.MtSuite.Client --version 1.0.1
                    
NuGet\Install-Package Devreon.MtSuite.Client -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Devreon.MtSuite.Client" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Devreon.MtSuite.Client" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Devreon.MtSuite.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Devreon.MtSuite.Client --version 1.0.1
                    
#r "nuget: Devreon.MtSuite.Client, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Devreon.MtSuite.Client@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Devreon.MtSuite.Client&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Devreon.MtSuite.Client&version=1.0.1
                    
Install as a Cake Tool

Devreon.MtSuite.Client

Typed HttpClient for accessing Devreon MtSuite Meta Manager REST endpoints from .NET applications.

Installation

Use any of the following:

dotnet add package Devreon.MtSuite.Client
Install-Package Devreon.MtSuite.Client

Requirements

  • .NET 8.0 or .NET 9.0
  • Base URL of a running MtSuite Host (e.g., https://localhost:7287/api)
  • An API key with access to the Meta Manager endpoints

Quick start

using Devreon.MtSuite.Client;
using Devreon.MtSuite.Client.Extensions;
using Devreon.MtSuite.Client.Options;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddMtSuiteRestClient(new MtSuiteMetaManagerRestClientOptions
{
    BaseAddress = "https://localhost:7287/api",
    ApiKey = "/ivpbQiEcRQzKJyVEAY4TkyjIHYjZqhamgPH5bqrfkA="
});

var provider = services.BuildServiceProvider();
var client = provider.GetRequiredService<IMtSuiteMetaManagerRestClient>();

var now = DateTime.UtcNow;
var prices = await client.GetPriceHistoryAsync(
    metaId: Guid.Parse("32ac7f16-1621-4118-9264-7cfe45e8ca7f"),
    symbol: "EURUSD",
    from: now.AddMinutes(-1),
    to: now);

ASP.NET Core integration

Register the client in Program.cs or your composition root and inject IMtSuiteMetaManagerRestClient where needed:

builder.Services.AddMtSuiteRestClient(new MtSuiteMetaManagerRestClientOptions
{
    BaseAddress = builder.Configuration["MtSuite:BaseAddress"]!,
    ApiKey = builder.Configuration["MtSuite:ApiKey"]!
});

// Usage in a service/endpoint/controller
public class PricesService(IMtSuiteMetaManagerRestClient client)
{
    public Task<IList<DtoMtSuiteBidAsk>> GetAsync(Guid metaId, string symbol, DateTime from, DateTime to) =>
        client.GetPriceHistoryAsync(metaId, symbol, from, to);
}

Configuration example:

{
  "MtSuite": {
    "BaseAddress": "https://localhost:7287/api",
    "ApiKey": "<your-api-key>"
  }
}

Configuration options

public sealed class MtSuiteMetaManagerRestClientOptions
{
    public required string BaseAddress { get; init; } // Absolute base URL to MtSuite Host (e.g., https://host:port/api)
    public required string ApiKey { get; init; }      // API key sent as X-Api-Key header
}
  • The client sends X-Api-Key: {ApiKey} on each request.
  • BaseAddress must be an absolute URI and typically includes the API base path.

API surface

public interface IMtSuiteMetaManagerRestClient
{
    Task<IList<DtoMtSuiteBidAsk>> GetPriceHistoryAsync(
        Guid metaId,
        string symbol,
        DateTime from,
        DateTime to,
        CancellationToken cancellationToken = default);
}

DTO returned by GetPriceHistoryAsync:

public class DtoMtSuiteBidAsk
{
    public DateTime Timestamp { get; set; }
    public double Bid { get; set; }
    public double Ask { get; set; }
}

Error handling and behaviors

  • If symbol is null/empty, the client throws ArgumentException.
  • If the server returns 400 or 500, the client throws HttpRequestException including the response body.
  • If the server returns 404, the client returns an empty list.
  • For other non-success statuses, the client uses EnsureSuccessStatusCode() and will throw accordingly.
  • JSON is deserialized using JsonSerializerDefaults.Web with case-insensitive property names.
Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 251 8/14/2025
1.0.0 204 8/14/2025