Fiss is a library for strongly-typed interaction with MOEX ISS.
You can install Fiss via NuGet:
Install-Package Fiss
Or via the .NET Core command line interface:
dotnet add package Fiss
To start using Fiss, you need to create an IssRequest
:
var request = new IssRequest();
Next, you need to define the path to the request to MOEX ISS:
var request = request.Engines(Engine.Stock).Markets();
Or
var path = "engines/stock/markets".Split("/");
request.AddPaths(path);
And even like this:
request.AddPathFromFormattedQuery(IssQuery.Acss, "MOEX");
Add query to the request:
request.AddQuery("lang", "en");
You can get the response like this:
await request.ConvertToAsync<TResult>(IHttpContentSerializer, HttpClient, CancellationToken);
If there is a lot of data, you can get it like this:
var cursor = await request.ToCursor<TResult>(IHttpContentSerializer, cursorTitle, index, total, PageSize, HttpClient, CancellationToken);
Or like this:
var cursor = await request.ToCursor();
And then:
await foreach (var page in cursor)
To authenticate on the Moscow Exchange, the following is required.
Install the Fiss.Client package:
Install-Package Fiss.Client
Or via the .NET Core command line interface:
dotnet add package Fiss.Client
Call the AddMoexPassportClient
extension method for IServiceCollection
:
collection.AddMoexPassportClient("NameForMoexPassportClient", IConfigurationSection);
where NameForMoexPassportClient
is a unique name for the client. IConfigurationSection
is a configuration that stores the data for authentication on the MOEX.
Next, you need to get the named client:
var client = IHttpClientFactory.CreateClient("NameForMoexPassportClient");
Then, using this client, you can request data that requires authorization.
The MoexPassportClient
always keeps an up-to-date token for authorization, even if the token expires. MOEX will kindly issue a new token, and the client will become valid again.
Voila! Now you can request any data from MOEX, even undocumented or requiring authorization.
Made with love by Kataane 💜