Class SymbologyClient
- Namespace
- DatabentoDotNet.Historical
- Assembly
- DatabentoDotNet.Historical.dll
The symbology.* endpoints: what instrument ids a set of symbols had, over a range of
days.
public sealed class SymbologyClient
- Inheritance
-
SymbologyClient
- Inherited Members
Examples
// FromQuery derives the resolution from the range request rather than restating it, so the
// mapping covers exactly the window the records come from. Resolving a different window than you
// download is the mistake this overload exists to prevent.
Resolution resolution = await client.Symbology.ResolveAsync(ResolveParams.FromQuery(request));
foreach ((string rawSymbol, IReadOnlyList<MappingInterval> intervals) in resolution.Mappings)
{
foreach (MappingInterval interval in intervals)
{
// Half-open: the mapping holds from StartDate up to but not including EndDate. An
// instrument id is unique only within its interval.
Console.WriteLine($"{rawSymbol} {interval.StartDate}..{interval.EndDate} -> {interval.Symbol}");
}
}
// A symbol the dataset does not know, or knows for only part of the window, is reported rather
// than thrown. Checking both is the difference between a resolution and an assumption.
Console.WriteLine($"not found: {string.Join(", ", resolution.NotFound)}");
Console.WriteLine($"partial: {string.Join(", ", resolution.Partial)}");
TsSymbolMap symbols = resolution.ToSymbolMap();
Remarks
Reached through Symbology rather than constructed. Port of
upstream's SymbologyClient (symbology.rs:14-18), which holds a mutable borrow of
the outer client; this holds a reference, there being no borrow checker to satisfy.
One endpoint, and it is free — symbology.resolve moves no market data, so nothing here
is gated behind the opt-in that timeseries.get_range and batch.submit_job carry.
Methods
ResolveAsync(ResolveParams, CancellationToken)
Resolves symbols from one symbology to another over a range of UTC days — for example a raw
symbol to an instrument id, ESM2 → 3403.
public Task<Resolution> ResolveAsync(ResolveParams parameters, CancellationToken cancellationToken = default)
Parameters
parametersResolveParamsWhat to resolve, from which symbology to which, over which days.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task<Resolution>
The resolution, with the request's two symbology types attached.
Remarks
Port of upstream's resolve (symbology.rs:29-50). POST, with every
parameter in the form body — see ToFormParameters() for the field
order and for why end_date goes on the wire unchanged.
A symbol that does not resolve is not an error. The API answers HTTP 200 whether or not anything resolved, so no DatabentoApiException is thrown for it and the returned Resolution's NotFound and Partial are the only signal. See Resolution for what each bucket means and for why a symbol appears in Mappings regardless of which one it landed in.
Exceptions
- ArgumentNullException
parametersis null.- DatabentoApiException
The API answered with a non-success status.
- JsonException
The response body was not a resolution: one of
result,partialornot_foundwas absent, or a mapping interval was missing one of its own three keys. A body that omittedresultwould otherwise read as a valid answer in which nothing resolved and nothing was reported missing.